Allow caller to specify build output directory
This changes the Makefile to set the BUILD directory only if the caller
does not specify it.
This allows U-Boot to build vboot reference and put the resulting binaries
into its own output directory.
BUG=chromium-os:16808
TEST=emerge vboot_reference-firmware for tegra2-seaboard, x86-mario
Change-Id: I6b0bba47e397f86a130e67c4e18fbcf5fffdfd68
Reviewed-on: https://gerrit.chromium.org/gerrit/11638
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Ready: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
diff --git a/Makefile b/Makefile
index 19b91d5..d8ee839 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,12 @@
export FIRMWARE_ARCH
export MOCK_TPM
+# This Makefile normally builds in a 'build' subdir, but use
+#
+# make BUILD=<dir>
+#
+# to put the output somewhere else
+
#
# Provide default CC and CFLAGS for firmware builds; if you have any -D flags,
# please add them after this point (e.g., -DVBOOT_DEBUG).
@@ -74,7 +80,7 @@
export INCLUDES = -I$(FWDIR)/include -I$(FWDIR)/arch/$(FIRMWARE_ARCH)/include
endif
-export BUILD = ${TOP}/build
+export BUILD ?= ${TOP}/build
export FWLIB = ${BUILD}/vboot_fw.a
export HOSTLIB = ${BUILD}/vboot_host.a
@@ -93,7 +99,7 @@
mkdir -p $$newdir; \
fi; \
done; \
- [ -z "$(FIRMWARE_ARCH)" ] && make -C utility update_tlcl_structures; \
+ [ -z "$(FIRMWARE_ARCH)" ] && $(MAKE) -C utility update_tlcl_structures; \
for i in $(SUBDIRS); do \
make -C $$i; \
done