shithub: pokecrystal

Download patch

ref: e11ef2b8d5d73fd8c56ee015c78b086aaf3daf02
parent: 782cbc14d66e544ed78dc9d6468455baad239834
author: yenatch <[email protected]>
date: Tue Mar 1 16:01:34 EST 2016

Only generate dependencies for a target when it's invoked.

This means dependencies for unrelated targets aren't generated if you aren't building them. This makes "make clean" and building individual targets fast again.

--- a/Makefile
+++ b/Makefile
@@ -29,11 +29,7 @@
 
 crystal11_obj := $(crystal_obj:.o=11.o)
 
-$(foreach obj, $(crystal_obj:.o=), \
-	$(eval $(obj)_dep := $(shell $(includes) $(obj).asm)) \
-)
 
-
 roms := pokecrystal.gbc
 
 all: $(roms)
@@ -47,9 +43,15 @@
 	@$(MD5) roms.md5
 
 %.asm: ;
-$(crystal11_obj): %11.o: %.asm $$(%_dep)
+
+%11.o: dep = $(shell $(includes) $(@D)/$*.asm)
+$(crystal11_obj): %11.o:
+%11.o: %.asm $$(dep)
 	rgbasm -D CRYSTAL11 -o $@ $<
-$(crystal_obj): %.o: %.asm $$(%_dep)
+
+%.o: dep = $(shell $(includes) $(@D)/$*.asm)
+$(crystal_obj): %.o:
+%.o: %.asm $$(dep)
 	rgbasm -o $@ $<
 
 pokecrystal11.gbc: $(crystal11_obj)