暂无描述

sprites.makefile 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. AS = @arm-none-eabi-as
  2. AR = @arm-none-eabi-ar
  3. LD = @arm-none-eabi-ld
  4. GRIT = @grit
  5. GFX_BUILD_DIR = gfx_build
  6. TMP_LD = $(GFX_BUILD_DIR)/tmp.ld
  7. LDFLAGS := -z muldefs
  8. ASSET_ROOT = sots-private/assets
  9. SPRITES_BINARY = object/pkmn_sprites.o
  10. ITEM_PNG = $(sort $(wildcard $(ASSET_ROOT)/item_icons/*.png))
  11. ITEM_OBJ = $(addprefix $(GFX_BUILD_DIR)/item/,$(notdir $(ITEM_PNG:.png=.o)))
  12. NORMAL_PNG = $(sort $(wildcard $(ASSET_ROOT)/pkmn_sprites/normal_*.png))
  13. NORMAL_PAL_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/normal_pal/,$(notdir $(NORMAL_PNG:.png=.o)))
  14. SHINY_PNG = $(sort $(wildcard $(ASSET_ROOT)/pkmn_sprites/shiny_*.png))
  15. SHINY_PAL_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/shiny_pal/,$(notdir $(SHINY_PNG:.png=.o)))
  16. SPRITE_FRONT_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/front_sprites/,$(notdir $(NORMAL_PNG:.png=.o)))
  17. SPRITE_BACK_OBJ = $(addprefix $(GFX_BUILD_DIR)/sprites/back_sprites/,$(notdir $(NORMAL_PNG:.png=.o)))
  18. OW_PNG = $(sort $(wildcard $(ASSET_ROOT)/overworld/*.png))
  19. OW_OBJ = $(addprefix $(GFX_BUILD_DIR)/overworlds/,$(notdir $(OW_PNG:.png=.o)))
  20. TS_PNG = $(sort $(wildcard $(ASSET_ROOT)/trainer_sprites/*.png))
  21. TS_OBJ = $(addprefix $(GFX_BUILD_DIR)/trainer_sprites/,$(notdir $(TS_PNG:.png=.o)))
  22. CASTFORM_PNG = $(ASSET_ROOT)/pkmn_sprites/castform/castform.png
  23. NORMAL_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_normal_pal.o
  24. SHINY_CASTFORM_PAL_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_shiny_pal.o
  25. CASTFORM_FRONT_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_front.o
  26. CASTFORM_BACK_OBJ = $(GFX_BUILD_DIR)/sprites/castform/castform_back.o
  27. all: $(SPRITES_BINARY)
  28. .PHONY: clean
  29. clean:
  30. rm -f $(TMP_FILE) $(GFX_BUILD_DIR)/sprites/castform/*
  31. rm -f $(GFX_BUILD_DIR)/sprites/normal_pal/*
  32. rm -f $(GFX_BUILD_DIR)/sprites/shiny_pal/*
  33. rm -f $(GFX_BUILD_DIR)/sprites/front_sprites/*
  34. rm -f $(GFX_BUILD_DIR)/sprites/back_sprites/*
  35. rm -f $(GFX_BUILD_DIR)/overworlds/*
  36. rm -f $(GFX_BUILD_DIR)/item/*
  37. rm -f $(GFX_BUILD_DIR)/trainer_sprites/*
  38. $(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) $(ITEM_OBJ)
  39. @echo -e "\e[1;32mLinking $@\e[0m"
  40. @echo "INPUT($^)" > $(TMP_LD)
  41. $(LD) -r -o $@ -T $(TMP_LD)
  42. # Item Targets
  43. $(GFX_BUILD_DIR)/item/%.o: $(GFX_BUILD_DIR)/item/%.s
  44. @echo -e "\e[32mAssembling $<\e[0m"
  45. $(AS) -o $@ $<
  46. .PRECIOUS: $(GFX_BUILD_DIR)/item/%.s
  47. $(GFX_BUILD_DIR)/item/%.s: $(ASSET_ROOT)/item_icons/%.png
  48. @echo -e "\e[34mProcessing image $<\e[0m"
  49. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -pu16 -o $@
  50. # OW Targets
  51. $(GFX_BUILD_DIR)/overworlds/%.o: $(GFX_BUILD_DIR)/overworlds/%.s
  52. @echo -e "\e[32mAssembling $<\e[0m"
  53. $(AS) -o $@ $<
  54. .PRECIOUS: $(GFX_BUILD_DIR)/overworlds/%.s
  55. $(GFX_BUILD_DIR)/overworlds/%.s: $(ASSET_ROOT)/overworld/%.png
  56. @echo -e "\e[34mProcessing image $<\e[0m"
  57. $(GRIT) $< -fts -fh! -gt -gB4 -gz! -p -pz! -m! -pu16 -o $@
  58. # Trainer Sprite Targets
  59. $(GFX_BUILD_DIR)/trainer_sprites/%.o: $(GFX_BUILD_DIR)/trainer_sprites/%.s
  60. @echo -e "\e[32mAssembling $<\e[0m"
  61. $(AS) -o $@ $<
  62. $(GFX_BUILD_DIR)/trainer_sprites/%.s: $(ASSET_ROOT)/trainer_sprites/%.png
  63. @echo -e "\e[34mProcessing image $<\e[0m"
  64. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -o $@
  65. # Normal Palette Targets
  66. $(GFX_BUILD_DIR)/sprites/normal_pal/%.o: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  67. @echo -e "\e[32mAssembling $<\e[0m"
  68. $(AS) -o $@ $<
  69. $(GFX_BUILD_DIR)/sprites/normal_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  70. @echo -e "\e[34mProcessing palette $< (normal)\e[0m"
  71. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  72. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/n_p_/g") \
  73. -o $@
  74. # Shiny Palette Targets
  75. #$(GFX_BUILD_DIR)/sprites/shiny_pal/%.o: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  76. # @echo -e "\e[32mAssembling $<\e[0m"
  77. # $(AS) -o $@ $<
  78. #$(GFX_BUILD_DIR)/sprites/shiny_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  79. # @echo -e "\e[34mProcessing palette $< (shiny)\e[0m"
  80. # $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  81. # -s $(shell echo $(notdir $(basename $<)) | sed "s/shiny_/s_p_/g") \
  82. # -o $@
  83. # Front Sprite Targets
  84. #$(GFX_BUILD_DIR)/sprites/front_sprites/%.o: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  85. # @echo -e "\e[32mAssembling $<\e[0m"
  86. # $(AS) -o $@ $<
  87. #$(GFX_BUILD_DIR)/sprites/front_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  88. # @echo -e "\e[34mProcessing sprite $< (front)\e[0m"
  89. # $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 64 -m! -p! \
  90. # -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/front_/g") \
  91. # -o $@
  92. # Back Sprite Targets
  93. #$(GFX_BUILD_DIR)/sprites/back_sprites/%.o: $(GFX_BUILD_DIR)/sprites/bacj_sprites/%.s
  94. # @echo -e "\e[32mAssembling $<\e[0m"
  95. # $(AS) -o $@ $<
  96. #$(GFX_BUILD_DIR)/sprites/back_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  97. # @echo -e "\e[34mProcessing sprite $< (back)\e[0m"
  98. # $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 64 -aw 64 -m! -p! \
  99. # -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/back_/g") \
  100. # -o $@
  101. # Misc hardcoded targets
  102. $(NORMAL_CASTFORM_PAL_OBJ): $(NORMAL_CASTFORM_PAL_OBJ:.o=.s)
  103. @echo -e "\e[32mAssembling $<\e[0m"
  104. $(AS) -o $@ $<
  105. $(NORMAL_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  106. @echo -e "\e[34mProcessing palette $< (normal)\e[0m"
  107. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  108. -s n_p_0385 -o $@
  109. $(SHINY_CASTFORM_PAL_OBJ): $(SHINY_CASTFORM_PAL_OBJ:.o=.s)
  110. @echo -e "\e[32mAssembling $<\e[0m"
  111. $(AS) -o $@ $<
  112. $(SHINY_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  113. @echo -e "\e[34mProcessing palette $< (shiny)\e[0m"
  114. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  115. -s s_p_0385 -o $@
  116. $(CASTFORM_FRONT_OBJ): $(CASTFORM_FRONT_OBJ:.o=.s)
  117. @echo -e "\e[32mAssembling $<\e[0m"
  118. $(AS) -o $@ $<
  119. $(CASTFORM_FRONT_OBJ:.o=.s): $(CASTFORM_PNG)
  120. @echo -e "\e[34mProcessing sprite $< (front)\e[0m"
  121. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -ah 64 -m! -p! \
  122. -s front_0385 -o $@
  123. $(CASTFORM_BACK_OBJ): $(CASTFORM_BACK_OBJ:.o=.s)
  124. @echo -e "\e[32mAssembling $<\e[0m"
  125. $(AS) -o $@ $<
  126. $(CASTFORM_BACK_OBJ:.o=.s): $(CASTFORM_PNG)
  127. @echo -e "\e[34mProcessing sprite $< (back)\e[0m"
  128. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -at 64 -ah 64 -m! -p! \
  129. -s back_0385 -o $@