From aede3fc828a98221fcf64457665fabbe0eb1eb09 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Tue, 5 Jan 2016 16:07:42 -0700 Subject: 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 Reviewed-on: https://review.coreboot.org/12846 Reviewed-by: Timothy Pearson Tested-by: build bot (Jenkins) --- toolchain.inc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'toolchain.inc') 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),) -- cgit v1.2.3