Omi: Eikyo no Me
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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. ## Copyright © 2017 Project Golan, all rights reserved.
  2. ## See COPYING for more information.
  3. GDCC_CC=gdcc-cc
  4. GDCC_LD=gdcc-ld
  5. GDCC_NTSC=gdcc-ntsc
  6. GDCC_MAKELIB=gdcc-makelib
  7. CFLAGS += -O2 -g -c
  8. LFLAGS += -O2 -g -lm
  9. GDCC_TARGET=--bc-target=Doominati
  10. GDCC_LFLAGS += $(GDCC_TARGET)
  11. GDCC_CFLAGS += $(GDCC_TARGET) --alloc-Aut=4194304 -c
  12. SRC=src
  13. INC=inc
  14. BIN=bin
  15. IR=ir
  16. TEXT=text
  17. MAPSRC=maps
  18. DATA_MAIN=data
  19. DATA_MFED=data_mfed
  20. MAPBIN =$(DATA_MAIN)/maps
  21. CODEDEFS =$(DATA_MAIN)/codedefs
  22. CODEDEFS_MFED=$(DATA_MFED)/codedefs
  23. TEXTDEFS =$(DATA_MAIN)/textdefs
  24. FOLDERS=$(CODEDEFS) $(CODEDEFS_MFED) $(TEXTDEFS) $(BIN) $(IR) $(MAPBIN)
  25. define tgt_template =
  26. $(1)_SOURCES=$(SRC)/$(2)
  27. $(1)_OUTPUTS=$$($(1)_SOURCES:$(SRC)/%.c=$(IR)/%.ir)
  28. $(1)_BINARYS=$(3)
  29. endef
  30. define exe_template =
  31. $(1)_SOURCES=$(SRC)/$(2)
  32. $(1)_OUTPUTS=$$($(1)_SOURCES:$(SRC)/%.c=$(BIN)/%.o)
  33. $(1)_BINARYS=$(3)
  34. endef
  35. define lib_template =
  36. $(1)_SOURCES=$$(wildcard $(SRC)/$(2)*.c)
  37. $(1)_HEADERS=$$(wildcard $(SRC)/$(2)*.h)
  38. $(1)_OUTPUTS=$$($(1)_SOURCES:$(SRC)/%.c=$(IR)/%.ir)
  39. $(1)_BINARYS=$(CODEDEFS)/$(3)
  40. endef
  41. $(eval $(call tgt_template,MAIN,main.c,$(CODEDEFS)/eikyo-main.bin))
  42. $(eval $(call tgt_template,MFED,mfed.c,$(CODEDEFS_MFED)/eikyo-mfed.bin))
  43. $(eval $(call exe_template,STRH,strh.c,$(BIN)/strh))
  44. $(eval $(call exe_template,GOL5,golan5.c,$(BIN)/golan5))
  45. $(eval $(call lib_template,GAME,g_,eikyo-game.bin))
  46. $(eval $(call lib_template,INTR,i_,eikyo-interface.bin))
  47. $(eval $(call lib_template,MISC,m_,eikyo-misc.bin))
  48. $(eval $(call lib_template,RNDR,r_,eikyo-render.bin))
  49. MISC_LIBOUTS=$(MISC_SOURCES:$(SRC)/%.c=$(BIN)/%.o)
  50. CDEF_SOURCES=$(SRC)/extmem.nts
  51. CDEF_BINARYS=$(CODEDEFS)/eikyo-extmem.bin
  52. LIBC_OUTPUTS=$(IR)/libc.ir $(IR)/libGDCC.ir
  53. LIBC_BINARYS=$(CODEDEFS)/stdlib.bin
  54. MAPS_SOURCES=$(wildcard $(MAPSRC)/*.gmf9)
  55. MAPS_OUTPUTS=$(MAPS_SOURCES:$(MAPSRC)/%.gmf9=$(MAPBIN)/%.gmf0)
  56. TENG_SOURCES=$(wildcard $(TEXT)/*-eng.nts)
  57. TENG_BINARYS=$(TEXTDEFS)/eikyo-eng.text
  58. TJPN_SOURCES=$(wildcard $(TEXT)/*-jpn.nts)
  59. TJPN_BINARYS=$(TEXTDEFS)/eikyo-jpn.text
  60. .PHONY: clean
  61. .SECONDARY: $(MISC_LIBOUTS)
  62. all: $(FOLDERS) $(GAME_BINARYS) $(INTR_BINARYS) $(MAIN_BINARYS) $(MFED_BINARYS) $(MISC_BINARYS) $(RNDR_BINARYS) $(LIBC_BINARYS) $(MAPS_OUTPUTS) $(CDEF_BINARYS) $(TENG_BINARYS) $(TJPN_BINARYS)
  63. $(GAME_BINARYS): $(GAME_OUTPUTS)
  64. $(GOL5_BINARYS): $(GOL5_OUTPUTS)
  65. $(INTR_BINARYS): $(INTR_OUTPUTS)
  66. $(LIBC_BINARYS): $(LIBC_OUTPUTS)
  67. $(MAIN_BINARYS): $(MAIN_OUTPUTS)
  68. $(MFED_BINARYS): $(MFED_OUTPUTS)
  69. $(MISC_BINARYS): $(MISC_OUTPUTS)
  70. $(RNDR_BINARYS): $(RNDR_OUTPUTS)
  71. $(STRH_BINARYS): $(STRH_OUTPUTS)
  72. $(TENG_BINARYS): $(TENG_SOURCES)
  73. $(TJPN_BINARYS): $(TJPN_SOURCES)
  74. $(FOLDERS):
  75. mkdir -p $@
  76. clean:
  77. rm -f $(addsuffix /*,$(FOLDERS))
  78. $(MAPBIN)/%.gmf0: $(MAPSRC)/%.gmf9 $(GOL5_BINARYS)
  79. $(GOL5_BINARYS) $< $@
  80. $(BIN)/%: $(MISC_LIBOUTS)
  81. $(CC) $(LFLAGS) -o $@ $^
  82. $(BIN)/%.o: $(SRC)/%.c $(MISC_HEADERS)
  83. $(CC) $(CFLAGS) -o $@ $<
  84. %.bin:
  85. $(GDCC_LD) $(GDCC_LFLAGS) -o $@ $^
  86. %.text:
  87. $(GDCC_NTSC) -t TEXTDEFS -o $@ $^
  88. $(IR)/%.ir: $(SRC)/%.c $(GAME_HEADERS) $(INTR_HEADERS) $(MISC_HEADERS) $(RNDR_HEADERS) $(STRH_BINARYS)
  89. $(GDCC_CC) $(GDCC_CFLAGS) -DM_fileHash=$(shell bin/strh $<) -o $@ $<
  90. $(LIBC_OUTPUTS):
  91. $(GDCC_MAKELIB) $(GDCC_CFLAGS) -o $@ $(basename $(@F))
  92. $(CDEF_BINARYS): $(CDEF_SOURCES)
  93. $(GDCC_NTSC) -t CODEDEFS -o $@ $^
  94. ## EOF