From 965bcfa29d2ea0fea3e181253eb241fa70744f3b Mon Sep 17 00:00:00 2001 From: TheXaman Date: Thu, 4 Feb 2021 18:04:00 +0100 Subject: [PATCH] Added newest Makefile and fixed making from clean --- Makefile | 16 +++++++++++++--- include/debug.h | 2 +- src/debug.c | 2 +- src/event_object_movement.c | 2 +- src/field_control_avatar.c | 2 +- src/trainer_see.c | 2 +- 6 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 98da1e17a1..7ea5bdb926 100644 --- a/Makefile +++ b/Makefile @@ -111,13 +111,13 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern +.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern debugging debugging_modern infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) # Build tools when building the rom # Disable dependency scanning for clean/tidy/tools -ifeq (,$(filter-out all rom compare modern berry_fix libagbsyscall,$(MAKECMDGOALS))) +ifeq (,$(filter-out all rom compare modern debugging debugging_modern berry_fix libagbsyscall,$(MAKECMDGOALS))) $(call infoshell, $(MAKE) tools) else NODEP := 1 @@ -251,6 +251,12 @@ ifeq ($(DINFO),1) override CFLAGS += -g endif +# Debug menu +ifeq ($(DDEBUGGING),1) +override ASFLAGS += --defsym DEBUGGING=1 +override CPPFLAGS += -D DEBUGGING=1 +endif + $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep) @$(CPP) $(CPPFLAGS) $< -o $(C_BUILDDIR)/$*.i @$(PREPROC) $(C_BUILDDIR)/$*.i charmap.txt | $(CC1) $(CFLAGS) -o $(C_BUILDDIR)/$*.s @@ -344,4 +350,8 @@ berry_fix: @$(MAKE) -C berry_fix COMPARE=$(COMPARE) TOOLCHAIN=$(TOOLCHAIN) libagbsyscall: - @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) \ No newline at end of file + @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN) + +# Debug menu +debugging: ; @$(MAKE) DDEBUGGING=1 DINFO=1 +debugging_modern: ; @$(MAKE) MODERN=1 DDEBUGGING=1 DINFO=1 diff --git a/include/debug.h b/include/debug.h index 0d78632e63..4c9c3fffcb 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,7 +1,7 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H -#if DEBUG +#if DEBUGGING void Debug_ShowMainMenu(void); #endif diff --git a/src/debug.c b/src/debug.c index f1672632d4..ec5a4f81ac 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,4 +1,4 @@ -#if DEBUG +#if DEBUGGING //CREDITS //TheXaman: https://github.com/TheXaman/pokeemerald/tree/tx_debug_system //CODE USED FROM: diff --git a/src/event_object_movement.c b/src/event_object_movement.c index ba90eca7e0..de17be1254 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4724,7 +4724,7 @@ u8 GetCollisionAtCoords(struct ObjectEvent *objectEvent, s16 x, s16 y, u32 dir) { u8 direction = dir; -#if DEBUG //DEBUG +#if DEBUGGING //DEBUG if (FlagGet(FLAG_SYS_NO_COLLISION)) return COLLISION_NONE; #endif // diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index c586656fb1..fa607cd42e 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -219,7 +219,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) if (input->pressedSelectButton && UseRegisteredKeyItemOnField() == TRUE) return TRUE; -#if DEBUG +#if DEBUGGING if (input->input_field_1_2) { PlaySE(SE_WIN_OPEN); diff --git a/src/trainer_see.c b/src/trainer_see.c index d5b25b0c59..83783469c1 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -177,7 +177,7 @@ bool8 CheckForTrainersWantingBattle(void) { u8 i; -#if DEBUG //DEBUG +#if DEBUGGING //DEBUG if (FlagGet(FLAG_SYS_NO_TRAINER_SEE)) return FALSE; #endif //