summaryrefslogtreecommitdiff
path: root/toolchain.inc
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2016-01-05 16:07:42 -0700
committerMartin Roth <martinroth@google.com>2016-01-12 22:31:30 +0100
commitaede3fc828a98221fcf64457665fabbe0eb1eb09 (patch)
tree0f7fdcbf9e954cb7840869603ff9a5329febfebd /toolchain.inc
parent5933814e272a6dec3ab763462e3629e75690fc66 (diff)
Makefile: Add toolchain version check
This is an initial check for the coreboot toolchain versions. It currently checks binutils, gcc, clang, and iasl. The other components are slightly more difficult to test, but should follow on shortly. If the toolchain is not the correct version, make will halt with an error. Change-Id: I41daf6c4545c01dc21231d78fd081bbcf77c4726 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://review.coreboot.org/12846 Reviewed-by: Timothy Pearson <tpearson@raptorengineeringinc.com> Tested-by: build bot (Jenkins)
Diffstat (limited to 'toolchain.inc')
-rw-r--r--toolchain.inc15
1 files changed, 15 insertions, 0 deletions
diff --git a/toolchain.inc b/toolchain.inc
index 5836a197fb..8bb0aae7a0 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -193,3 +193,18 @@ $(error Halting the build)
endif #($(COMPILERFAIL),1)
endif #($(NOCOMPILE),1)
+
+ifneq ($(MAKECMDGOALS),)
+ifneq ($(filter test-toolchain,$(MAKECMDGOALS)),)
+$(foreach arch, $(ARCH_SUPPORTED), \
+ $(if $(shell if [ -n "$(GCC_CC_$(arch))" ]; then $(GCC_CC_$(arch)) -v 2>&1 | grep -q "$(shell util/crossgcc/buildgcc -s gcc)" || echo not-current; fi), \
+ $(eval COMPILER_OUT_OF_DATE:=1)$(warning The coreboot toolchain version of gcc for '$(arch)' architecture is not the current version.)) \
+ $(if $(shell if [ -n "$(CLANG_CC_$(arch))" ]; then $(CLANG_CC_$(arch)) -v 2>&1 | grep -q "$(shell util/crossgcc/buildgcc -s clang)" || echo not-current; fi), \
+ $(eval COMPILER_OUT_OF_DATE:=1)$(warning The coreboot toolchain version of clang for '$(arch)' architecture is not the current version.)) \
+ $(if $(shell if [ "$(OBJDUMP_$(arch))" != "invalidobjdump" ]; then $(OBJDUMP_$(arch)) -v 2>&1 | grep -q "$(shell util/crossgcc/buildgcc -s binutils)" || echo not-current; fi), \
+ $(eval COMPILER_OUT_OF_DATE:=1)$(warning The coreboot toolchain version of binutils for '$(arch)' architecture is not the current version.)) \
+)
+$(if $(shell if [ -n "$(IASL)" ]; then $(IASL) -v 2>&1 | grep -q "$(shell util/crossgcc/buildgcc -s iasl)" || echo not-coreboot; fi), \
+ $(eval COMPILER_OUT_OF_DATE:=1)$(warning The coreboot toolchain version of iasl is not the current version))
+endif # ifneq ($(filter crossgcc_check%,$(MAKECMDGOALS)),)
+endif # ifneq ($(MAKECMDGOALS),)