설명 없음

sprites.makefile 5.1KB

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