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.
This commit is contained in:
yenatch 2016-03-01 21:01:34 -05:00
parent 782cbc14d6
commit e11ef2b8d5

View File

@ -29,10 +29,6 @@ gfx/pics.o
crystal11_obj := $(crystal_obj:.o=11.o) crystal11_obj := $(crystal_obj:.o=11.o)
$(foreach obj, $(crystal_obj:.o=), \
$(eval $(obj)_dep := $(shell $(includes) $(obj).asm)) \
)
roms := pokecrystal.gbc roms := pokecrystal.gbc
@ -47,9 +43,15 @@ compare: pokecrystal.gbc pokecrystal11.gbc
@$(MD5) roms.md5 @$(MD5) roms.md5
%.asm: ; %.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 $@ $< rgbasm -D CRYSTAL11 -o $@ $<
$(crystal_obj): %.o: %.asm $$(%_dep)
%.o: dep = $(shell $(includes) $(@D)/$*.asm)
$(crystal_obj): %.o:
%.o: %.asm $$(dep)
rgbasm -o $@ $< rgbasm -o $@ $<
pokecrystal11.gbc: $(crystal11_obj) pokecrystal11.gbc: $(crystal11_obj)