Various changes to the buildsystem:
- Single instance of the CC build rule in Makefile, instantiated as necessary - Remove manual static.o and option_table.o rules, they're now covered by those instances of the CC build rule - Normalize object file paths, so it can be $(obj)/option_table.o instead of $(obj)/arch/i386/../../option_table.o now - Add -pipe to compiler flags. It might be detrimental on rare scenarios (building with extremly high disk bandwidth, eg. RAM disk), but it significantly helps on win32 (which seems to cache less aggressively than most unix-alikes) - Silence stderr on hostname and domainname invocations (cosmetic fix for cygwin) - Test for -Wa,--divide functionality of the target compiler (taken from abuild). It might be possible to remove most patches in crossgcc with that. - Report build of failover.inc and romstage.inc Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de Acked-by: Peter Stuge <peter@stuge.se> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5224 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
1b2831c63c
commit
c5f773d7f4
96
Makefile
96
Makefile
|
@ -142,14 +142,6 @@ $(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devi
|
||||||
mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
|
mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
|
||||||
(cd $(obj)/mainboard/$(MAINBOARDDIR) ; PYTHONPATH=$(top)/util/sconfig export PYTHONPATH; python config.py $(MAINBOARDDIR) $(top) $(obj)/mainboard/$(MAINBOARDDIR))
|
(cd $(obj)/mainboard/$(MAINBOARDDIR) ; PYTHONPATH=$(top)/util/sconfig export PYTHONPATH; python config.py $(MAINBOARDDIR) $(top) $(obj)/mainboard/$(MAINBOARDDIR))
|
||||||
|
|
||||||
$(obj)/mainboard/$(MAINBOARDDIR)/static.o: $(obj)/mainboard/$(MAINBOARDDIR)/static.c
|
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
$(obj)/arch/i386/../../option_table.o: $(obj)/arch/i386/../../option_table.c
|
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
objs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.o
|
objs:=$(obj)/mainboard/$(MAINBOARDDIR)/static.o
|
||||||
initobjs:=
|
initobjs:=
|
||||||
drivers:=
|
drivers:=
|
||||||
|
@ -168,11 +160,11 @@ includemakefiles= \
|
||||||
$(if $(strip $(3)), \
|
$(if $(strip $(3)), \
|
||||||
$(foreach type,$(2), \
|
$(foreach type,$(2), \
|
||||||
$(eval $(type)s+= \
|
$(eval $(type)s+= \
|
||||||
$$(patsubst util/%, \
|
$$(abspath $$(patsubst util/%, \
|
||||||
$(obj)/util/%, \
|
$(obj)/util/%, \
|
||||||
$$(patsubst src/%, \
|
$$(patsubst src/%, \
|
||||||
$(obj)/%, \
|
$(obj)/%, \
|
||||||
$$(addprefix $(dir $(1)),$$($(type)-y))))))) \
|
$$(addprefix $(dir $(1)),$$($(type)-y)))))))) \
|
||||||
$(eval subdirs+=$$(subst $(PWD)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
|
$(eval subdirs+=$$(subst $(PWD)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
|
||||||
|
|
||||||
# For each path in $(subdirs) call includemakefiles, passing $(1) as $(3)
|
# For each path in $(subdirs) call includemakefiles, passing $(1) as $(3)
|
||||||
|
@ -213,61 +205,35 @@ $(obj)/$(1)%.o: src/$(1)%.asl
|
||||||
$(CC) $$(CFLAGS) $$(if $$(subst dsdt,,$$(basename $$(notdir $$@))), -DAmlCode=AmlCode_$$(basename $$(notdir $$@))) -c -o $$@ $$(basename $$@).c
|
$(CC) $$(CFLAGS) $$(if $$(subst dsdt,,$$(basename $$(notdir $$@))), -DAmlCode=AmlCode_$$(basename $$(notdir $$@))) -c -o $$@ $$(basename $$@).c
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define objs_c_template
|
# macro to define template macros that are used by use_template macro
|
||||||
$(obj)/$(1)%.o: $(1)%.c $(obj)/config.h
|
define create_cc_template
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
# $1 obj class (objs, initobjs, ...)
|
||||||
$(CC) $$(CFLAGS) -c -o $$@ $$<
|
# $2 source suffix (c, S)
|
||||||
|
# $3 .o infix ("" ".initobj", ...)
|
||||||
|
# $4 additional compiler flags
|
||||||
|
de$(EMPTY)fine $(1)_$(2)_template
|
||||||
|
$(obj)/$$(1)%$(3).o: $$(1)%.$(2) $(obj)/config.h
|
||||||
|
printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
|
||||||
|
$(CC) $(4) $$$$(CFLAGS) -c -o $$$$@ $$$$<
|
||||||
|
|
||||||
$(obj)/$(1)%.o: src/$(1)%.c $(obj)/config.h
|
$(obj)/$$(1)%$(3).o: src/$$(1)%.$(2) $(obj)/config.h
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
|
||||||
$(CC) $$(CFLAGS) -c -o $$@ $$<
|
$(CC) $(4) $$$$(CFLAGS) -c -o $$$$@ $$$$<
|
||||||
|
|
||||||
|
$(obj)/$$(1)%$(3).o: obj/$$(1)%.$(2) $(obj)/config.h
|
||||||
|
printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
|
||||||
|
$(CC) $(4) $$$$(CFLAGS) -c -o $$$$@ $$$$<
|
||||||
|
en$(EMPTY)def
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define objs_S_template
|
$(eval $(call create_cc_template,objs,c))
|
||||||
$(obj)/$(1)%.o: $(1)%.S $(obj)/config.h
|
$(eval $(call create_cc_template,objs,S,,-DASSEMBLY))
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
$(eval $(call create_cc_template,initobjs,c,.initobj))
|
||||||
$(CC) -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
|
$(eval $(call create_cc_template,initobjs,S,.initobj,-DASSEMBLY))
|
||||||
|
$(eval $(call create_cc_template,drivers,c,.driver))
|
||||||
$(obj)/$(1)%.o: src/$(1)%.S $(obj)/config.h
|
$(eval $(call create_cc_template,drivers,S,.driver,-DASSEMBLY))
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
$(eval $(call create_cc_template,smmobjs,c,.smmobj))
|
||||||
$(CC) -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
|
$(eval $(call create_cc_template,smmobjs,S,.smmobj))
|
||||||
endef
|
|
||||||
|
|
||||||
define initobjs_c_template
|
|
||||||
$(obj)/$(1)%.initobj.o: src/$(1)%.c $(obj)/config.h
|
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
|
||||||
$(CC) $$(CFLAGS) -c -o $$@ $$<
|
|
||||||
endef
|
|
||||||
|
|
||||||
define initobjs_S_template
|
|
||||||
$(obj)/$(1)%.initobj.o: src/$(1)%.S $(obj)/config.h
|
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
|
||||||
$(CC) -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
|
|
||||||
endef
|
|
||||||
|
|
||||||
define drivers_c_template
|
|
||||||
$(obj)/$(1)%.driver.o: src/$(1)%.c $(obj)/config.h
|
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
|
||||||
$(CC) $$(CFLAGS) -c -o $$@ $$<
|
|
||||||
endef
|
|
||||||
|
|
||||||
define drivers_S_template
|
|
||||||
$(obj)/$(1)%.driver.o: src/$(1)%.S
|
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
|
||||||
$(CC) -DASSEMBLY $$(CFLAGS) -c -o $$@ $$<
|
|
||||||
endef
|
|
||||||
|
|
||||||
define smmobjs_c_template
|
|
||||||
$(obj)/$(1)%.smmobj.o: src/$(1)%.c
|
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
|
||||||
$(CC) $$(CFLAGS) -c -o $$@ $$<
|
|
||||||
endef
|
|
||||||
|
|
||||||
define smmobjs_S_template
|
|
||||||
$(obj)/$(1)%.smmobj.o: src/$(1)%.S
|
|
||||||
@printf " CC $$(subst $$(obj)/,,$$(@))\n"
|
|
||||||
$(CC) $$(CFLAGS) -c -o $$@ $$<
|
|
||||||
endef
|
|
||||||
|
|
||||||
usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d)))))
|
usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d)))))
|
||||||
usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d)))))
|
usetemplate=$(foreach d,$(sort $(dir $($(1)))),$(eval $(call $(1)_$(2)_template,$(subst $(obj)/,,$(d)))))
|
||||||
|
@ -298,7 +264,7 @@ INCLUDES := -I$(top)/src -I$(top)/src/include -I$(obj) -I$(top)/src/arch/$(ARCHD
|
||||||
INCLUDES += -I$(top)/util/x86emu/include
|
INCLUDES += -I$(top)/util/x86emu/include
|
||||||
INCLUDES += -include $(obj)/config.h
|
INCLUDES += -include $(obj)/config.h
|
||||||
|
|
||||||
CFLAGS = $(INCLUDES) -Os -nostdinc
|
CFLAGS = $(INCLUDES) -Os -nostdinc -pipe
|
||||||
CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
|
CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
|
||||||
CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
|
CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
|
||||||
CFLAGS += -Wstrict-aliasing -Wshadow
|
CFLAGS += -Wstrict-aliasing -Wshadow
|
||||||
|
@ -337,8 +303,8 @@ $(obj)/build.h: .xcompile
|
||||||
printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.ht
|
printf "#define COREBOOT_LINKER \"$(shell LANG= $(LD) --version | head -n1)\"\n" >> $(obj)/build.ht
|
||||||
printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.ht
|
printf "#define COREBOOT_COMPILE_TIME \"`LANG= date +%T`\"\n" >> $(obj)/build.ht
|
||||||
printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
|
printf "#define COREBOOT_COMPILE_BY \"$(subst \,@,$(shell PATH=$$PATH:/usr/ucb whoami))\"\n" >> $(obj)/build.ht
|
||||||
printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s)\"\n" >> $(obj)/build.ht
|
printf "#define COREBOOT_COMPILE_HOST \"$(shell hostname -s 2>/dev/null)\"\n" >> $(obj)/build.ht
|
||||||
printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname)\"\n" >> $(obj)/build.ht
|
printf "#define COREBOOT_COMPILE_DOMAIN \"$(shell test `uname -s` = "Linux" && dnsdomainname || domainname 2>/dev/null)\"\n" >> $(obj)/build.ht
|
||||||
printf "#endif\n" >> $(obj)/build.ht
|
printf "#endif\n" >> $(obj)/build.ht
|
||||||
mv $(obj)/build.ht $(obj)/build.h
|
mv $(obj)/build.ht $(obj)/build.h
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ endif
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# i386 specific tools
|
# i386 specific tools
|
||||||
|
|
||||||
$(obj)/option_table.h $(obj)/option_table.c $(obj)/arch/i386/../../option_table.c: $(obj)/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
|
$(obj)/option_table.h $(obj)/option_table.c: $(obj)/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
|
||||||
@printf " OPTION $(subst $(obj)/,,$(@))\n"
|
@printf " OPTION $(subst $(obj)/,,$(@))\n"
|
||||||
$(obj)/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --header $(obj)/option_table.h --option $(obj)/option_table.c
|
$(obj)/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --header $(obj)/option_table.h --option $(obj)/option_table.c
|
||||||
|
|
||||||
|
@ -183,9 +183,11 @@ ifeq ($(CONFIG_ROMCC),y)
|
||||||
ROMCCFLAGS ?= -mcpu=p2 -O2
|
ROMCCFLAGS ?= -mcpu=p2 -O2
|
||||||
|
|
||||||
$(obj)/mainboard/$(MAINBOARDDIR)/failover.inc: $(obj)/romcc $(src)/arch/i386/lib/failover.c
|
$(obj)/mainboard/$(MAINBOARDDIR)/failover.inc: $(obj)/romcc $(src)/arch/i386/lib/failover.c
|
||||||
|
printf " ROMCC failover.inc\n"
|
||||||
$(obj)/romcc $(ROMCCFLAGS) --label-prefix=failover $(INCLUDES) $(src)/arch/i386/lib/failover.c -o $@
|
$(obj)/romcc $(ROMCCFLAGS) --label-prefix=failover $(INCLUDES) $(src)/arch/i386/lib/failover.c -o $@
|
||||||
|
|
||||||
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(obj)/romcc $(OPTION_TABLE_H) $(obj)/build.h
|
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(obj)/romcc $(OPTION_TABLE_H) $(obj)/build.h
|
||||||
|
printf " ROMCC romstage.inc\n"
|
||||||
$(obj)/romcc $(ROMCCFLAGS) -include $(obj)/build.h $(INCLUDES) $< -o $@
|
$(obj)/romcc $(ROMCCFLAGS) -include $(obj)/build.h $(INCLUDES) $< -o $@
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -194,6 +196,7 @@ $(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o: $(src)/mainboard/$(MAINBOARDDIR)
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -I$(src) -I. -c -S $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c -o $@
|
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -I$(src) -I. -c -S $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c -o $@
|
||||||
|
|
||||||
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h
|
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h
|
||||||
|
printf " GEN romstage.inc\n"
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -include $(obj)/build.h -I$(src) -I. -c -S $< -o $@.tmp1
|
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -include $(obj)/build.h -I$(src) -I. -c -S $< -o $@.tmp1
|
||||||
sed -e 's/\.rodata/.rom.data/g' -e 's/\.text/.section .rom.text/g' $@.tmp1 > $@.tmp
|
sed -e 's/\.rodata/.rom.data/g' -e 's/\.text/.section .rom.text/g' $@.tmp1 > $@.tmp
|
||||||
mv $@.tmp $@
|
mv $@.tmp $@
|
||||||
|
|
|
@ -75,6 +75,7 @@ if [ "$GCCPREFIX" = "invalid" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CC="${GCCPREFIX}gcc"
|
CC="${GCCPREFIX}gcc"
|
||||||
|
testcc "$CC" "$CFLAGS-Wa,--divide " && CFLAGS="$CFLAGS-Wa,--divide "
|
||||||
testcc "$CC" "$CFLAGS-fno-stack-protector " && CFLAGS="$CFLAGS-fno-stack-protector "
|
testcc "$CC" "$CFLAGS-fno-stack-protector " && CFLAGS="$CFLAGS-fno-stack-protector "
|
||||||
testcc "$CC" "$CFLAGS-Wl,--build-id=none " && CFLAGS="$CFLAGS-Wl,--build-id=none "
|
testcc "$CC" "$CFLAGS-Wl,--build-id=none " && CFLAGS="$CFLAGS-Wl,--build-id=none "
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue