No Description

sprites.makefile 5.0KB

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