Brak opisu

sprites.makefile 4.2KB

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