ref: 8b429e2a545e87407a3b8c7b92f7ceafc455e390
parent: 0425018d1ce5b3b726e3cd83f59f14ead9171c92
author: mid-kid <esteve.varela@gmail.com>
date: Tue Oct 25 13:55:30 EDT 2022
Make sure tools are built before dependencies are generated Avoids calling a program that doesn't exist yet (not actively harmful, but yeah...)
--- a/Makefile
+++ b/Makefile
@@ -123,6 +123,12 @@
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.
@@ -131,12 +137,6 @@
$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 shared objects objects
$(foreach obj, $(pokecrystal_obj), $(eval $(call DEP,$(obj),$(obj:.o=.asm))))