summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2020-04-17 17:48:20 -0400
committerPikalaxALT <PikalaxALT@gmail.com>2020-04-17 17:48:20 -0400
commitd83b036b88c87375f616bfd5debfe28901518a98 (patch)
tree313f93afb1afc58c88f79fb911391cf170423491 /Makefile
parent0b7e7a99731b15a381e922260cd7f3718c5beec0 (diff)
parentd458432e79744c8671b1e3ae31decad9366360cf (diff)
Merge branch 'master' into finish_header
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 17 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 60335286..d3a55325 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ TARGET := pokediamond.us
ROM := $(BUILD_DIR)/$(TARGET).nds
ELF := $(BUILD_DIR)/$(TARGET).elf
-LD_SCRIPT := ld_script.txt
+LD_SCRIPT := pokediamond.lcf
# Directories containing source files
SRC_DIRS := src
@@ -37,17 +37,26 @@ MWCCVERSION := 2.0/base
CROSS := arm-linux-gnueabi-
-MWCCARM := tools/mwccarm/$(MWCCVERSION)/mwccarm.exe
+MWCCARM := tools/mwccarm/$(MWCCVERSION)/mwccarm.exe
+# Argh... due to EABI version shenanigans, we can't use GNU LD to link together
+# MWCC built objects and GNU built ones. mwldarm, however, doesn't care, so we
+# have to use mwldarm for now.
+# TODO: Is there a hack workaround to let us go back to GNU LD? Ideally, the
+# only dependency should be MWCCARM.
+MWLDARM := tools/mwccarm/$(MWCCVERSION)/mwldarm.exe
+MWASMARM := tools/mwccarm/$(MWCCVERSION)/mwasmarm.exe
-AS := $(CROSS)as
+AS := $(MWASMARM)
CC := $(MWCCARM)
CPP := cpp -P
-LD := $(CROSS)ld
+LD := $(MWLDARM)
AR := $(CROSS)ar
OBJDUMP := $(CROSS)objdump
OBJCOPY := $(CROSS)objcopy
-CFLAGS = -O4,p -proc arm946e -thumb -fp soft -lang c -Cpp_exceptions off
+# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o
+ASFLAGS = -proc arm5te
+CFLAGS = -O4,p -proc v5te -thumb -fp soft -lang c -Cpp_exceptions off -interworking
####################### Other Tools #########################
@@ -94,13 +103,13 @@ $(BUILD_DIR)/%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
$(BUILD_DIR)/%.o: %.s
- $(AS) $(ASFLAGS) -MD $(BUILD_DIR)/$*.d -o $@ $<
+ $(AS) $(ASFLAGS) $< -o $@
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT)
$(CPP) $(VERSION_CFLAGS) -MMD -MP -MT $@ -MF $@.d -I include/ -I . -DBUILD_DIR=$(BUILD_DIR) -o $@ $<
-$(ELF): $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) undefined_syms.txt
- $(LD) -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) -Map $(BUILD_DIR)/$(TARGET).map
+$(ELF): $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT)
+ $(LD) $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) $(O_FILES) -nodead -w off
$(ROM): $(ELF)
$(OBJCOPY) -O binary --gap-fill=0xFF --pad-to=0x04000000 $< $@