aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-07-05 20:41:53 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-07-05 20:41:53 -0400
commit2fda7cbb234a2966599d1de135f55aece69220c6 (patch)
tree6b397d4e076238db74a4a942d2cef8dea72fa0be /Makefile
parentf85fde0cb7ae5706a90c89b199c4554607dd3201 (diff)
downloadseabios-2fda7cbb234a2966599d1de135f55aece69220c6.tar.gz
Use ld to build final rom; remove custom build utilities.
It's possible to build the final rom with a little LD magic - so use that instead of the buildrom.py / defsyms.py method. Also, rename all occurances of ".globl" to the more clear ".global".
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile37
1 files changed, 20 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index b939ed28..b4dcd8e9 100644
--- a/Makefile
+++ b/Makefile
@@ -81,13 +81,6 @@ $(OUT)%.lds: %.lds.S
@echo " Precompiling $<"
$(Q)$(CPP) -P $< -o $@
-$(OUT)%.bin: $(OUT)%.o
- @echo " Extracting binary $@"
- $(Q)objcopy -O binary $< $@
-
-$(OUT)%.offset.auto.h: $(OUT)%.o
- @echo " Generating symbol offset header $@"
- $(Q)nm $< | ./tools/defsyms.py $@
$(OUT)blob.16.s: ; $(call whole-compile, $(CFLAGS16) -S, $(addprefix src/, $(SRC16)),$@)
@@ -96,20 +89,30 @@ $(OUT)romlayout16.o: romlayout.S $(OUT)blob.16.s $(TABLEASM)
@echo " Generating 16bit layout of $@"
$(Q)$(CC) $(CFLAGS16) -c $< -o $@
-$(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rombios16.lds
- @echo " Linking $@"
- $(Q)ld -T $(OUT)rombios16.lds $< -o $@.16
- $(Q)objcopy --change-addresses 0xf0000 $@.16 $@
+$(OUT)romlayout32.o: ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)),$@)
+
+$(OUT)rom32.notreloc.o: $(OUT)romlayout32.o $(OUT)rombios32.lds
+ @echo " Linking (no relocs) $@"
+ $(Q)ld -r -T $(OUT)rombios32.lds $< -o $@.raw
+ $(Q)objcopy --prefix-symbols=_code32_ $@.raw $@
-$(OUT)romlayout32.o: $(OUT)rom16.offset.auto.h ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)),$@)
+$(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rom32.notreloc.o $(OUT)rombios16.lds
+ @echo " Linking $@"
+ $(Q)ld -T $(OUT)rombios16.lds -R $(OUT)rom32.notreloc.o $< -o $@
-$(OUT)rom32.o: $(OUT)romlayout32.o $(OUT)rombios32.lds
+$(OUT)rom32.o: $(OUT)rom16.o $(OUT)romlayout32.o $(OUT)rombios32.lds
@echo " Linking $@"
- $(Q)ld -T $(OUT)rombios32.lds $< -o $@
+ $(Q)ld -T $(OUT)rombios32.lds $(OUT)rom16.o $(OUT)romlayout32.o -o $@
+ $(Q)nm $@ | ./tools/checkrom.py
+
+$(OUT)bios.bin.elf: $(OUT)rom32.o
+ @echo " Stripping $<"
+ $(Q)strip $< -o $@
+
+$(OUT)bios.bin: $(OUT)bios.bin.elf
+ @echo " Extracting binary $@"
+ $(Q)objcopy -O binary $< $@
-$(OUT)bios.bin: $(OUT)rom16.bin $(OUT)rom32.bin $(OUT)rom16.offset.auto.h $(OUT)rom32.offset.auto.h
- @echo " Building $@"
- $(Q)./tools/buildrom.py
####### Generic rules
clean: