summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile14
-rw-r--r--ld_script.txt8
-rw-r--r--ld_script_modern.txt9
-rw-r--r--src/crt0.s (renamed from asm/crt0.s)0
-rw-r--r--src/libagbsyscall.s (renamed from asm/libagbsyscall.s)0
-rw-r--r--src/libgcnmultiboot.s (renamed from asm/libgcnmultiboot.s)0
-rw-r--r--src/m4a_1.s (renamed from asm/m4a_1.s)0
-rw-r--r--sym_bss.txt2
8 files changed, 22 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 5a8af32a9..c79647fd6 100644
--- a/Makefile
+++ b/Makefile
@@ -123,6 +123,9 @@ endif
C_SRCS := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c)
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
+C_ASM_SRCS += $(wildcard $(C_SUBDIR)/*.s $(C_SUBDIR)/*/*.s $(C_SUBDIR)/*/*/*.s)
+C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS))
+
ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s)
ASM_OBJS := $(patsubst $(ASM_SUBDIR)/%.s,$(ASM_BUILDDIR)/%.o,$(ASM_SRCS))
@@ -135,7 +138,7 @@ SONG_OBJS := $(patsubst $(SONG_SUBDIR)/%.s,$(SONG_BUILDDIR)/%.o,$(SONG_SRCS))
MID_SRCS := $(wildcard $(MID_SUBDIR)/*.mid)
MID_OBJS := $(patsubst $(MID_SUBDIR)/%.mid,$(MID_BUILDDIR)/%.o,$(MID_SRCS))
-OBJS := $(C_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS)
+OBJS := $(C_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS)
OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
SUBDIRS := $(sort $(dir $(OBJS)))
@@ -236,6 +239,15 @@ $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep)
$(AS) $(ASFLAGS) -o $@ $(C_BUILDDIR)/$*.s
ifeq ($(NODEP),1)
+$(C_BUILDDIR)/%.o: c_asm_dep :=
+else
+$(C_BUILDDIR)/%.o: c_asm_dep = $(shell $(SCANINC) -I "" $(C_SUBDIR)/$*.s)
+endif
+
+$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s $$(c_asm_dep)
+ $(AS) $(ASFLAGS) -o $@ $<
+
+ifeq ($(NODEP),1)
$(ASM_BUILDDIR)/%.o: asm_dep :=
else
$(ASM_BUILDDIR)/%.o: asm_dep = $(shell $(SCANINC) -I "" $(ASM_SUBDIR)/$*.s)
diff --git a/ld_script.txt b/ld_script.txt
index 8d451338c..a044ecdab 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -47,7 +47,7 @@ SECTIONS {
.text :
ALIGN(4)
{
- asm/crt0.o(.text);
+ src/crt0.o(.text);
src/main.o(.text);
src/alloc.o(.text);
src/dma3_manager.o(.text);
@@ -348,8 +348,8 @@ SECTIONS {
lib_text :
ALIGN(4)
{
- asm/libgcnmultiboot.o(.text);
- asm/m4a_1.o(.text);
+ src/libgcnmultiboot.o(.text);
+ src/m4a_1.o(.text);
src/m4a.o(.text);
src/agb_flash.o(.text);
src/agb_flash_1m.o(.text);
@@ -360,7 +360,7 @@ SECTIONS {
asm/librfu_intr.o(.text);
src/librfu_rfu.o(.text);
asm/librfu.o(.text);
- asm/libagbsyscall.o(.text);
+ src/libagbsyscall.o(.text);
*libgcc.a:_call_via_rX.o(.text);
*libgcc.a:_divdi3.o(.text);
*libgcc.a:_divsi3.o(.text);
diff --git a/ld_script_modern.txt b/ld_script_modern.txt
index 98ef16b17..5157e81dc 100644
--- a/ld_script_modern.txt
+++ b/ld_script_modern.txt
@@ -25,7 +25,6 @@ SECTIONS {
{
/* .bss starts at 0x3000000 */
src/*.o(.bss);
- asm/m4a_1.o(.bss);
/* .bss.code starts at 0x3001AA8 */
src/m4a.o(.bss.code);
@@ -42,7 +41,7 @@ SECTIONS {
.text :
ALIGN(4)
{
- asm/crt0.o(.text);
+ src/crt0.o(.text);
src/*.o(.text);
asm/*.o(.text);
} =0
@@ -56,8 +55,8 @@ SECTIONS {
lib_text :
ALIGN(4)
{
- asm/libgcnmultiboot.o(.text);
- asm/m4a_1.o(.text);
+ src/libgcnmultiboot.o(.text);
+ src/m4a_1.o(.text);
src/m4a.o(.text);
src/agb_flash.o(.text);
src/agb_flash_1m.o(.text);
@@ -68,7 +67,7 @@ SECTIONS {
asm/librfu_intr.o(.text);
src/librfu_rfu.o(.text);
asm/librfu.o(.text);
- asm/libagbsyscall.o(.text);
+ src/libagbsyscall.o(.text);
*libgcc.a:*.o(.text*);
*libc.a:*.o(.text*);
src/libisagbprn.o(.text);
diff --git a/asm/crt0.s b/src/crt0.s
index 9ed678968..9ed678968 100644
--- a/asm/crt0.s
+++ b/src/crt0.s
diff --git a/asm/libagbsyscall.s b/src/libagbsyscall.s
index d5639f689..d5639f689 100644
--- a/asm/libagbsyscall.s
+++ b/src/libagbsyscall.s
diff --git a/asm/libgcnmultiboot.s b/src/libgcnmultiboot.s
index 0e418e51f..0e418e51f 100644
--- a/asm/libgcnmultiboot.s
+++ b/src/libgcnmultiboot.s
diff --git a/asm/m4a_1.s b/src/m4a_1.s
index cab4ed174..cab4ed174 100644
--- a/asm/m4a_1.s
+++ b/src/m4a_1.s
diff --git a/sym_bss.txt b/sym_bss.txt
index 4c974c3f6..29b30f2db 100644
--- a/sym_bss.txt
+++ b/sym_bss.txt
@@ -51,7 +51,7 @@
.include "src/pokenav_unk_10.o"
.include "src/ereader_helpers.o"
.include "src/faraway_island.o"
- .include "asm/m4a_1.o"
+ .include "src/m4a_1.o"
.include "src/agb_flash.o"
.include "src/siirtc.o"
.include "*libgcc.a:dp-bit.o"