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)
This commit is contained in:
Martin Roth
2016-01-05 16:07:42 -07:00
parent 5933814e27
commit aede3fc828
2 changed files with 24 additions and 0 deletions

View File

@@ -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),)