No Description

sprites.makefile 4.9KB

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