Ei kuvausta

sprites.makefile 4.6KB

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_FILE = $(GFX_BUILD_DIR)/tmp.o
  6. TMP_FILE2 = $(GFX_BUILD_DIR)/tmp2.o
  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. CASTFORM_PNG = $(ASSET_ROOT)/pkmn_sprites/castform/castform.png
  18. NORMAL_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_normal_pal.o
  19. SHINY_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_shiny_pal.o
  20. CASTFORM_FRONT_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_front.o
  21. CASTFORM_BACK_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_back.o
  22. all: $(SPRITES_BINARY)
  23. .PHONY: clean
  24. clean:
  25. rm -f $(TMP_FILE) $(GFX_BUILD_DIR)/sprites/castform/*
  26. rm -f $(GFX_BUILD_DIR)/sprites/normal_pal/*
  27. rm -f $(GFX_BUILD_DIR)/sprites/shiny_pal/*
  28. rm -f $(GFX_BUILD_DIR)/sprites/front_sprites/*
  29. rm -f $(GFX_BUILD_DIR)/sprites/back_sprites/*
  30. rm -f $(GFX_BUILD_DIR)/overworlds/*
  31. $(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)
  32. rm -f $(TMP_FILE2)
  33. rm -f $(TMP_FILE)
  34. for file in $^;\
  35. do \
  36. if [ ! -f $(TMP_FILE) ]; then\
  37. $(LD) -r -o $(TMP_FILE) $$file;\
  38. else\
  39. $(LD) -r -o $(TMP_FILE2) $$file $(TMP_FILE);\
  40. mv -f $(TMP_FILE2) $(TMP_FILE);\
  41. fi;\
  42. done
  43. mv $(TMP_FILE) $@
  44. # OW Targets
  45. $(GFX_BUILD_DIR)/overworlds/%.o: $(GFX_BUILD_DIR)/overworlds/%.s
  46. $(AS) -o $@ $<
  47. .PRECIOUS: $(GFX_BUILD_DIR)/overworlds/%.s
  48. $(GFX_BUILD_DIR)/overworlds/%.s: $(ASSET_ROOT)/overworld/%.png
  49. grit $< -fts -fh! -gt -gB4 -gz! -p -pz! -m! -pu16 -o $@
  50. # Normal Palette Targets
  51. $(GFX_BUILD_DIR)/sprites/normal_pal/%.o: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  52. $(AS) -o $@ $<
  53. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  54. $(GFX_BUILD_DIR)/sprites/normal_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  55. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  56. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/n_p_/g") \
  57. -o $@
  58. # Shiny Palette Targets
  59. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.o: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  60. $(AS) -o $@ $<
  61. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  62. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  63. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  64. -s $(shell echo $(notdir $(basename $<)) | sed "s/shiny_/s_p_/g") \
  65. -o $@
  66. # Front Sprite Targets
  67. $(GFX_BUILD_DIR)/sprites/front_sprites/%.o: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  68. $(AS) -o $@ $<
  69. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  70. $(GFX_BUILD_DIR)/sprites/front_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  71. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 64 -m! -p! \
  72. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/front_/g") \
  73. -o $@
  74. # Back Sprite Targets
  75. $(GFX_BUILD_DIR)/sprites/back_sprites/%.o: $(GFX_BUILD_DIR)/sprites/bacj_sprites/%.s
  76. $(AS) -o $@ $<
  77. .PRECIOUS: $(GFX_BUILD_DIR)/sprites/back_sprites/%.s
  78. $(GFX_BUILD_DIR)/sprites/back_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  79. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 64 -aw 64 -m! -p! \
  80. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/back_/g") \
  81. -o $@
  82. # Misc hardcoded targets
  83. $(NORMAL_CASTFORM_PAL_OBJ): $(NORMAL_CASTFORM_PAL_OBJ:.o=.s)
  84. $(AS) -o $@ $<
  85. $(NORMAL_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  86. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  87. -s n_p_0385 -o $@
  88. $(SHINY_CASTFORM_PAL_OBJ): $(SHINY_CASTFORM_PAL_OBJ:.o=.s)
  89. $(AS) -o $@ $<
  90. $(SHINY_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  91. grit $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  92. -s s_p_0385 -o $@
  93. $(CASTFORM_FRONT_OBJ): $(CASTFORM_FRONT_OBJ:.o=.s)
  94. $(AS) -o $@ $<
  95. $(CASTFORM_FRONT_OBJ:.o=.s): $(CASTFORM_PNG)
  96. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -ah 64 -m! -p! \
  97. -s front_0385 -o $@
  98. $(CASTFORM_BACK_OBJ): $(CASTFORM_BACK_OBJ:.o=.s)
  99. $(AS) -o $@ $<
  100. $(CASTFORM_BACK_OBJ:.o=.s): $(CASTFORM_PNG)
  101. grit $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -at 64 -ah 64 -m! -p! \
  102. -s back_0385 -o $@