From 0beddb5e237f23c59399b1c93f25230a6eab3372 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Mon, 9 Mar 2020 10:58:37 +0800 Subject: cbfstool: Build vboot library Currently cbfstool cherry-picks a few files from vboot and hopes these files will work standalone without any dependencies. This is pretty brittle (for example, CL:2084062 will break it), and could be improved by building the whole vboot library and then linking against it. Therefore, this patch creates a new target $(VBOOT_HOSTLIB) and includes it as a dependency for cbfstool and ifittool. To prevent building the vboot lib twice (one for cbfstool and the other for futility) when building coreboot tools together, add the variable 'VBOOT_BUILD' in Makefile to define a shared build path among different tools so that vboot files don't need to be recompiled. Also ignore *.o.d and *.a for vboot library. BRANCH=none BUG=none TEST=make -C util/cbfstool TEST=make -C util/futility TEST=Run 'make tools' and make sure common files such as 2sha1.c are compiled only once TEST=emerge-nami coreboot-utils Change-Id: Ifc826896d895f53d69ea559a88f75672c2ec3146 Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/39390 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- util/futility/Makefile | 1 + util/futility/Makefile.inc | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'util/futility') diff --git a/util/futility/Makefile b/util/futility/Makefile index cce5da6e9d..2eaab3eaa5 100644 --- a/util/futility/Makefile +++ b/util/futility/Makefile @@ -4,6 +4,7 @@ RM ?= rm HOSTCC ?= $(CC) VBOOT_SOURCE ?= $(top)/3rdparty/vboot +VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib) .PHONY: all all: $(objutil)/futility/futility diff --git a/util/futility/Makefile.inc b/util/futility/Makefile.inc index 06e724c15f..ee4ad051e2 100644 --- a/util/futility/Makefile.inc +++ b/util/futility/Makefile.inc @@ -1,14 +1,17 @@ additional-dirs += $(objutil)/futility -$(objutil)/futility/build/futility/futility: +VBOOT_FUTILITY = $(VBOOT_HOST_BUILD)/futility/futility + +$(VBOOT_FUTILITY): @printf " MAKE $(subst $(objutil)/,,$(@))\n" unset CFLAGS LDFLAGS; $(MAKE) -C $(VBOOT_SOURCE) \ - BUILD=$(abspath $@/../..) \ + BUILD=$(VBOOT_HOST_BUILD) \ CC="$(HOSTCC)" \ $(if $(HOSTPKGCONFIG), PKG_CONFIG="$(HOSTPKGCONFIG)") \ V=$(V) \ - $(abspath $@) + $@ -$(objutil)/futility/futility: $(objutil)/futility/build/futility/futility +$(objutil)/futility/futility: $(VBOOT_FUTILITY) + mkdir -p $(dir $@) cp $< $@.tmp mv $@.tmp $@ -- cgit v1.2.3