Bez popisu

sprites.makefile 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. AS = arm-none-eabi-as
  2. AR = arm-none-eabi-ar
  3. LD = arm-none-eabi-ld
  4. GFX_BUILD_DIR = gfx_build
  5. TMP_LD = $(GFX_BUILD_DIR)/tmp.ld
  6. LDFLAGS := -z muldefs
  7. ASSET_ROOT = sots-private/assets
  8. SPRITES_BINARY = object/pkmn_sprites.o
  9. NORMAL_PNG = $(sort $(wildcard $(ASSET_ROOT)/pkmn_sprites/normal_*.png))
  10. NORMAL_PAL_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/normal_pal/,$(notdir $(NORMAL_PNG:.png=.o)))
  11. SHINY_PNG = $(sort $(wildcard $(ASSET_ROOT)/pkmn_sprites/shiny_*.png))
  12. SHINY_PAL_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/shiny_pal/,$(notdir $(SHINY_PNG:.png=.o)))
  13. SPRITE_FRONT_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/front_sprites/,$(notdir $(NORMAL_PNG:.png=.o)))
  14. SPRITE_BACK_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/back_sprites/,$(notdir $(NORMAL_PNG:.png=.o)))
  15. OW_PNG = $(sort $(wildcard $(ASSET_ROOT)/overworld/*.png))
  16. OW_OBJ = $(addprefix $(GFX_BUILD_DIR)/overworlds/,$(notdir $(OW_PNG:.png=.o)))
  17. TS_PNG = $(sort $(wildcard $(ASSET_ROOT)/trainer_sprites/*.png))
  18. TS_OBJ = $(addprefix $(GFX_BUILD_DIR)/trainer_sprites/,$(notdir $(TS_PNG:.png=.o)))
  19. CASTFORM_PNG = $(ASSET_ROOT)/pkmn_sprites/castform/castform.png
  20. NORMAL_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_normal_pal.o
  21. SHINY_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_shiny_pal.o
  22. CASTFORM_FRONT_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_front.o
  23. CASTFORM_BACK_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_back.o
  24. all: $(SPRITES_BINARY)
  25. .PHONY: clean
  26. clean:
  27. rm -f $(TMP_FILE) $(GFX_BUILD_DIR)/sprites/castform/*
  28. rm -f $(GFX_BUILD_DIR)/sprites/normal_pal/*
  29. rm -f $(GFX_BUILD_DIR)/sprites/shiny_pal/*
  30. rm -f $(GFX_BUILD_DIR)/sprites/front_sprites/*
  31. rm -f $(GFX_BUILD_DIR)/sprites/back_sprites/*
  32. rm -f $(GFX_BUILD_DIR)/overworlds/*
  33. $(SPRITES_BINARY): $(NORMAL_PAL_OBJ) $(SHINY_PAL_OBJ) $(SPRITE_FRONT_OBJ) $(SPRITE_BACK_OBJ) $(NORMAL_CASTFORM_PAL_OBJ) $(SHINY_CASTFORM_PAL_OBJ) $(CASTFORM_FRONT_OBJ) $(CASTFORM_BACK_OBJ) $(OW_OBJ) $(TS_OBJ)
  34. echo "INPUT($^)" > $(TMP_LD)
  35. $(LD) -r -o $@ -T $(TMP_LD)
  36. # OW Targets
  37. $(GFX_BUILD_DIR)/overworlds/%.o: $(GFX_BUILD_DIR)/overworlds/%.s
  38. $(AS) -o $@ $<
  39. .PRECIOUS: $(GFX_BUILD_DIR)/overworlds/%.s
  40. $(GFX_BUILD_DIR)/overworlds/%.s: $(ASSET_ROOT)/overworld/%.png
  41. grit $< -fts -fh! -gt -gB4 -gz! -p -pz! -m! -pu16 -o $@
  42. # Trainer Sprite Targets
  43. $(GFX_BUILD_DIR)/trainer_sprites/%.o: $(GFX_BUILD_DIR)/trainer_sprites/%.s
  44. $(AS) -o $@ $<
  45. .PRECIOUS: $(GFX_BUILD_DIR)/trainer_sprites/%.s
  46. $(GFX_BUILD_DIR)/trainer_sprites/%.s: $(ASSET_ROOT)/trainer_sprites/%.png
  47. grit $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -o $@
  48. # Normal Palette Targets
  49. $(GFX_BUILD_DIR)/sprites/normal_pal/%.o: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  50. $(AS) -o $@ $<
  51. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  52. $(GFX_BUILD_DIR)/sprites/normal_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  53. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  54. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/n_p_/g") \
  55. -o $@
  56. # Shiny Palette Targets
  57. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.o: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  58. $(AS) -o $@ $<
  59. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  60. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  61. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  62. -s $(shell echo $(notdir $(basename $<)) | sed "s/shiny_/s_p_/g") \
  63. -o $@
  64. # Front Sprite Targets
  65. $(GFX_BUILD_DIR)/sprites/front_sprites/%.o: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  66. $(AS) -o $@ $<
  67. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  68. $(GFX_BUILD_DIR)/sprites/front_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  69. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 64 -m! -p! \
  70. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/front_/g") \
  71. -o $@
  72. # Back Sprite Targets
  73. $(GFX_BUILD_DIR)/sprites/back_sprites/%.o: $(GFX_BUILD_DIR)/sprites/bacj_sprites/%.s
  74. $(AS) -o $@ $<
  75. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/back_sprites/%.s
  76. $(GFX_BUILD_DIR)/sprites/back_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  77. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 64 -aw 64 -m! -p! \
  78. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/back_/g") \
  79. -o $@
  80. # Misc hardcoded targets
  81. $(NORMAL_CASTFORM_PAL_OBJ): $(NORMAL_CASTFORM_PAL_OBJ:.o=.s)
  82. $(AS) -o $@ $<
  83. $(NORMAL_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  84. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  85. -s n_p_0385 -o $@
  86. $(SHINY_CASTFORM_PAL_OBJ): $(SHINY_CASTFORM_PAL_OBJ:.o=.s)
  87. $(AS) -o $@ $<
  88. $(SHINY_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  89. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  90. -s s_p_0385 -o $@
  91. $(CASTFORM_FRONT_OBJ): $(CASTFORM_FRONT_OBJ:.o=.s)
  92. $(AS) -o $@ $<
  93. $(CASTFORM_FRONT_OBJ:.o=.s): $(CASTFORM_PNG)
  94. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -ah 64 -m! -p! \
  95. -s front_0385 -o $@
  96. $(CASTFORM_BACK_OBJ): $(CASTFORM_BACK_OBJ:.o=.s)
  97. $(AS) -o $@ $<
  98. $(CASTFORM_BACK_OBJ:.o=.s): $(CASTFORM_PNG)
  99. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -at 64 -ah 64 -m! -p! \
  100. -s back_0385 -o $@