]> xenbits.xensource.com Git - seabios.git/commitdiff
Add compile checking phase to build.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 12 Dec 2012 03:40:16 +0000 (22:40 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 12 Dec 2012 03:40:16 +0000 (22:40 -0500)
The build textually includes all the code together in one unit for the
compiler in order to use gcc's -fwhole-program option.  Textually
including all the code can mask subtle code errors (eg, forgetting to
include the correct headers) and can lead to confusing error reports
from the compiler.  So, compile each file individually in addition to
the normal textually inclusive build.  This improves the error
checking while still obtaining the benefits of -fwhole-program.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Makefile

index b89a0384508c90fce76e19779d5091d95a143b20..f28d86c773442426341b7d28f006e41d2901499b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -109,6 +109,10 @@ $(OUT)%.s: %.c
        @echo "  Compiling to assembler $@"
        $(Q)$(CC) $(CFLAGS16) -S -c $< -o $@
 
+$(OUT)%.o: %.c $(OUT)autoconf.h
+       @echo "  Compile checking $@"
+       $(Q)$(CC) $(CFLAGS32FLAT) -c $< -o $@
+
 $(OUT)%.lds: %.lds.S
        @echo "  Precompiling $@"
        $(Q)$(CPP) -P -D__ASSEMBLY__ $< -o $@
@@ -122,11 +126,11 @@ $(OUT)asm-offsets.h: $(OUT)asm-offsets.s
        @echo "  Generating offset file $@"
        $(Q)./tools/gen-offsets.sh $< $@
 
-$(OUT)ccode16.o: $(OUT)autoconf.h ; $(call whole-compile, $(CFLAGS16), $(addprefix src/, $(SRC16)),$@)
+$(OUT)ccode16.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC16)) ; $(call whole-compile, $(CFLAGS16), $(addprefix src/, $(SRC16)),$@)
 
-$(OUT)code32seg.o: $(OUT)autoconf.h ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@)
+$(OUT)code32seg.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC32SEG)) ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@)
 
-$(OUT)ccode32flat.o: $(OUT)autoconf.h ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@)
+$(OUT)ccode32flat.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC32FLAT)) ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@)
 
 $(OUT)romlayout.o: romlayout.S $(OUT)asm-offsets.h
        @echo "  Compiling (16bit) $@"
@@ -216,7 +220,7 @@ $(OUT)%.hex: src/%.dsl ./tools/acpi_extract_preprocess.py ./tools/acpi_extract.p
        $(Q)$(PYTHON) ./tools/acpi_extract.py $(OUT)$*.lst > $(OUT)$*.off
        $(Q)cat $(OUT)$*.off > $@
 
-$(OUT)ccode32flat.o: $(OUT)acpi-dsdt.hex $(OUT)ssdt-proc.hex $(OUT)ssdt-pcihp.hex $(OUT)ssdt-susp.hex $(OUT)q35-acpi-dsdt.hex
+$(OUT)acpi.o: $(OUT)acpi-dsdt.hex $(OUT)ssdt-proc.hex $(OUT)ssdt-pcihp.hex $(OUT)ssdt-susp.hex $(OUT)q35-acpi-dsdt.hex
 
 ################ Kconfig rules