From caeacbe56b09291f8463753b8211b6b5da37c6ec Mon Sep 17 00:00:00 2001 From: Erin Moon Date: Mon, 18 Jan 2021 13:16:09 -0600 Subject: [PATCH] Makefile: DEBUG option (#86) * Makefile: DEBUG option * diff_settings.py: if diffing with --source, make DEBUG=1 Co-authored-by: Pheenoh --- Makefile | 13 ++++++++++++- diff_settings.py | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3ed17adc119..0bf2cf044b9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,16 @@ WINDOWS := $(shell which wine ; echo $$?) UNAME_S := $(shell uname -s) +#------------------------------------------------------------------------------- +# Options +#------------------------------------------------------------------------------- +DEBUG ?= 0 +ifeq ($(DEBUG), 1) + CFLAGS += -g +else + CFLAGS += +endif + #------------------------------------------------------------------------------- # Files #------------------------------------------------------------------------------- @@ -53,6 +63,7 @@ endif AS := $(DEVKITPPC)/bin/powerpc-eabi-as OBJCOPY := $(DEVKITPPC)/bin/powerpc-eabi-objcopy +STRIP := $(DEVKITPPC)/bin/powerpc-eabi-strip CC := $(WINE) tools/mwcc_compiler/$(MWCC_VERSION)/mwcceppc.exe LD := $(WINE) tools/mwcc_compiler/$(MWCC_VERSION)/mwldeppc.exe ELF2DOL := tools/elf2dol @@ -71,7 +82,7 @@ ASFLAGS := -mgekko -I include LDFLAGS := -map $(MAP) -fp hard -nodefaults -w off # Compiler flags -CFLAGS := -Cpp_exceptions off -proc gekko -fp hard -O3 -nodefaults -msgstyle gcc -enum int $(INCLUDES) +CFLAGS += -Cpp_exceptions off -proc gekko -fp hard -O3 -nodefaults -msgstyle gcc -enum int $(INCLUDES) # for postprocess.py PROCFLAGS := -fprologue-fixup=old_stack diff --git a/diff_settings.py b/diff_settings.py index 3b0acfe5214..3e81148936b 100644 --- a/diff_settings.py +++ b/diff_settings.py @@ -11,6 +11,8 @@ def apply(config, args): config['myimg'] = 'build/dolzel2/main.elf' config['baseimg'] = 'baserom.elf' config['makeflags'] = [] + if args.source: + config['makeflags'].append('DEBUG=1') config['source_directories'] = ['src', 'libs', 'include'] config['arch'] = 'ppc' config['objdump_executable'] = f"{os.environ['DEVKITPPC']}/bin/powerpc-eabi-objdump"