summaryrefslogtreecommitdiff
path: root/roms/seabios/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'roms/seabios/Makefile')
-rw-r--r--roms/seabios/Makefile55
1 files changed, 21 insertions, 34 deletions
diff --git a/roms/seabios/Makefile b/roms/seabios/Makefile
index b0e203113..20da6d01c 100644
--- a/roms/seabios/Makefile
+++ b/roms/seabios/Makefile
@@ -25,7 +25,7 @@ SRC32SEG=util.c output.c pci.c pcibios.c apm.c stacks.c
cc-option=$(shell if test -z "`$(1) $(2) -S -o /dev/null -xc /dev/null 2>&1`" \
; then echo "$(2)"; else echo "$(3)"; fi ;)
-COMMONCFLAGS = -I$(OUT) -Os -MD -g \
+COMMONCFLAGS := -I$(OUT) -Os -MD -g \
-Wall -Wno-strict-aliasing -Wold-style-definition \
$(call cc-option,$(CC),-Wtype-limits,) \
-m32 -march=i386 -mregparm=3 -mpreferred-stack-boundary=2 \
@@ -36,14 +36,14 @@ COMMONCFLAGS += $(call cc-option,$(CC),-nopie,)
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
-CFLAGS32FLAT = $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0 -fomit-frame-pointer
-CFLAGSSEG = $(COMMONCFLAGS) -DMODESEGMENT=1 -fno-defer-pop \
+CFLAGS32FLAT := $(COMMONCFLAGS) -DMODE16=0 -DMODESEGMENT=0 -fomit-frame-pointer
+CFLAGSSEG := $(COMMONCFLAGS) -DMODESEGMENT=1 -fno-defer-pop \
$(call cc-option,$(CC),-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \
$(call cc-option,$(CC),-fno-tree-switch-conversion,)
-CFLAGS32SEG = $(CFLAGSSEG) -DMODE16=0 -fomit-frame-pointer
-CFLAGS16INC = $(CFLAGSSEG) -DMODE16=1 -Wa,src/code16gcc.s \
+CFLAGS32SEG := $(CFLAGSSEG) -DMODE16=0 -fomit-frame-pointer
+CFLAGS16INC := $(CFLAGSSEG) -DMODE16=1 -Wa,src/code16gcc.s \
$(call cc-option,$(CC),--param large-stack-frame=4,-fno-inline)
-CFLAGS16 = $(CFLAGS16INC) -fomit-frame-pointer
+CFLAGS16 := $(CFLAGS16INC) -fomit-frame-pointer
# Run with "make V=1" to see the actual compile commands
ifdef V
@@ -84,39 +84,22 @@ vpath %.S src vgasrc
################ Common build rules
# Verify the build environment works.
-TESTGCC:=$(shell CC="$(CC)" LD="$(LD)" IASL="$(IASL)" tools/test-build.sh)
+TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" LD="$(LD)" IASL="$(IASL)" tools/test-build.sh)
ifeq "$(TESTGCC)" "-1"
$(error "Please upgrade the build environment")
endif
-ifndef COMPSTRAT
-COMPSTRAT=$(TESTGCC)
+ifeq "$(TESTGCC)" "0"
+# Use -fwhole-program
+CFLAGSWHOLE=-fwhole-program -DWHOLE_PROGRAM
endif
-# Do a whole file compile - three methods are supported.
-ifeq "$(COMPSTRAT)" "1"
-# First method - use -fwhole-program without -combine.
+# Do a whole file compile by textually including all C code.
define whole-compile
@echo " Compiling whole program $3"
-$(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
-$(Q)$(CC) $1 -fwhole-program -DWHOLE_PROGRAM -c $3.tmp.c -o $3
+$(Q)printf '$(foreach i,$2,#include "$(CURDIR)/$i"\n)' > $3.tmp.c
+$(Q)$(CC) $1 $(CFLAGSWHOLE) -c $3.tmp.c -o $3
endef
-else
-ifeq "$(COMPSTRAT)" "2"
-# Second menthod - don't use -fwhole-program at all.
-define whole-compile
-@echo " Compiling whole program $3"
-$(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
-$(Q)$(CC) $1 -c $3.tmp.c -o $3
-endef
-else
-# Third (and preferred) method - use -fwhole-program with -combine
-define whole-compile
-@echo " Compiling whole program $3"
-$(Q)$(CC) $1 -fwhole-program -DWHOLE_PROGRAM -combine -c $2 -o $3
-endef
-endif
-endif
%.strip.o: %.o
@echo " Stripping $@"
@@ -126,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 $@
@@ -139,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) $@"
@@ -233,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)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