The bitmap wars source code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #! /usr/bin/make -f
  2. # Default Makefile for fxSDK add-ins. This file was probably copied there by
  3. # the [fxsdk] program.
  4. #---
  5. #
  6. # Configuration
  7. #
  8. include project.cfg
  9. # Compiler flags
  10. cf := -mb -ffreestanding -nostdlib -Wall -Wextra \
  11. -fstrict-volatile-bitfields $(CFLAGS)
  12. cf-fx := $(cf) -m3 -DFX9860G
  13. cf-cg := $(cf) -m4-nofpu -DFXCG50
  14. # Linker flags
  15. lf-fx := $(LDFLAGS) -Tfx9860g.ld -lgint-fx -lgcc -Wl,-Map=build-fx/map
  16. lf-cg := $(LDFLAGS) -Tfxcg50.ld -lgint-cg -lgcc -Wl,-Map=build-cg/map
  17. dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP
  18. cpflags := -R .bss -R .gint_bss
  19. g1af := -i "$(ICON_FX)" -n "$(NAME)" --internal="$(INTERNAL)" --version="$(VERSION)"
  20. g3af := -n basic:"$(NAME)" -i uns:"$(ICON_CG_UNS)" -i sel:"$(ICON_CG_SEL)"
  21. #
  22. # File listings
  23. #
  24. null :=
  25. filename := $(subst $(null) $(null),-,$(NAME))
  26. elf = $(dir $<)$(filename).elf
  27. bin = $(dir $<)$(filename).bin
  28. target-fx := $(filename).g1a
  29. target-cg := $(filename).g3a
  30. # Source files
  31. src := $(wildcard src/*.c src/*/*.c src/*/*/*.c src/*/*/*/*.c)
  32. assets-fx := $(wildcard assets-fx/*/*)
  33. assets-cg := $(wildcard assets-cg/*/*)
  34. # Object files
  35. obj-fx := $(src:%.c=build-fx/%.o) $(assets-fx:assets-fx/%=build-fx/assets/%.o)
  36. obj-cg := $(src:%.c=build-cg/%.o) $(assets-cg:assets-cg/%=build-cg/assets/%.o)
  37. # Additional dependencies
  38. deps-fx := $(ICON_FX)
  39. deps-cg := $(ICON_CG_UNS) $(ICON_CG_SEL)
  40. # All targets
  41. all :=
  42. ifneq "$(wildcard build-fx)" ""
  43. all += all-fx
  44. endif
  45. ifneq "$(wildcard build-cg)" ""
  46. all += all-cg
  47. endif
  48. #
  49. # Build rules
  50. #
  51. all: $(all)
  52. all-fx: $(target-fx)
  53. all-cg: $(target-cg)
  54. $(target-fx): $(obj-fx) $(deps-fx)
  55. sh3eb-elf-gcc -o $(elf) $(obj-fx) $(cf-fx) $(lf-fx)
  56. sh3eb-elf-objcopy -O binary $(cpflags) $(elf) $(bin)
  57. fxg1a $(bin) -o $@ $(g1af)
  58. $(target-cg): $(obj-cg) $(deps-cg)
  59. sh4eb-elf-gcc -o $(elf) $(obj-cg) $(cf-cg) $(lf-cg)
  60. sh4eb-elf-objcopy -O binary $(cpflags) $(elf) $(bin)
  61. mkg3a $(g3af) $(bin) $@
  62. # C sources
  63. build-fx/%.o: %.c
  64. @ mkdir -p $(dir $@)
  65. sh3eb-elf-gcc -c $< -o $@ $(cf-fx) $(dflags)
  66. build-cg/%.o: %.c
  67. @ mkdir -p $(dir $@)
  68. sh4eb-elf-gcc -c $< -o $@ $(cf-cg) $(dflags)
  69. # Images
  70. build-fx/assets/img/%.o: assets-fx/img/%
  71. @ mkdir -p $(dir $@)
  72. fxconv -i $< -o $@ --fx name:img_$(basename $*)
  73. build-cg/assets/img/%.o: assets-cg/img/%
  74. @ mkdir -p $(dir $@)
  75. fxconv -i $< -o $@ --cg name:img_$(basename $*)
  76. # Fonts
  77. build-fx/assets/fonts/%.o: assets-fx/fonts/%
  78. @ mkdir -p $(dir $@)
  79. fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*)
  80. build-cg/assets/fonts/%.o: assets-cg/fonts/%
  81. @ mkdir -p $(dir $@)
  82. fxconv -f $< -o $@ name:font_$(basename $*) $(FONT.$*)
  83. #
  84. # Cleaning and utilities
  85. #
  86. # Dependency information
  87. -include $(shell find build* -name *.d 2> /dev/null)
  88. build-fx/%.d: ;
  89. build-cg/%.d: ;
  90. .PRECIOUS: build-fx build-cg build-fx/%.d build-cg/%.d %/
  91. clean:
  92. @ rm -rf build*
  93. distclean: clean
  94. @ rm -f $(target-fx) $(target-cg)
  95. install-fx: $(target-fx)
  96. p7 send -f $<
  97. install-cg: $(target-cg)
  98. @ while [[ ! -h /dev/Prizm1 ]]; do sleep 0.25; done
  99. @ while ! mount /dev/Prizm1; do sleep 0.25; done
  100. @ rm -f /mnt/prizm/$<
  101. @ cp $< /mnt/prizm
  102. @ umount /dev/Prizm1
  103. @- eject /dev/Prizm1
  104. .PHONY: all all-fx all-cg clean distclean install-fx install-cg