pokemon/Makefile
2023-07-25 05:35:33 +00:00

68 lines
1.1 KiB
Makefile

CFLAGS = -Isaturn
OPT ?= -Og
LIB = ./saturn
SRC = main.o input.o
DEP = $(patsubst %.o,%.d,$(SRC))
res = $(subst pokered/,res/,$(patsubst %.$(1),%.$(1).o,$(wildcard $(2)*.$(1))))
res_png = $(subst pokered/,res/,$(patsubst %.png,%.$(1).o,$(wildcard $(2)*.png)))
GFX_TILESETS = $(call res_png,2bpp,pokered/gfx/tilesets/)
GFX_BLOCKSETS = $(call res,bst,pokered/gfx/blocksets/)
MAPS_BLOCKS = $(call res,blk,pokered/maps/)
GENERATED = $(GFX_TILESETS) $(GFX_BLOCKSETS) $(MAPS_BLOCKS)
OBJ = $(SRC) $(GENERATED)
all: main.cue
include $(LIB)/common.mk
-include $(DEP)
define COPY_BINARY
@mkdir -p $(dir $@)
cp -a $< $@
endef
generated: $(GENERATED)
res/%.2bpp: pokered/%.png
@mkdir -p $(dir $@)
python tools/png_to_nbpp.py $< 2 $@
%.2bpp.h:
$(BUILD_BINARY_H)
%.2bpp.o: %.2bpp %.2bpp.h
$(BUILD_BINARY_O)
res/%.blk: pokered/%.blk
$(COPY_BINARY)
%.blk.h:
$(BUILD_BINARY_H)
%.blk.o: %.blk %.blk.h
$(BUILD_BINARY_O)
res/%.bst: pokered/%.bst
$(COPY_BINARY)
%.bst.h:
$(BUILD_BINARY_H)
%.bst.o: %.bst %.bst.h
$(BUILD_BINARY_O)
%.o: | $(GFX_TILESETS)
main.elf: $(OBJ)
clean: clean-sh
clean-sh:
rm -rf res
PHONY: generated-headers