aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2013-02-11 14:25:33 +0000
committerMark Rutland <mark.rutland@arm.com>2013-06-05 13:57:42 +0100
commitcc281ad661f59102b52ee1274555e69b1a3bd887 (patch)
tree15382d9d67f9d20f5c8ee09282aa897bcb9b1ec2
parent3ca15bca1ec85810f1438a76413cd4e7e8b45254 (diff)
downloadboot-wrapper-aarch64-cc281ad661f59102b52ee1274555e69b1a3bd887.tar.gz
Allow support of multiple assembly files
To support more complex functionality, it would be nice if we could separate bits of the boot code into separate files. This patch refactors the Makefile, allowing us to add more source files later without having to add a new rule for each file. The defines we pass to each object are also factored into separate lines for easier modification in future. Signed-off-by: Mark Rutland <mark.rutland@arm.com>
-rw-r--r--Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 38595a3..4d5a850 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,12 @@ GIC_DIST_BASE := 0x2c001000
GIC_CPU_BASE := 0x2c002000
CNTFRQ := 0x01800000 # 24Mhz
+DEFINES += -DCNTFRQ=$(CNTFRQ)
+DEFINES += -DGIC_CPU_BASE=$(GIC_CPU_BASE)
+DEFINES += -DGIC_DIST_BASE=$(GIC_DIST_BASE)
+DEFINES += -DSYSREGS_BASE=$(SYSREGS_BASE)
+DEFINES += -DUART_BASE=$(UART_BASE)
+
#INITRD_FLAGS := -DUSE_INITRD
CPPFLAGS += $(INITRD_FLAGS)
@@ -64,8 +70,8 @@ clean:
$(IMAGE): boot.o model.lds fdt.dtb $(KERNEL) $(FILESYSTEM)
$(LD) -o $@ --script=model.lds
-boot.o: $(BOOTLOADER) Makefile
- $(CC) $(CPPFLAGS) -DCNTFRQ=$(CNTFRQ) -DUART_BASE=$(UART_BASE) -DSYSREGS_BASE=$(SYSREGS_BASE) -DGIC_DIST_BASE=$(GIC_DIST_BASE) -DGIC_CPU_BASE=$(GIC_CPU_BASE) -c -o $@ $(BOOTLOADER)
+%.o: %.S Makefile
+ $(CC) $(CPPFLAGS) $(DEFINES) -c -o $@ $<
model.lds: $(LD_SCRIPT) Makefile
$(CC) $(CPPFLAGS) -DPHYS_OFFSET=$(PHYS_OFFSET) -DMBOX_OFFSET=$(MBOX_OFFSET) -DKERNEL_OFFSET=$(KERNEL_OFFSET) -DFDT_OFFSET=$(FDT_OFFSET) -DFS_OFFSET=$(FS_OFFSET) -DKERNEL=$(KERNEL) -DFILESYSTEM=$(FILESYSTEM) -E -P -C -o $@ $<