Makefile: Make full use of src-to-obj macro

There were several spots in the tree where the path to a per class
object file was hardcoded. To make use of the src-to-obj macro for
this, it had to be moved before the inclusion of subdirs. Which is
fine, as it doesn't have dependencies beside $(obj).

Tested by verifying that the resulting coreboot.rom files didn't change
for all of Jenkins' abuild configurations.

Change-Id: I2eb1beeb8ae55872edfd95f750d7d5a1cee474c4
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/13180
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Nico Huber 2016-01-23 00:50:00 +01:00
parent 116d67323b
commit 81b09f4008
11 changed files with 57 additions and 64 deletions

View File

@ -180,6 +180,12 @@ add-special-class= \
$(eval $(1):=) \ $(eval $(1):=) \
$(eval special-classes+=$(1)) $(eval special-classes+=$(1))
# Converts one or more source file paths to their corresponding build/ paths.
# Only .c and .S get converted to .o, other files (like .ld) keep their name.
# $1 stage name
# $2 file path (list)
src-to-obj=$(foreach file,$(2),$(subst .$(1),,$(basename $(patsubst src/%,$(obj)/%,$(file)))).$(1)$(patsubst %.c,%.o,$(patsubst %.S,%.o,$(suffix $(file)))))
# Clean -y variables, include Makefile.inc # Clean -y variables, include Makefile.inc
# Add paths to files in X-y to X-srcs # Add paths to files in X-y to X-srcs
# Add subdirs-y to subdirs # Add subdirs-y to subdirs
@ -215,12 +221,6 @@ endif
# Eliminate duplicate mentions of source files in a class # Eliminate duplicate mentions of source files in a class
$(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs)))) $(foreach class,$(classes),$(eval $(class)-srcs:=$(sort $($(class)-srcs))))
# Converts one or more source file paths to their corresponding build/ paths.
# Only .c and .S get converted to .o, other files (like .ld) keep their name.
# $1 stage name
# $2 file path (list)
src-to-obj=$(foreach file,$(2),$(subst .$(1),,$(basename $(patsubst src/%,$(obj)/%,$(file)))).$(1)$(patsubst %.c,%.o,$(patsubst %.S,%.o,$(suffix $(file)))))
$(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class),$($(class)-srcs)))) $(foreach class,$(classes),$(eval $(class)-objs:=$(call src-to-obj,$(class),$($(class)-srcs))))
# Save all objs before processing them (for dependency inclusion) # Save all objs before processing them (for dependency inclusion)

View File

@ -45,7 +45,7 @@ endif # CONFIG_ARCH_ARM
ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARM),y) ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARM),y)
bootblock-y += id.S bootblock-y += id.S
$(obj)/arch/arm/id.bootblock.o: $(obj)/build.h $(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
bootblock-y += boot.c bootblock-y += boot.c
bootblock-y += stages.c bootblock-y += stages.c
@ -58,7 +58,7 @@ bootblock-y += clock.c
$(objcbfs)/bootblock.debug: $$(bootblock-objs) $(objcbfs)/bootblock.debug: $$(bootblock-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.bootblock.ld --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group
endif # CONFIG_ARCH_BOOTBLOCK_ARM endif # CONFIG_ARCH_BOOTBLOCK_ARM
@ -70,7 +70,7 @@ ifeq ($(CONFIG_ARCH_VERSTAGE_ARM),y)
$(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $$(verstage-objs) $(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $$(verstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_verstage) $(LDFLAGS_verstage) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld --whole-archive --start-group $(filter-out %.ld,$(verstage-objs)) $(objgenerated)/libverstage.a --end-group $(LD_verstage) $(LDFLAGS_verstage) -o $@ -L$(obj) -T $(call src-to-obj,verstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(verstage-objs)) $(objgenerated)/libverstage.a --end-group
verstage-y += boot.c verstage-y += boot.c
verstage-y += div0.c verstage-y += div0.c
@ -103,7 +103,7 @@ rmodules_arm-y += eabi_compat.c
$(objcbfs)/romstage.debug: $$(romstage-objs) $(objcbfs)/romstage.debug: $$(romstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.romstage.ld --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group
endif # CONFIG_ARCH_ROMSTAGE_ARM endif # CONFIG_ARCH_ROMSTAGE_ARM
@ -132,6 +132,6 @@ ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(objcbfs)/ramstage.debug: $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n" @printf " CC $(subst $(obj)/,,$(@))\n"
$(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.ramstage.ld --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group
endif # CONFIG_ARCH_RAMSTAGE_ARM endif # CONFIG_ARCH_RAMSTAGE_ARM

View File

@ -41,7 +41,7 @@ ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARM64),y)
bootblock-y += div0.c bootblock-y += div0.c
bootblock-y += id.S bootblock-y += id.S
$(obj)/arch/arm64/id.bootblock.o: $(obj)/build.h $(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
bootblock-y += boot.c bootblock-y += boot.c
bootblock-y += eabi_compat.c bootblock-y += eabi_compat.c
@ -55,7 +55,7 @@ bootblock-y += memmove.S
$(objcbfs)/bootblock.debug: $$(bootblock-objs) $(obj)/config.h $(objcbfs)/bootblock.debug: $$(bootblock-objs) $(obj)/config.h
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.bootblock.ld $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
endif # CONFIG_ARCH_BOOTBLOCK_ARM64 endif # CONFIG_ARCH_BOOTBLOCK_ARM64
@ -67,7 +67,7 @@ ifeq ($(CONFIG_ARCH_VERSTAGE_ARM64),y)
$(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $$(verstage-objs) $(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $$(verstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_verstage) $(LDFLAGS_verstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(verstage-objs)) $(objgenerated)/libverstage.a --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld $(LD_verstage) $(LDFLAGS_verstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(verstage-objs)) $(objgenerated)/libverstage.a --end-group -T $(call src-to-obj,verstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
verstage-y += boot.c verstage-y += boot.c
verstage-y += div0.c verstage-y += div0.c
@ -101,7 +101,7 @@ rmodules_arm64-y += eabi_compat.c
$(objcbfs)/romstage.debug: $$(romstage-objs) $(objcbfs)/romstage.debug: $$(romstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.romstage.ld $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
endif # CONFIG_ARCH_ROMSTAGE_ARM64 endif # CONFIG_ARCH_ROMSTAGE_ARM64
@ -132,7 +132,7 @@ ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(objcbfs)/ramstage.debug: $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n" @printf " CC $(subst $(obj)/,,$(@))\n"
$(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.ramstage.ld $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld)
# Build ARM Trusted Firmware (BL31) # Build ARM Trusted Firmware (BL31)

View File

@ -46,7 +46,7 @@ bootblock-S-ccopts += -undef
$(objcbfs)/bootblock.debug: $$(bootblock-objs) $(obj)/config.h $(objcbfs)/bootblock.debug: $$(bootblock-objs) $(obj)/config.h
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.bootblock.ld --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group
endif # CONFIG_ARCH_BOOTBLOCK_MIPS endif # CONFIG_ARCH_BOOTBLOCK_MIPS
@ -66,7 +66,7 @@ romstage-y += ../../lib/memset.c
$(objcbfs)/romstage.debug: $$(romstage-objs) $(objcbfs)/romstage.debug: $$(romstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.romstage.ld --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group
endif # CONFIG_ARCH_ROMSTAGE_MIPS endif # CONFIG_ARCH_ROMSTAGE_MIPS
@ -90,6 +90,6 @@ ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(objcbfs)/ramstage.debug: $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n" @printf " CC $(subst $(obj)/,,$(@))\n"
$(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.ramstage.ld --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group
endif # CONFIG_ARCH_RAMSTAGE_MIPS endif # CONFIG_ARCH_RAMSTAGE_MIPS

View File

@ -40,7 +40,7 @@ bootblock-y += \
$(objcbfs)/bootblock.debug: $$(bootblock-objs) $(objcbfs)/bootblock.debug: $$(bootblock-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \ $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \
-T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.bootblock.ld --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) \ -T $(call src-to-obj,bootblock,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) \
$(LIBGCC_FILE_NAME_bootblock) --end-group $(COMPILER_RT_bootblock) $(LIBGCC_FILE_NAME_bootblock) --end-group $(COMPILER_RT_bootblock)
endif endif
@ -66,7 +66,7 @@ romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
$(objcbfs)/romstage.debug: $$(romstage-objs) $(objcbfs)/romstage.debug: $$(romstage-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.romstage.ld --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group $(COMPILER_RT_romstage) $(LD_romstage) $(LDFLAGS_romstage) -o $@ -L$(obj) -T $(call src-to-obj,romstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group $(COMPILER_RT_romstage)
romstage-c-ccopts += $(riscv_flags) romstage-c-ccopts += $(riscv_flags)
romstage-S-ccopts += $(riscv_asm_flags) romstage-S-ccopts += $(riscv_asm_flags)
@ -105,7 +105,7 @@ ramstage-srcs += src/mainboard/$(MAINBOARDDIR)/mainboard.c
$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(objcbfs)/ramstage.debug: $$(ramstage-objs)
@printf " CC $(subst $(obj)/,,$(@))\n" @printf " CC $(subst $(obj)/,,$(@))\n"
$(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.ramstage.ld --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group $(COMPILER_RT_ramstage) $(LD_ramstage) $(LDFLAGS_ramstage) -o $@ -L$(obj) -T $(call src-to-obj,ramstage,src/mainboard/$(MAINBOARDDIR)/memlayout.ld) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group $(COMPILER_RT_ramstage)
ramstage-c-ccopts += $(riscv_flags) ramstage-c-ccopts += $(riscv_flags)
ramstage-S-ccopts += $(riscv_asm_flags) ramstage-S-ccopts += $(riscv_asm_flags)

View File

@ -75,7 +75,7 @@ define early_x86_assembly_entry_rule
# the right order. Make sure the auto generated assembly.inc is a proper # the right order. Make sure the auto generated assembly.inc is a proper
# dependency. # dependency.
$(1)-y += assembly_entry.S $(1)-y += assembly_entry.S
$$(obj)/arch/x86/assembly_entry.$(1).o: $(objgenerated)/assembly.inc $(call src-to-obj,$(1),$(dir)/assembly_entry.S): $(objgenerated)/assembly.inc
endef endef
define early_x86_stage define early_x86_stage
@ -88,7 +88,7 @@ $(1)-S-ccopts += -I.
$$(objcbfs)/$(1).debug: $$$$($(1)-libs) $$$$($(1)-objs) $$(objcbfs)/$(1).debug: $$$$($(1)-libs) $$$$($(1)-objs)
@printf " LINK $$(subst $$(obj)/,,$$(@))\n" @printf " LINK $$(subst $$(obj)/,,$$(@))\n"
$$(LD_$(1)) $$(LDFLAGS_$(1)) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1)) --whole-archive --start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) --no-whole-archive $$(COMPILER_RT_$(1)) --end-group -T $$(obj)/arch/x86/memlayout.$(1).ld --oformat $(2) $$(LD_$(1)) $$(LDFLAGS_$(1)) -o $$@ -L$$(obj) $$(COMPILER_RT_FLAGS_$(1)) --whole-archive --start-group $$(filter-out %.ld,$$($(1)-objs)) $$($(1)-libs) --no-whole-archive $$(COMPILER_RT_$(1)) --end-group -T $(call src-to-obj,$(1),$(dir)/memlayout.ld) --oformat $(2)
-LANG=C LC_ALL= $$(OBJCOPY_$(1)) --only-section .illegal_globals $$(@) $$(objcbfs)/$(1)_null.offenders >/dev/null 2>&1 -LANG=C LC_ALL= $$(OBJCOPY_$(1)) --only-section .illegal_globals $$(@) $$(objcbfs)/$(1)_null.offenders >/dev/null 2>&1
if [ -z "$$$$($$(NM_$(1)) $$(objcbfs)/$(1)_null.offenders 2>&1 | grep 'no symbols')" ];then \ if [ -z "$$$$($$(NM_$(1)) $$(objcbfs)/$(1)_null.offenders 2>&1 | grep 'no symbols')" ];then \
echo "Forbidden global variables in $(1):"; \ echo "Forbidden global variables in $(1):"; \
@ -111,7 +111,7 @@ bootblock-y += mmap_boot.c
# the right order. Make sure the auto generated bootblock.inc is a proper # the right order. Make sure the auto generated bootblock.inc is a proper
# dependency. Make the same true for the linker sript. # dependency. Make the same true for the linker sript.
bootblock-y += id.S bootblock-y += id.S
$(obj)/arch/x86/id.bootblock.o: $(obj)/build.h $(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
ifeq ($(CONFIG_C_ENVIRONMENT_BOOTBLOCK),y) ifeq ($(CONFIG_C_ENVIRONMENT_BOOTBLOCK),y)
@ -134,10 +134,10 @@ endif
bootblock-y += bootblock.S bootblock-y += bootblock.S
bootblock-y += walkcbfs.S bootblock-y += walkcbfs.S
$(obj)/arch/x86/bootblock.bootblock.o: $(objgenerated)/bootblock.inc $(call src-to-obj,bootblock,$(dir)/bootblock.S): $(objgenerated)/bootblock.inc
bootblock-y += bootblock.ld bootblock-y += bootblock.ld
$(obj)/arch/x86/bootblock.bootblock.ld: $(objgenerated)/bootblock.ld $(call src-to-obj,bootblock,$(dir)/bootblock.ld): $(objgenerated)/bootblock.ld
bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__ -D__BOOTBLOCK__ bootblock_romccflags := -mcpu=i386 -O2 -D__PRE_RAM__ -D__BOOTBLOCK__
ifeq ($(CONFIG_SSE),y) ifeq ($(CONFIG_SSE),y)
@ -148,7 +148,7 @@ endif
$(objgenerated)/empty: build-dirs $(objgenerated)/empty: build-dirs
touch $@ touch $@
$(objgenerated)/bootblock.ld: $$(filter-out $(obj)/arch/x86/bootblock.bootblock.ld, $$(filter %.ld,$$(bootblock-objs))) $(objgenerated)/empty $(objgenerated)/bootblock.ld: $$(filter-out $(call src-to-obj,bootblock,src/arch/x86/bootblock.ld), $$(filter %.ld,$$(bootblock-objs))) $(objgenerated)/empty
@printf " GEN $(subst $(obj)/,,$(@))\n" @printf " GEN $(subst $(obj)/,,$(@))\n"
cat $^ >> $@.tmp cat $^ >> $@.tmp
mv $@.tmp $@ mv $@.tmp $@
@ -160,12 +160,12 @@ $(objgenerated)/bootblock.inc: $(src)/arch/x86/$(subst ",,$(CONFIG_BOOTBLOCK_SOU
$< > $(objgenerated)/bootblock.inc.d $< > $(objgenerated)/bootblock.inc.d
$(ROMCC) -c -S $(bootblock_romccflags) -I. $(CPPFLAGS_bootblock) $< -o $@ $(ROMCC) -c -S $(bootblock_romccflags) -I. $(CPPFLAGS_bootblock) $< -o $@
# $(obj)/arch/x86/bootblock.bootblock.ld is part of $(bootblock-objs) # bootblock.ld is part of $(bootblock-objs)
$(objcbfs)/bootblock.debug: $$(bootblock-objs) $(objcbfs)/bootblock.debug: $$(bootblock-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n" @printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \ $(LD_bootblock) $(LDFLAGS_bootblock) -o $@ -L$(obj) \
$(filter-out %.ld,$(bootblock-objs)) \ $(filter-out %.ld,$(bootblock-objs)) \
-T $(obj)/arch/x86/bootblock.bootblock.ld -T $(call src-to-obj,bootblock,src/arch/x86/bootblock.ld)
endif # C_ENVIRONMENT_BOOTBLOCK endif # C_ENVIRONMENT_BOOTBLOCK
@ -328,9 +328,9 @@ endif
ramstage-y += memlayout.ld ramstage-y += memlayout.ld
$(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(obj)/arch/x86/memlayout.ramstage.ld $(objcbfs)/ramstage.debug: $(objgenerated)/ramstage.o $(call src-to-obj,ramstage,src/arch/x86/memlayout.ld)
@printf " CC $(subst $(obj)/,,$(@))\n" @printf " CC $(subst $(obj)/,,$(@))\n"
$(LD_ramstage) $(CPPFLAGS) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(obj)/arch/x86/memlayout.ramstage.ld $(LD_ramstage) $(CPPFLAGS) $(LDFLAGS_ramstage) -o $@ -L$(obj) $< -T $(call src-to-obj,ramstage,src/arch/x86/memlayout.ld)
$(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs) $(objgenerated)/ramstage.o: $$(ramstage-objs) $(COMPILER_RT_ramstage) $$(ramstage-libs)
@printf " CC $(subst $(obj)/,,$(@))\n" @printf " CC $(subst $(obj)/,,$(@))\n"

View File

@ -22,7 +22,7 @@ $(eval $(call create_class_compiler,omap-header,arm))
real-target: $(obj)/MLO real-target: $(obj)/MLO
header_ld = $(obj)/cpu/ti/am335x/header.omap-header.ld header_ld := $(call src-to-obj,omap-header,$(dir)/header.ld)
get_header_size= \ get_header_size= \
$(eval omap_header_info=$(shell $(CBFSTOOL) $(1) print | grep $(2))) \ $(eval omap_header_info=$(shell $(CBFSTOOL) $(1) print | grep $(2))) \

View File

@ -16,7 +16,7 @@ ramstage-srcs += $(SIPI_BIN).manual
endif endif
rmodules_$(ARCH-ramstage-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S rmodules_$(ARCH-ramstage-y)-$(CONFIG_PARALLEL_MP) += sipi_vector.S
$(SIPI_DOTO): $(dir $(SIPI_ELF))sipi_vector.rmodules_$(ARCH-ramstage-y).o $(SIPI_DOTO): $(call src-to-obj,rmodules_$(ARCH-ramstage-y),src/cpu/x86/sipi_vector.S)
$(CC_rmodules_$(ARCH-ramstage-y)) $(CFLAGS_rmodules_$(ARCH-ramstage-y)) -nostdlib -r -o $@ $^ $(CC_rmodules_$(ARCH-ramstage-y)) $(CFLAGS_rmodules_$(ARCH-ramstage-y)) -nostdlib -r -o $@ $^
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y) ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
@ -28,6 +28,6 @@ endif
$(SIPI_BIN): $(SIPI_RMOD) $(SIPI_BIN): $(SIPI_RMOD)
$(OBJCOPY_ramstage) -O binary $< $@ $(OBJCOPY_ramstage) -O binary $< $@
$(SIPI_BIN).ramstage.manual: $(SIPI_BIN) $(call src-to-obj,ramstage,$(SIPI_BIN).manual): $(SIPI_BIN)
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n" @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
cd $(dir $@); $(OBJCOPY_rmodules_$(ARCH-ramstage-y)) -I binary $(notdir $<) $(target-objcopy) $(notdir $@) cd $(dir $@); $(OBJCOPY_rmodules_$(ARCH-ramstage-y)) -I binary $(notdir $<) $(target-objcopy) $(notdir $@)

View File

@ -32,7 +32,7 @@ $(obj)/cpu/x86/smm/smm.o: $$(smm-objs) $(COMPILER_RT_smm)
# change to the target path because objcopy will use the path name in its # change to the target path because objcopy will use the path name in its
# ELF symbol names. # ELF symbol names.
$(obj)/cpu/x86/smm/smm.ramstage.manual: $(obj)/cpu/x86/smm/smm $(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smm.manual): $(obj)/cpu/x86/smm/smm
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n" @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
cd $(dir $@); $(OBJCOPY_smm) -I binary $(notdir $<) $(target-objcopy) $(notdir $@) cd $(dir $@); $(OBJCOPY_smm) -I binary $(notdir $<) $(target-objcopy) $(notdir $@)
@ -62,7 +62,7 @@ endif
$(obj)/cpu/x86/smm/smmstub: $(obj)/cpu/x86/smm/smmstub.elf.rmod $(obj)/cpu/x86/smm/smmstub: $(obj)/cpu/x86/smm/smmstub.elf.rmod
$(OBJCOPY_smmstub) -O binary $< $@ $(OBJCOPY_smmstub) -O binary $< $@
$(obj)/cpu/x86/smm/smmstub.ramstage.manual: $(obj)/cpu/x86/smm/smmstub $(call src-to-obj,ramstage,$(obj)/cpu/x86/smm/smmstub.manual): $(obj)/cpu/x86/smm/smmstub
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n" @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
cd $(dir $@); $(OBJCOPY_smmstub) -I binary $(notdir $<) $(target-objcopy) $(notdir $@) cd $(dir $@); $(OBJCOPY_smmstub) -I binary $(notdir $<) $(target-objcopy) $(notdir $@)

View File

@ -167,11 +167,11 @@ ramstage-y += version.c
smm-y += version.c smm-y += version.c
verstage-y += version.c verstage-y += version.c
$(obj)/lib/version.bootblock.o : $(obj)/build.h $(call src-to-obj,bootblock,$(dir)/version.c) : $(obj)/build.h
$(obj)/lib/version.romstage.o : $(obj)/build.h $(call src-to-obj,romstage,$(dir)/version.c) : $(obj)/build.h
$(obj)/lib/version.ramstage.o : $(obj)/build.h $(call src-to-obj,ramstage,$(dir)/version.c) : $(obj)/build.h
$(obj)/lib/version.smm.o : $(obj)/build.h $(call src-to-obj,smm,$(dir)/version.c) : $(obj)/build.h
$(obj)/lib/version.verstage.o : $(obj)/build.h $(call src-to-obj,verstage,$(dir)/version.c) : $(obj)/build.h
romstage-y += bootmode.c romstage-y += bootmode.c
ramstage-y += bootmode.c ramstage-y += bootmode.c
@ -202,8 +202,8 @@ RMODULE_LDFLAGS := -z defs -Bsymbolic
# It will create the necessary Make rules to create a rmodule. The resulting # It will create the necessary Make rules to create a rmodule. The resulting
# rmdoule is named $(1).rmod # rmdoule is named $(1).rmod
define rmodule_link define rmodule_link
$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(obj)/lib/rmodule.rmodules_$(4).ld | $$(RMODTOOL) $(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) | $$(RMODTOOL)
$$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(obj)/lib/rmodule.rmodules_$(4).ld --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group $$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) -T $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group
$$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map
endef endef

View File

@ -81,22 +81,21 @@ CC_x86_64 := $(CC_x86_64) $(AGESA_INC) $(AGESA_CFLAGS)
####################################################################### #######################################################################
define create_agesa_cp_template define create_agesa_cp_template
# $1 AGESA source file # $1 AGESA source file
# $2 AGESA copy-to location
$(agesa_src_path)/$(notdir $2): $2 $(agesa_src_path) $(agesa_src_path)/$(notdir $1): $1
@printf " AGESA Copying $$(notdir $2) => $$(@D)\n" @printf " AGESA Copying $$(notdir $1) => $$(@D)\n"
if [ ! -r $(agesa_src_path)/$(notdir $2) ]; then \ if [ ! -r $(agesa_src_path)/$(notdir $1) ]; then \
cp -f $2 $$(@D); \ cp -f $1 $$(@D); \
fi fi
$(agesa_obj_path)/$1.libagesa.o: $(agesa_src_path)/$(notdir $2) $(obj)/config.h $(src)/include/kconfig.h $(agesa_obj_path) $(call src-to-obj,libagesa,$1): $(agesa_src_path)/$(notdir $1) $(obj)/config.h $(src)/include/kconfig.h
@printf " CC $(subst $(agesa_obj_path)/,,$$(@))\n" @printf " CC $$(subst $(obj)/,,$$(@))\n"
$(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \ $(CC_libagesa) -c -MMD $(CFLAGS_libagesa) $(AGESA_CFLAGS) \
$(AGESA_INC) \ $(AGESA_INC) \
-include $(obj)/config.h -include $(src)/include/kconfig.h \ -include $(obj)/config.h -include $(src)/include/kconfig.h \
-o $$@ \ -o $$@ \
$(agesa_src_path)/$(notdir $2) $(agesa_src_path)/$(notdir $1)
endef endef
@ -120,21 +119,15 @@ $(eval $(call create_class_compiler,libagesa,x86_64))
endif endif
agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file))))) agesa_src_files := $(strip $(sort $(foreach file,$(strip $(agesa_raw_files)),$(call strip_quotes,$(file)))))
agesa_obj_path := $(strip $(obj)/vendorcode/amd)
agesa_src_path := $(strip $(obj)/agesa) agesa_src_path := $(strip $(obj)/agesa)
agesa_src_copies := $(strip $(foreach file,$(agesa_src_files),$(agesa_obj_path)/$(notdir $(file)))) agesa_dirs := $(sort $(abspath $(dir $(call src-to-obj,libagesa,$(agesa_src_files)))))
agesa_obj_copies := $(strip $(agesa_src_copies:.c=.libagesa.o))
$(agesa_src_path): additional-dirs += $(agesa_src_path) $(agesa_dirs)
mkdir -p $@
$(agesa_obj_path): $(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(file))))
mkdir -p $@
$(foreach file,$(strip $(agesa_src_files)),$(eval $(call create_agesa_cp_template,$(basename $(notdir $(file))),$(file)))) $(obj)/agesa/libagesa.a: $(call src-to-obj,libagesa,$(agesa_src_files))
@printf " AGESA $(subst $(obj)/,,$(@))\n"
$(obj)/agesa/libagesa.a: $(agesa_obj_copies)
@printf " AGESA $(subst $(agesa_obj_path)/,,$(@))\n"
ar rcs $@ $+ ar rcs $@ $+
romstage-libs += $(obj)/agesa/libagesa.a romstage-libs += $(obj)/agesa/libagesa.a