From 6bb3d82e7a11d2fbdada3e5a57e51d9ec7fff142 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Tue, 25 Oct 2022 18:02:29 +0200 Subject: Fix preinclude dependencies From pokecrystal: - 0425018d1ce5b3b726e3cd83f59f14ead9171c92 - 8b429e2a545e87407a3b8c7b92f7ceafc455e390 --- Makefile | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 39176c78..215aa768 100644 --- a/Makefile +++ b/Makefile @@ -103,20 +103,21 @@ $(pokeblue_vc_obj): RGBASMFLAGS += -D _BLUE -D _BLUE_VC rgbdscheck.o: rgbdscheck.asm $(RGBASM) -o $@ $< +# Build tools when building the rom. +# This has to happen before the rules are processed, since that's when scan_includes is run. +ifeq (,$(filter clean tidy tools,$(MAKECMDGOALS))) + +$(info $(shell $(MAKE) -C tools)) + # The dep rules have to be explicit or else missing files won't be reported. # As a side effect, they're evaluated immediately instead of when the rule is invoked. # It doesn't look like $(shell) can be deferred so there might not be a better way. +preinclude_deps := includes.asm $(shell tools/scan_includes includes.asm) define DEP -$1: $2 $$(shell tools/scan_includes $2) | includes.asm rgbdscheck.o +$1: $2 $$(shell tools/scan_includes $2) $(preinclude_deps) | rgbdscheck.o $$(RGBASM) $$(RGBASMFLAGS) -o $$@ $$< endef -# Build tools when building the rom. -# This has to happen before the rules are processed, since that's when scan_includes is run. -ifeq (,$(filter clean tidy tools,$(MAKECMDGOALS))) - -$(info $(shell $(MAKE) -C tools)) - # Dependencies for objects (drop _red and _blue from asm file basenames) $(foreach obj, $(pokered_obj), $(eval $(call DEP,$(obj),$(obj:_red.o=.asm)))) $(foreach obj, $(pokeblue_obj), $(eval $(call DEP,$(obj),$(obj:_blue.o=.asm)))) @@ -125,7 +126,7 @@ $(foreach obj, $(pokered_vc_obj), $(eval $(call DEP,$(obj),$(obj:_red_vc.o=.asm) $(foreach obj, $(pokeblue_vc_obj), $(eval $(call DEP,$(obj),$(obj:_blue_vc.o=.asm)))) # Dependencies for VC files that need to run scan_includes -%.constants.sym: %.constants.asm $(shell tools/scan_includes %.constants.asm) | includes.asm rgbdscheck.o +%.constants.sym: %.constants.asm $(shell tools/scan_includes %.constants.asm) $(preinclude_deps) | rgbdscheck.o $(RGBASM) $(RGBASMFLAGS) $< > $@ endif -- cgit v1.3.1-sl0p