feat: Compile flags for binary size

Small binaries load faster, work better on Aroma Updater, and break the website less
This commit is contained in:
Ash Logan 2024-11-29 20:55:53 +11:00
commit 727f11d04d
2 changed files with 8 additions and 6 deletions

View file

@ -28,15 +28,16 @@ INCLUDES := src src/ext/inih src/lang common
#-------------------------------------------------------------------------------
# options for code generation
#-------------------------------------------------------------------------------
CFLAGS := -Wall -O2 -ffunction-sections\
$(MACHDEP)
OPT := -Os -fno-exceptions -fno-asynchronous-unwind-tables
CFLAGS := -Wall -ffunction-sections -fdata-sections \
$(MACHDEP) $(OPT)
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__
CXXFLAGS := $(CFLAGS) -std=c++20
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Wl,-gc-sections -T$(WUMS_ROOT)/share/libkernel.ld $(WUMSSPECS)
LDFLAGS = -g $(ARCH) $(OPT) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Wl,-gc-sections -T$(WUMS_ROOT)/share/libkernel.ld $(WUMSSPECS)
ifeq ($(DEBUG),1)
CXXFLAGS += -DDEBUG -g

View file

@ -29,8 +29,9 @@ INCLUDES := src ../src/lang ../common
#-------------------------------------------------------------------------------
# options for code generation
#-------------------------------------------------------------------------------
CFLAGS := -Wall -O2 -ffunction-sections -fdata-sections \
$(MACHDEP)
OPT := -Os -fno-exceptions -fno-asynchronous-unwind-tables
CFLAGS := -Wall -ffunction-sections -fdata-sections \
$(MACHDEP) $(OPT)
CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ -D__WUPS__
@ -41,7 +42,7 @@ endif
CXXFLAGS := $(CFLAGS) -std=c++20
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Wl,-gc-sections
LDFLAGS = -g $(ARCH) $(OPT) $(RPXSPECS) -Wl,-Map,$(notdir $*.map) -Wl,-gc-sections -Wl,--discard-all
LDFLAGS += $(WUPSSPECS)