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 <pgeorgi@chromium.org> Based-On-Change-Id: I50af7dacf616e0f8ff4c43f4acc679089ad7022b Based-On-Signed-off-by: Julius Werner <jwerner@chromium.org> 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 <adurbin@google.com>
This commit is contained in:
parent
08884e39cd
commit
d69839bdfd
4
Makefile
4
Makefile
|
@ -230,7 +230,7 @@ define create_cc_template
|
||||||
# $4 additional dependencies
|
# $4 additional dependencies
|
||||||
ifn$(EMPTY)def $(1)-objs_$(2)_template
|
ifn$(EMPTY)def $(1)-objs_$(2)_template
|
||||||
de$(EMPTY)fine $(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"
|
@printf " CC $$$$(subst $$$$(obj)/,,$$$$(@))\n"
|
||||||
$(CC_$(1)) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -MT $$$$(@) $(3) -c -o $$$$@ $$$$<
|
$(CC_$(1)) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -MT $$$$(@) $(3) -c -o $$$$@ $$$$<
|
||||||
en$(EMPTY)def
|
en$(EMPTY)def
|
||||||
|
@ -244,7 +244,7 @@ $(foreach class,$(classes), \
|
||||||
$(if $(generic-objs_$(type)_template_gen),$(eval $(call generic-objs_$(type)_template_gen,$(class))),\
|
$(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))))))
|
$(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))))
|
$(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
|
||||||
|
|
||||||
DEPENDENCIES = $(addsuffix .d,$(basename $(allobjs)))
|
DEPENDENCIES = $(addsuffix .d,$(basename $(allobjs)))
|
||||||
|
|
|
@ -147,7 +147,7 @@ endef
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Add handler to compile ACPI's ASL
|
# Add handler to compile ACPI's ASL
|
||||||
define ramstage-objs_asl_template
|
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"
|
@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 $$@
|
$(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 $$@)
|
cd $$(dir $$@); $(IASL) -p $$(notdir $$@) -tc $$(notdir $$@)
|
||||||
|
|
|
@ -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; }
|
|| { echo "The romstage is larger than XIP size. Please expand the CONFIG_XIP_ROM_SIZE" ; exit 1; }
|
||||||
mv $@.tmp $@
|
mv $@.tmp $@
|
||||||
|
|
||||||
$(objgenerated)/crt0.romstage.S: $$(crt0s)
|
$(objgenerated)/crt0.S: $$(crt0s)
|
||||||
@printf " GEN $(subst $(obj)/,,$(@))\n"
|
@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
|
# Compiling crt0 with -g seems to trigger https://sourceware.org/bugzilla/show_bug.cgi?id=6428
|
||||||
@printf " CC $(subst $(obj)/,,$(@))\n"
|
romstage-S-ccopts += -I. -g0
|
||||||
$(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 $@
|
|
||||||
|
|
||||||
endif # CONFIG_ARCH_ROMSTAGE_X86_32
|
endif # CONFIG_ARCH_ROMSTAGE_X86_32
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue