You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

48 lines
1.3 KiB

PYTHON ?= python
# Graphics
SPRITE_PNG := $(shell find png/sprite -type f -name '*.png')
BG_PNG := $(shell find png/bg -type f -name '*.png')
MAP_PNG := $(shell find png/map -type f -name '*.png' -not -name '*_coll.png')
MAP_COLL := $(shell find png/map -type f -name '*_coll.png')
# Graphics (generated)
MAP_S := $(MAP_PNG:%.png=%.s)
MAP_INC := $(MAP_PNG:%.png=%.inc)
SPRITE_2BPP := $(SPRITE_PNG:%.png=%.2bpp)
BG_DATA := $(BG_PNG:%.png=%.2bpp) $(BG_PNG:%.png=%.tilemap)
# Code
SFILES := $(shell find src -type f -name '*.s')
OFILES := $(SFILES:%.s=%.o) $(MAP_S:%.s=%.o)
.PHONY: clean
is.gb is.gb.sym: $(OFILES)
@echo "[LINK] is.gb"
@rgblink -o $@ -n $@.sym $(OFILES)
@rgbfix -v -p 0 $@
$(OFILES): $(MAP_INC)
$(OFILES): $(SPRITE_2BPP)
$(OFILES): $(BG_DATA)
%.o: %.s
@echo "[ASSEMBLE] $<"
@rgbasm -i inc -o $@ $<
png/map/%.s png/map/%.inc: png/map/%.png png/map/%_coll.png
@echo "[MAP] $<"
@$(PYTHON) scripts/generate_map.py $<
png/sprite/%.2bpp: png/sprite/%.png
@echo "[SPRITE] $<"
@rgbgfx -o $@ $<
png/bg/%.2bpp png/bg/%.tilemap: png/bg/%.png
@echo "[BG] $<"
@rgbgfx -T -u -o "$(shell dirname $<)/$(shell basename --suffix=.png $<).2bpp" $<
clean:
@rm -f is.gb is.gb.sym $(OFILES) $(MAP_S) $(MAP_INC) $(SPRITE_2BPP) $(BG_DATA)
@echo "All build files removed"