summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2015-08-20 14:32:14 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-08-22 01:37:25 +0000
commit65d683a7e50f919669ff2e127c0e881642857fee (patch)
tree12ac12f33e0d500c7be5d67f62363570cf999899
parent0bb856d9e8276f8c36c777d3022a9323b773b432 (diff)
downloadchrome-ec-65d683a7e50f919669ff2e127c0e881642857fee.tar.gz
Cr50: Build external libs remotely, but put objects here
When building components from external libraries, instead of rsyncing the library into our build directory and building there, just build in the library directory and have it put its generated objects into our build tree. That will keep any build artifacts in the library directory from polluting our builds unexpectedly. BUG=chrome-os-partner:43025 BRANCH=none TEST=make buildall Change-Id: I2f07a2b49d1a0ba9fd9fff0822551486be820b70 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/295044 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--board/cr50/build.mk32
-rw-r--r--common/tpm_registers.c6
2 files changed, 24 insertions, 14 deletions
diff --git a/board/cr50/build.mk b/board/cr50/build.mk
index 5f5d93aa32..e20a432c66 100644
--- a/board/cr50/build.mk
+++ b/board/cr50/build.mk
@@ -10,20 +10,30 @@ CHIP_FAMILY:=cr50
CHIP_VARIANT ?= cr50_fpga
board-y=board.o
-LDFLAGS_EXTRA += -L$(out)/tpm2/build -ltpm2
# Need to generate a .hex file
all: hex
-ifeq ($(BOARD_MK_INCLUDED),)
-BOARD_MK_INCLUDED=1
+# This file is included twice by the Makefile, once to determine the CHIP info
+# and then again after defining all the CONFIG_ and HAS_TASK variables. We use
+# a guard so that recipe definitions and variable extensions only happen the
+# second time.
+ifeq ($(BOARD_MK_INCLUDED_ONCE),)
+BOARD_MK_INCLUDED_ONCE=1
+else
-$(out)/RO/ec.RO.elf: $(out)/tpm2/build/libtpm2.a
-$(out)/RW/ec.RW.elf: $(out)/tpm2/build/libtpm2.a
+# Build and link with an external library
+EXTLIB := $(realpath ../../third_party/tpm2)
-.PHONY: $(out)/tpm2/build/libtpm2.a
-$(out)/tpm2/build/libtpm2.a:
- rsync -a ../../third_party/tpm2 $(out)
- $(MAKE) ROOTDIR=$(realpath board/$(BOARD)/tpm2) EMBEDDED_MODE=1 \
- -C $(out)/tpm2
-endif
+CFLAGS += -I$(EXTLIB) -I$(realpath $(BDIR)/tpm2)
+LDFLAGS_EXTRA += -L$(out)/tpm2 -ltpm2
+
+$(out)/RO/ec.RO.elf: $(out)/tpm2/libtpm2.a
+$(out)/RW/ec.RW.elf: $(out)/tpm2/libtpm2.a
+
+# Force the external build each time, so it can look for changed sources.
+.PHONY: $(out)/tpm2/libtpm2.a
+$(out)/tpm2/libtpm2.a:
+ $(MAKE) obj=$(realpath $(out))/tpm2 EMBEDDED_MODE=1 -C $(EXTLIB)
+
+endif # BOARD_MK_INCLUDED_ONCE is nonempty
diff --git a/common/tpm_registers.c b/common/tpm_registers.c
index 543d9c8a29..5aba839764 100644
--- a/common/tpm_registers.c
+++ b/common/tpm_registers.c
@@ -17,9 +17,9 @@
#include "util.h"
/* TPM2 library includes. */
-#include "tpm2/ExecCommand_fp.h"
-#include "tpm2/Platform.h"
-#include "tpm2/_TPM_Init_fp.h"
+#include "ExecCommand_fp.h"
+#include "Platform.h"
+#include "_TPM_Init_fp.h"
#define CPRINTS(format, args...) cprints(CC_TPM, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_TPM, format, ## args)