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

3 years ago
3 years ago
  1. PYTHON ?= python
  2. # Graphics
  3. SPRITE_PNG := $(shell find png/sprite -type f -name '*.png')
  4. BG_PNG := $(shell find png/bg -type f -name '*.png')
  5. MAP_PNG := $(shell find png/map -type f -name '*.png' -not -name '*_coll.png')
  6. MAP_COLL := $(shell find png/map -type f -name '*_coll.png')
  7. # Graphics (generated)
  8. MAP_S := $(MAP_PNG:%.png=%.s)
  9. MAP_INC := $(MAP_PNG:%.png=%.inc)
  10. SPRITE_2BPP := $(SPRITE_PNG:%.png=%.2bpp)
  11. BG_DATA := $(BG_PNG:%.png=%.2bpp) $(BG_PNG:%.png=%.tilemap)
  12. # Code
  13. SFILES := $(shell find src -type f -name '*.s')
  14. OFILES := $(SFILES:%.s=%.o) $(MAP_S:%.s=%.o)
  15. .PHONY: clean
  16. is.gb is.gb.sym: $(OFILES)
  17. @echo "[LINK] is.gb"
  18. @rgblink -o $@ -n $@.sym $(OFILES)
  19. @rgbfix -v -p 0 $@
  20. $(OFILES): $(MAP_INC)
  21. $(OFILES): $(SPRITE_2BPP)
  22. $(OFILES): $(BG_DATA)
  23. %.o: %.s
  24. @echo "[ASSEMBLE] $<"
  25. @rgbasm -i inc -o $@ $<
  26. png/map/%.s png/map/%.inc: png/map/%.png png/map/%_coll.png
  27. @echo "[MAP] $<"
  28. @$(PYTHON) scripts/generate_map.py $<
  29. png/sprite/%.2bpp: png/sprite/%.png
  30. @echo "[SPRITE] $<"
  31. @rgbgfx -o $@ $<
  32. png/bg/%.2bpp png/bg/%.tilemap: png/bg/%.png
  33. @echo "[BG] $<"
  34. @rgbgfx -T -u -o "$(shell dirname $<)/$(shell basename --suffix=.png $<).2bpp" $<
  35. clean:
  36. @rm -f is.gb is.gb.sym $(OFILES) $(MAP_S) $(MAP_INC) $(SPRITE_2BPP) $(BG_DATA)
  37. @echo "All build files removed"