(PS3) We shouldn't compile in zlib code in a core period -
[picodrive.git] / Makefile
index 0df793e..f18d26e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,10 @@ TARGET ?= PicoDrive
 CFLAGS += -Wall -ggdb -falign-functions=2
 CFLAGS += -I.
 ifndef DEBUG
-CFLAGS += -O2 -DNDEBUG
+CFLAGS += -O2 -DNDEBUG -ffunction-sections
+ifeq ($(findstring clang,$(CC)),)
+LDFLAGS += -Wl,--gc-sections
+endif
 endif
 #CFLAGS += -DEVT_LOG
 #CFLAGS += -DDRC_CMP
@@ -149,11 +152,13 @@ else
 OBJS += platform/common/mp3_dummy.o
 endif
 
+ifneq "$(DONT_COMPILE_IN_ZLIB)" "1"
 # zlib
 OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
        zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o
 # unzip
 OBJS += unzip/unzip.o unzip/unzip_stream.o
+endif
 
 
 include platform/common/common.mak
@@ -173,7 +178,11 @@ clean:
        $(RM) -r .opk_data
 
 $(TARGET): $(OBJS)
+ifeq ($(STATIC_LINKING), 1)
+       $(AR) rcs $@ $(OBJS)
+else
        $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) $(LDLIBS)
+endif
 
 pprof: platform/linux/pprof.c
        $(CC) -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@