Browse Source

Rewrite Makefile

master
Marrub 5 years ago
parent
commit
094d7f769a
  1. 5
      .gitignore
  2. 68
      Makefile
  3. 1
      bin/dummy
  4. 1
      codedefs/dummy

5
.gitignore vendored

@ -1,5 +1,6 @@
bin/*.ir
codedefs/*.bin
bin/*
codedefs/*
ir/*
doc
fonts
sounds

68
Makefile

@ -1,43 +1,61 @@
## Copyright © 2017 Project Golan, all rights reserved.
CC=gdcc-cc
LD=gdcc-ld
MAKELIB=gdcc-makelib
GDCC_CC=gdcc-cc
GDCC_LD=gdcc-ld
GDCC_MAKELIB=gdcc-makelib
BIN=codedefs
SRC=src
INC=inc
IR=bin
CODEDEFS=codedefs
BIN=bin
IR=ir
TARGET=--bc-target=Doominati
LFLAGS += $(TARGET)
CFLAGS += $(TARGET) --alloc-Aut=4194304 -c
GDCC_TARGET=--bc-target=Doominati
GDCC_LFLAGS += $(GDCC_TARGET)
GDCC_CFLAGS += $(GDCC_TARGET) --alloc-Aut=4194304 -c
MAIN_SOURCES=$(wildcard $(SRC)/*.c)
MAIN_HEADERS=$(wildcard $(SRC)/*.h)
GAME_SOURCES=$(wildcard $(SRC)/g_*.c)
GAME_HEADERS=$(wildcard $(SRC)/g_*.h)
GAME_OUTPUT=$(GAME_SOURCES:$(SRC)/g_%.c=$(IR)/g_%.ir)
GAME_BINARY=$(CODEDEFS)/eikyo-game.bin
MAIN_SOURCES=$(SRC)/main.c
MAIN_OUTPUT=$(MAIN_SOURCES:$(SRC)/%.c=$(IR)/%.ir)
MAIN_BINARY=$(BIN)/影響の目.bin
MAIN_BINARY=$(CODEDEFS)/eikyo-main.bin
MISC_SOURCES=$(wildcard $(SRC)/m_*.c)
MISC_HEADERS=$(wildcard $(SRC)/m_*.h)
MISC_OUTPUT=$(MISC_SOURCES:$(SRC)/m_%.c=$(IR)/m_%.ir)
MISC_BINARY=$(CODEDEFS)/eikyo-misc.bin
RENDER_SOURCES=$(wildcard $(SRC)/r_*.c)
RENDER_HEADERS=$(wildcard $(SRC)/r_*.h)
RENDER_OUTPUT=$(RENDER_SOURCES:$(SRC)/r_%.c=$(IR)/r_%.ir)
RENDER_BINARY=$(CODEDEFS)/eikyo-render.bin
.PHONY: clean
all: $(BIN)/stdlib.bin $(MAIN_BINARY)
all: $(CODEDEFS) $(BIN) $(IR) $(CODEDEFS)/stdlib.bin $(GAME_BINARY) $(MAIN_BINARY) $(MISC_BINARY) $(RENDER_BINARY)
clean:
rm -f bin/*.ir
rm -f codedefs/*.bin
$(CODEDEFS) $(BIN) $(IR):
mkdir -p $@
$(BIN)/stdlib.bin: $(IR)/libc.ir $(IR)/libGDCC.ir
$(LD) $(LFLAGS) -o $@ $^
clean:
rm -f $(BIN)/*
rm -f $(CODEDEFS)/*
rm -f $(IR)/*
$(CODEDEFS)/stdlib.bin: $(IR)/libc.ir $(IR)/libGDCC.ir
$(GAME_BINARY): $(GAME_OUTPUT)
$(MAIN_BINARY): $(MAIN_OUTPUT)
$(LD) $(LFLAGS) -o $@ $^
$(IR)/%.ir: $(SRC)/%.c $(MAIN_HEADERS)
$(CC) $(CFLAGS) -o $@ $<
$(MISC_BINARY): $(MISC_OUTPUT)
$(RENDER_BINARY): $(RENDER_OUTPUT)
$(CODEDEFS)/%.bin:
$(GDCC_LD) $(GDCC_LFLAGS) -o $@ $^
$(IR)/libc.ir:
$(MAKELIB) $(TARGET) $(CFLAGS) -o $@ libc
$(IR)/%.ir: $(SRC)/%.c $(GAME_HEADERS) $(MISC_HEADERS) $(RENDER_HEADERS)
$(GDCC_CC) $(GDCC_CFLAGS) -o $@ $<
$(IR)/libGDCC.ir:
$(MAKELIB) $(TARGET) $(CFLAGS) -o $@ libGDCC
$(IR)/libc.ir $(IR)/libGDCC.ir:
$(GDCC_MAKELIB) $(GDCC_CFLAGS) -o $@ $(basename $(@F))
## EOF

1
bin/dummy

@ -1 +0,0 @@

1
codedefs/dummy

@ -1 +0,0 @@
Loading…
Cancel
Save