Fix bug in dprintf - isdigit had sign overflow problem.
[seabios.git] / Makefile
index b939ed28538724d4f900625d4ff328e682e065ee..693524b9b9c01b6c11d992667600b3c7f7e8b9bc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,10 @@
 OUT=out/
 
 # Source files
-SRCBOTH=output.c util.c floppy.c ata.c system.c mouse.c kbd.c pci.c boot.c \
-        serial.c clock.c pic.c
-SRC16=$(SRCBOTH) disk.c cdrom.c apm.c pcibios.c
-SRC32=$(SRCBOTH) post.c shadow.c post_menu.c memmap.c coreboot.c \
+SRCBOTH=output.c util.c floppy.c ata.c system.c mouse.c kbd.c pci.c \
+        serial.c clock.c pic.c cdrom.c ps2port.c
+SRC16=$(SRCBOTH) disk.c apm.c pcibios.c vgahooks.c
+SRC32=$(SRCBOTH) post.c shadow.c post_menu.c memmap.c coreboot.c boot.c \
       acpi.c pirtable.c smm.c smpdetect.c mptable.c smbios.c pciinit.c
 TABLESRC=font.c cbt.c floppy_dbt.c
 
@@ -27,8 +27,8 @@ COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)
 COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
 COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
 
-CFLAGS = $(COMMONCFLAGS) -g
-CFLAGS16INC = $(COMMONCFLAGS) -DMODE16 -fno-jump-tables -fno-defer-pop \
+override CFLAGS = $(COMMONCFLAGS) -g -DMODE16=0
+CFLAGS16INC = $(COMMONCFLAGS) -DMODE16=1 -fno-jump-tables -fno-defer-pop \
               $(call cc-option,$(CC),--param large-stack-frame=8,)
 CFLAGS16 = $(CFLAGS16INC) -g
 
@@ -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: $(OUT)rom16.offset.auto.h ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)),$@)
+$(OUT)romlayout32.o: ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32)),$@)
 
 $(OUT)rom32.o: $(OUT)romlayout32.o $(OUT)rombios32.lds
+       @echo "  Linking (no relocs) $@"
+       $(Q)ld -r -T $(OUT)rombios32.lds $< -o $@
+
+$(OUT)rom16.o: $(OUT)romlayout16.o $(OUT)rom32.o $(OUT)rombios16.lds
        @echo "  Linking $@"
-       $(Q)ld -T $(OUT)rombios32.lds $< -o $@
+       $(Q)objcopy --prefix-symbols=_code32_ $(OUT)rom32.o $(OUT)rom32.rename.o
+       $(Q)ld -T $(OUT)rombios16.lds -R $(OUT)rom32.rename.o $< -o $@
+
+$(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32.o $(OUT)rombios.lds
+       @echo "  Linking $@"
+       $(Q)ld -T $(OUT)rombios.lds $(OUT)rom16.o $(OUT)rom32.o -o $@
+
+$(OUT)bios.bin.elf: $(OUT)rom.o
+       @echo "  Prepping $@"
+       $(Q)nm $< | ./tools/checkrom.py
+       $(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: