(PSP) Add PSP target
[picodrive.git] / Makefile
index 0df793e..9201afb 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
@@ -173,7 +176,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 $@