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.

42 lines
1018 B

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