-ifndef DEBUG
-CFLAGS += -O2 -DNDEBUG -ffunction-sections
-ifeq ($(findstring clang,$(CC)),)
-LDFLAGS += -Wl,--gc-sections
+
+ifeq ($(DEBUG),1)
+ CFLAGS += -g -O0
+else
+ ifeq ($(platform), vita)
+ CFLAGS += -O3 -DNDEBUG
+ else
+ CFLAGS += -O2 -DNDEBUG -ffunction-sections
+ endif