diff options
| author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2020-07-04 16:19:15 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-04 16:19:15 -0400 |
| commit | 2718c36065e7eb201a149938bcdd51987c4e56b6 (patch) | |
| tree | 4a1c0294193a497e15ec8e6be59390eb1f84b5d3 /Makefile | |
| parent | Merge pull request #256 from Rangi42/master (diff) | |
| parent | UPDATE_PARTY_MENU_BLK_PACKET -> SET_PAL_PARTY_MENU_HP_BARS, and introduce SET... (diff) | |
| download | pokeyellow-2718c36065e7eb201a149938bcdd51987c4e56b6.tar.gz pokeyellow-2718c36065e7eb201a149938bcdd51987c4e56b6.tar.xz pokeyellow-2718c36065e7eb201a149938bcdd51987c4e56b6.zip | |
Merge pull request #257 from Rangi42/master
More reorganization
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 60 |
1 files changed, 39 insertions, 21 deletions
@@ -5,11 +5,11 @@ audio.o \ home.o \ main.o \ maps.o \ -pics.o \ -sprites.o \ text.o \ -tilesets.o \ wram.o \ +gfx/pics.o \ +gfx/sprites.o \ +gfx/tilesets.o pokered_obj := $(rom_obj:.o=_red.o) pokeblue_obj := $(rom_obj:.o=_blue.o) @@ -35,48 +35,66 @@ RGBLINK ?= $(RGBDS)rgblink .PHONY: all red blue clean tidy compare tools all: $(roms) -red: pokered.gbc +red: pokered.gbc blue: pokeblue.gbc -# For contributors to make sure a change didn't affect the contents of the rom. -compare: $(roms) - @$(MD5) roms.md5 - clean: - rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) - find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} + + rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o + find gfx \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -delete $(MAKE) clean -C tools/ tidy: - rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) + rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.map) $(roms:.gbc=.sym) rgbdscheck.o $(MAKE) clean -C tools/ +# For contributors to make sure a change didn't affect the original contents of the ROMs. +compare: $(roms) + @$(MD5) roms.md5 + tools: $(MAKE) -C tools/ +RGBASMFLAGS = -h -Weverything +# Create a sym/map for debug purposes if `make` run with `DEBUG=1` +ifeq ($(DEBUG),1) +RGBASMFLAGS += -E +endif + +$(pokered_obj): RGBASMFLAGS += -D _RED +$(pokeblue_obj): RGBASMFLAGS += -D _BLUE + +rgbdscheck.o: rgbdscheck.asm + $(RGBASM) -o $@ $< + +# 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. +define DEP +$1: $2 $$(shell tools/scan_includes $2) | 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 tools,$(MAKECMDGOALS))) + $(info $(shell $(MAKE) -C tools)) -endif +# 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)))) -%.asm: ; +endif -%_red.o: dep = $(shell tools/scan_includes $(@D)/$*.asm) -$(pokered_obj): %_red.o: %.asm $$(dep) - $(RGBASM) -D _RED -h -o $@ $*.asm -%_blue.o: dep = $(shell tools/scan_includes $(@D)/$*.asm) -$(pokeblue_obj): %_blue.o: %.asm $$(dep) - $(RGBASM) -D _BLUE -h -o $@ $*.asm +%.asm: ; pokered_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED" pokeblue_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON BLUE" -%.gbc: $$(%_obj) - $(RGBLINK) -d -m $*.map -n $*.sym -l layout.link -o $@ $^ +%.gbc: $$(%_obj) layout.link + $(RGBLINK) -d -m $*.map -n $*.sym -l layout.link -o $@ $(filter %.o,$^) $(RGBFIX) $($*_opt) $@ |
