From d69839bdfdea5d67bbbed12f29cdac52e9036875 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Fri, 3 Apr 2015 10:32:17 +0200 Subject: build system: use full (in-tree) paths So far we assumed that all files in *-srcs are below src/ which wasn't really true actually and will be less true with future changes. Fix up crt0.S handling on x86, which is covered by default rules due to this change. This is inspired by the commit listed below, but rewritten to match upstream, and split in smaller pieces to keep intent clear. Change-Id: Icae563c2d545b1aea809406e73faf3b417796a1b Signed-off-by: Patrick Georgi Based-On-Change-Id: I50af7dacf616e0f8ff4c43f4acc679089ad7022b Based-On-Signed-off-by: Julius Werner Based-On-Reviewed-on: https://chromium-review.googlesource.com/219170 Reviewed-on: http://review.coreboot.org/9288 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- Makefile | 4 ++-- Makefile.inc | 2 +- src/arch/x86/Makefile.inc | 13 ++++--------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index f6f9a605ad49..3ad19dffedab 100644 --- a/Makefile +++ b/Makefile @@ -230,7 +230,7 @@ define create_cc_template # $4 additional dependencies ifn$(EMPTY)def $(1)-objs_$(2)_template de$(EMPTY)fine $(1)-objs_$(2)_template -$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4) +$$(call src-to-obj,$1,$$(1).$2): $$(1).$2 $(obj)/config.h $(4) @printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n" $(CC_$(1)) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -MT $$$$(@) $(3) -c -o $$$$@ $$$$< en$(EMPTY)def @@ -244,7 +244,7 @@ $(foreach class,$(classes), \ $(if $(generic-objs_$(type)_template_gen),$(eval $(call generic-objs_$(type)_template_gen,$(class))),\ $(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps)))))) -foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file)))))) +foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(basename $(file))))) $(eval $(foreach class,$(classes),$(call foreach-src,$(class)))) DEPENDENCIES = $(addsuffix .d,$(basename $(allobjs))) diff --git a/Makefile.inc b/Makefile.inc index d18acfccadf2..0e3457768353 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -147,7 +147,7 @@ endef ####################################################################### # Add handler to compile ACPI's ASL define ramstage-objs_asl_template -$(obj)/$(1).ramstage.asl: src/$(1).asl $(obj)/config.h +$$(call src-to-obj,ramstage,$(1).asl): $(1).asl $(obj)/config.h @printf " IASL $$(subst $(top)/,,$$(@))\n" $(CC_ramstage) -x assembler-with-cpp -E -MMD -MT $$(@) -D__ACPI__ -P -include $(src)/include/kconfig.h -I$(obj) -I$(src) -I$(src)/include -I$(src)/arch/$(ARCHDIR-$(ARCH-ramstage-y))/include -I$(src)/mainboard/$(MAINBOARDDIR) $$< -o $$@ cd $$(dir $$@); $(IASL) -p $$(notdir $$@) -tc $$(notdir $$@) diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index fe92a22723cc..e2170f5d40b2 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -233,17 +233,12 @@ $(objcbfs)/base_xip.txt: $(obj)/coreboot.pre1 $(objcbfs)/romstage_null.bin || { echo "The romstage is larger than XIP size. Please expand the CONFIG_XIP_ROM_SIZE" ; exit 1; } mv $@.tmp $@ -$(objgenerated)/crt0.romstage.S: $$(crt0s) +$(objgenerated)/crt0.S: $$(crt0s) @printf " GEN $(subst $(obj)/,,$(@))\n" - printf '$(foreach crt0,$(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@ + printf '$(foreach crt0,$(crt0s),#include "$(crt0)"\n)' > $@ -$(objgenerated)/crt0.romstage.o: $(objgenerated)/crt0.S - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_romstage) $(CFLAGS_x86_32) $(DISASSEMBLY) -c -o $@ $< > $(basename $@).disasm - -$(objgenerated)/crt0.S: $(objgenerated)/crt0.romstage.S $(obj)/config.h $(obj)/build.h - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC_romstage) $(CPPFLAGS_romstage) -MMD -x assembler-with-cpp -E -I$(src)/include -I$(src)/arch/x86/include -I$(obj) -include $(obj)/config.h -include $(obj)/build.h -I. -I$(src) $< -o $@ +# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428 +romstage-S-ccopts += -I. -g0 endif # CONFIG_ARCH_ROMSTAGE_X86_32 -- cgit v1.2.3