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.
 
 
 
 
 

125 lines
3.3 KiB

## Copyright © 2017 Project Golan, all rights reserved.
## See COPYING for more information.
GDCC_CC=gdcc-cc
GDCC_LD=gdcc-ld
GDCC_NTSC=gdcc-ntsc
GDCC_MAKELIB=gdcc-makelib
CFLAGS += -O2 -g -c
LFLAGS += -O2 -g -lm
GDCC_TARGET=--bc-target=Doominati
GDCC_LFLAGS += $(GDCC_TARGET)
GDCC_CFLAGS += $(GDCC_TARGET) --alloc-Aut=4194304 -c
SRC=src
INC=inc
BIN=bin
IR=ir
TEXT=text
MAPSRC=maps
DATA_MAIN=data
DATA_MFED=data_mfed
MAPBIN =$(DATA_MAIN)/maps
CODEDEFS =$(DATA_MAIN)/codedefs
CODEDEFS_MFED=$(DATA_MFED)/codedefs
TEXTDEFS =$(DATA_MAIN)/textdefs
FOLDERS=$(CODEDEFS) $(CODEDEFS_MFED) $(TEXTDEFS) $(BIN) $(IR) $(MAPBIN)
define tgt_template =
$(1)_SOURCES=$(SRC)/$(2)
$(1)_OUTPUTS=$$($(1)_SOURCES:$(SRC)/%.c=$(IR)/%.ir)
$(1)_BINARYS=$(3)
endef
define exe_template =
$(1)_SOURCES=$(SRC)/$(2)
$(1)_OUTPUTS=$$($(1)_SOURCES:$(SRC)/%.c=$(BIN)/%.o)
$(1)_BINARYS=$(3)
endef
define lib_template =
$(1)_SOURCES=$$(wildcard $(SRC)/$(2)*.c)
$(1)_HEADERS=$$(wildcard $(SRC)/$(2)*.h)
$(1)_OUTPUTS=$$($(1)_SOURCES:$(SRC)/%.c=$(IR)/%.ir)
$(1)_BINARYS=$(CODEDEFS)/$(3)
endef
$(eval $(call tgt_template,MAIN,main.c,$(CODEDEFS)/eikyo-main.bin))
$(eval $(call tgt_template,MFED,mfed.c,$(CODEDEFS_MFED)/eikyo-mfed.bin))
$(eval $(call exe_template,STRH,strh.c,$(BIN)/strh))
$(eval $(call exe_template,GOL5,golan5.c,$(BIN)/golan5))
$(eval $(call lib_template,GAME,g_,eikyo-game.bin))
$(eval $(call lib_template,INTR,i_,eikyo-interface.bin))
$(eval $(call lib_template,MISC,m_,eikyo-misc.bin))
$(eval $(call lib_template,RNDR,r_,eikyo-render.bin))
MISC_LIBOUTS=$(MISC_SOURCES:$(SRC)/%.c=$(BIN)/%.o)
CDEF_SOURCES=$(SRC)/extmem.nts
CDEF_BINARYS=$(CODEDEFS)/eikyo-extmem.bin
LIBC_OUTPUTS=$(IR)/libc.ir $(IR)/libGDCC.ir
LIBC_BINARYS=$(CODEDEFS)/stdlib.bin
MAPS_SOURCES=$(wildcard $(MAPSRC)/*.gmf9)
MAPS_OUTPUTS=$(MAPS_SOURCES:$(MAPSRC)/%.gmf9=$(MAPBIN)/%.gmf0)
TENG_SOURCES=$(wildcard $(TEXT)/*-eng.nts)
TENG_BINARYS=$(TEXTDEFS)/eikyo-eng.text
TJPN_SOURCES=$(wildcard $(TEXT)/*-jpn.nts)
TJPN_BINARYS=$(TEXTDEFS)/eikyo-jpn.text
.PHONY: clean
.SECONDARY: $(MISC_LIBOUTS)
all: $(FOLDERS) $(GAME_BINARYS) $(INTR_BINARYS) $(MAIN_BINARYS) $(MFED_BINARYS) $(MISC_BINARYS) $(RNDR_BINARYS) $(LIBC_BINARYS) $(MAPS_OUTPUTS) $(CDEF_BINARYS) $(TENG_BINARYS) $(TJPN_BINARYS)
$(GAME_BINARYS): $(GAME_OUTPUTS)
$(GOL5_BINARYS): $(GOL5_OUTPUTS)
$(INTR_BINARYS): $(INTR_OUTPUTS)
$(LIBC_BINARYS): $(LIBC_OUTPUTS)
$(MAIN_BINARYS): $(MAIN_OUTPUTS)
$(MFED_BINARYS): $(MFED_OUTPUTS)
$(MISC_BINARYS): $(MISC_OUTPUTS)
$(RNDR_BINARYS): $(RNDR_OUTPUTS)
$(STRH_BINARYS): $(STRH_OUTPUTS)
$(TENG_BINARYS): $(TENG_SOURCES)
$(TJPN_BINARYS): $(TJPN_SOURCES)
$(FOLDERS):
mkdir -p $@
clean:
rm -f $(addsuffix /*,$(FOLDERS))
$(MAPBIN)/%.gmf0: $(MAPSRC)/%.gmf9 $(GOL5_BINARYS)
$(GOL5_BINARYS) $< $@
$(BIN)/%: $(MISC_LIBOUTS)
$(CC) $(LFLAGS) -o $@ $^
$(BIN)/%.o: $(SRC)/%.c $(MISC_HEADERS)
$(CC) $(CFLAGS) -o $@ $<
%.bin:
$(GDCC_LD) $(GDCC_LFLAGS) -o $@ $^
%.text:
$(GDCC_NTSC) -t TEXTDEFS -o $@ $^
$(IR)/%.ir: $(SRC)/%.c $(GAME_HEADERS) $(INTR_HEADERS) $(MISC_HEADERS) $(RNDR_HEADERS) $(STRH_BINARYS)
$(GDCC_CC) $(GDCC_CFLAGS) -DM_fileHash=$(shell bin/strh $<) -o $@ $<
$(LIBC_OUTPUTS):
$(GDCC_MAKELIB) $(GDCC_CFLAGS) -o $@ $(basename $(@F))
$(CDEF_BINARYS): $(CDEF_SOURCES)
$(GDCC_NTSC) -t CODEDEFS -o $@ $^
## EOF