From a4d5624ad6ab4535c448df9302517a9c983418e3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 6 Aug 2019 14:08:13 -0400 Subject: [PATCH] Move asm srcs to src --- Makefile | 14 +++++++++++++- ld_script.txt | 8 ++++---- ld_script_modern.txt | 9 ++++----- {asm => src}/crt0.s | 0 {asm => src}/libagbsyscall.s | 0 {asm => src}/libgcnmultiboot.s | 0 {asm => src}/m4a_1.s | 0 sym_bss.txt | 2 +- 8 files changed, 22 insertions(+), 11 deletions(-) rename {asm => src}/crt0.s (100%) rename {asm => src}/libagbsyscall.s (100%) rename {asm => src}/libgcnmultiboot.s (100%) rename {asm => src}/m4a_1.s (100%) 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))) @@ -235,6 +238,15 @@ $(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $$(c_dep) @echo -e ".text\n\t.align\t2, 0\n" >> $(C_BUILDDIR)/$*.s $(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 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 similarity index 100% rename from asm/crt0.s rename to src/crt0.s diff --git a/asm/libagbsyscall.s b/src/libagbsyscall.s similarity index 100% rename from asm/libagbsyscall.s rename to src/libagbsyscall.s diff --git a/asm/libgcnmultiboot.s b/src/libgcnmultiboot.s similarity index 100% rename from asm/libgcnmultiboot.s rename to src/libgcnmultiboot.s diff --git a/asm/m4a_1.s b/src/m4a_1.s similarity index 100% rename from asm/m4a_1.s rename to 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"