暂无描述

sprites.makefile 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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)/title_screen/*
  38. rm -f $(GFX_BUILD_DIR)/trainer_sprites/*
  39. $(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)
  40. @echo -e "\e[1;32mLinking $@\e[0m"
  41. @echo "INPUT($^)" > $(TMP_LD)
  42. $(LD) -r -o $@ -T $(TMP_LD)
  43. # Item Targets
  44. $(GFX_BUILD_DIR)/item/%.o: $(GFX_BUILD_DIR)/item/%.s
  45. @echo -e "\e[32mAssembling $<\e[0m"
  46. $(AS) -o $@ $<
  47. .PRECIOUS: $(GFX_BUILD_DIR)/item/%.s
  48. $(GFX_BUILD_DIR)/item/%.s: $(ASSET_ROOT)/item_icons/%.png
  49. @echo -e "\e[34mProcessing image $<\e[0m"
  50. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -pu16 -o $@
  51. # OW Targets
  52. $(GFX_BUILD_DIR)/overworlds/%.o: $(GFX_BUILD_DIR)/overworlds/%.s
  53. @echo -e "\e[32mAssembling $<\e[0m"
  54. $(AS) -o $@ $<
  55. .PRECIOUS: $(GFX_BUILD_DIR)/overworlds/%.s
  56. $(GFX_BUILD_DIR)/overworlds/%.s: $(ASSET_ROOT)/overworld/%.png
  57. @echo -e "\e[34mProcessing image $<\e[0m"
  58. $(GRIT) $< -fts -fh! -gt -gB4 -gz! -p -pz! -m! -pu16 -o $@
  59. # Trainer Sprite Targets
  60. $(GFX_BUILD_DIR)/trainer_sprites/%.o: $(GFX_BUILD_DIR)/trainer_sprites/%.s
  61. @echo -e "\e[32mAssembling $<\e[0m"
  62. $(AS) -o $@ $<
  63. $(GFX_BUILD_DIR)/trainer_sprites/%.s: $(ASSET_ROOT)/trainer_sprites/%.png
  64. @echo -e "\e[34mProcessing image $<\e[0m"
  65. $(GRIT) $< -fts -fh! -gt -gB4 -gzl -p -pzl -m! -o $@
  66. # Normal Palette Targets
  67. $(GFX_BUILD_DIR)/sprites/normal_pal/%.o: $(GFX_BUILD_DIR)/sprites/normal_pal/%.s
  68. @echo -e "\e[32mAssembling $<\e[0m"
  69. $(AS) -o $@ $<
  70. $(GFX_BUILD_DIR)/sprites/normal_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  71. @echo -e "\e[34mProcessing palette $< (normal)\e[0m"
  72. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  73. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/n_p_/g") \
  74. -o $@
  75. # Shiny Palette Targets
  76. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.o: $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s
  77. @echo -e "\e[32mAssembling $<\e[0m"
  78. $(AS) -o $@ $<
  79. $(GFX_BUILD_DIR)/sprites/shiny_pal/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  80. @echo -e "\e[34mProcessing palette $< (shiny)\e[0m"
  81. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 16 \
  82. -s $(shell echo $(notdir $(basename $<)) | sed "s/shiny_/s_p_/g") \
  83. -o $@
  84. # Front Sprite Targets
  85. $(GFX_BUILD_DIR)/sprites/front_sprites/%.o: $(GFX_BUILD_DIR)/sprites/front_sprites/%.s
  86. @echo -e "\e[32mAssembling $<\e[0m"
  87. $(AS) -o $@ $<
  88. $(GFX_BUILD_DIR)/sprites/front_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  89. @echo -e "\e[34mProcessing sprite $< (front)\e[0m"
  90. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 64 -m! -p! \
  91. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/front_/g") \
  92. -o $@
  93. # Back Sprite Targets
  94. $(GFX_BUILD_DIR)/sprites/back_sprites/%.o: $(GFX_BUILD_DIR)/sprites/bacj_sprites/%.s
  95. @echo -e "\e[32mAssembling $<\e[0m"
  96. $(AS) -o $@ $<
  97. $(GFX_BUILD_DIR)/sprites/back_sprites/%.s: $(ASSET_ROOT)/pkmn_sprites/%.png
  98. @echo -e "\e[34mProcessing sprite $< (back)\e[0m"
  99. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 64 -aw 64 -m! -p! \
  100. -s $(shell echo $(notdir $(basename $<)) | sed "s/normal_/back_/g") \
  101. -o $@
  102. # Misc hardcoded targets
  103. $(NORMAL_CASTFORM_PAL_OBJ): $(NORMAL_CASTFORM_PAL_OBJ:.o=.s)
  104. @echo -e "\e[32mAssembling $<\e[0m"
  105. $(AS) -o $@ $<
  106. $(NORMAL_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  107. @echo -e "\e[34mProcessing palette $< (normal)\e[0m"
  108. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  109. -s n_p_0385 -o $@
  110. $(SHINY_CASTFORM_PAL_OBJ): $(SHINY_CASTFORM_PAL_OBJ:.o=.s)
  111. @echo -e "\e[32mAssembling $<\e[0m"
  112. $(AS) -o $@ $<
  113. $(SHINY_CASTFORM_PAL_OBJ:.o=.s): $(CASTFORM_PNG)
  114. @echo -e "\e[34mProcessing palette $< (shiny)\e[0m"
  115. $(GRIT) $< -fts -fh! -g! -gB 4 -gt -m! -p -pzl -pu16 -pn 64 \
  116. -s s_p_0385 -o $@
  117. $(CASTFORM_FRONT_OBJ): $(CASTFORM_FRONT_OBJ:.o=.s)
  118. @echo -e "\e[32mAssembling $<\e[0m"
  119. $(AS) -o $@ $<
  120. $(CASTFORM_FRONT_OBJ:.o=.s): $(CASTFORM_PNG)
  121. @echo -e "\e[34mProcessing sprite $< (front)\e[0m"
  122. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -ah 64 -m! -p! \
  123. -s front_0385 -o $@
  124. $(CASTFORM_BACK_OBJ): $(CASTFORM_BACK_OBJ:.o=.s)
  125. @echo -e "\e[32mAssembling $<\e[0m"
  126. $(AS) -o $@ $<
  127. $(CASTFORM_BACK_OBJ:.o=.s): $(CASTFORM_PNG)
  128. @echo -e "\e[34mProcessing sprite $< (back)\e[0m"
  129. $(GRIT) $< -fts -fh! -g -gB 4 -gt -gzl -al 0 -aw 256 -at 64 -ah 64 -m! -p! \
  130. -s back_0385 -o $@