mirror of
https://github.com/FireEmblemUniverse/fireemblem8u.git
synced 2024-11-23 13:19:53 +00:00
add automatic dependency generation
This commit is contained in:
parent
bb1d40879e
commit
a5caa19cfa
1
.gitignore
vendored
1
.gitignore
vendored
@ -61,3 +61,4 @@ src/*.s
|
||||
*.dump
|
||||
tools/agbcc
|
||||
*.exe
|
||||
.dep
|
||||
|
11
Makefile
11
Makefile
@ -22,23 +22,29 @@ SYM_FILES := sym_iwram.txt sym_ewram.txt
|
||||
CFILES := $(wildcard src/*.c)
|
||||
SFILES := $(wildcard asm/*.s) $(wildcard asm/libc/*.s) $(wildcard data/*.s)
|
||||
OFILES := $(SFILES:.s=.o) $(CFILES:.c=.o)
|
||||
DEPS_DIR := .dep
|
||||
|
||||
# Use the older compiler to build the m4a library
|
||||
# Use the older compiler to build library code
|
||||
src/agb_sram.o: CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O1
|
||||
src/m4a_2.o: CC1 := tools/agbcc/bin/old_agbcc
|
||||
src/m4a_4.o: CC1 := tools/agbcc/bin/old_agbcc
|
||||
|
||||
|
||||
#### Main Targets ####
|
||||
|
||||
compare: $(ROM)
|
||||
sha1sum -c checksum.sha1
|
||||
|
||||
clean:
|
||||
$(RM) $(ROM) $(ELF) $(MAP) $(OFILES) src/*.s
|
||||
$(RM) $(ROM) $(ELF) $(MAP) $(OFILES) src/*.s -r $(DEPS_DIR)
|
||||
|
||||
|
||||
#### Recipes ####
|
||||
|
||||
# Automatic dependency generation
|
||||
MAKEDEPEND = mkdir -p $(DEPS_DIR)/$(@D) && $(CPP) $(CPPFLAGS) $< -MM -MG -MT $@ $(DEPS_DIR)/$*.d > $(DEPS_DIR)/$*.d
|
||||
-include $(addprefix $(DEPS_DIR)/,$(CFILES:.c=.d))
|
||||
|
||||
$(ELF): $(OFILES) $(LDSCRIPT) $(SYM_FILES)
|
||||
$(LD) -T $(LDSCRIPT) -Map $(MAP) $(OFILES) tools/agbcc/lib/libgcc.a tools/agbcc/lib/libc.a -o $@
|
||||
|
||||
@ -46,6 +52,7 @@ $(ELF): $(OFILES) $(LDSCRIPT) $(SYM_FILES)
|
||||
$(OBJCOPY) -O binary --pad-to 0x9000000 $< $@
|
||||
|
||||
%.o: %.c
|
||||
@$(MAKEDEPEND)
|
||||
$(CPP) $(CPPFLAGS) $< | $(CC1) $(CC1FLAGS) -o $*.s
|
||||
echo '.ALIGN 2, 0' >> $*.s
|
||||
$(AS) $(ASFLAGS) $*.s -o $*.o
|
||||
|
Loading…
Reference in New Issue
Block a user