[coreboot-gerrit] New patch to review for coreboot: Makefile: Add toolchain version check

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Wed Jan 6 00:08:21 CET 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12846

-gerrit

commit 038eb244f71f8da7fe3aba3ca21c607c7b06f390
Author: Martin Roth <martinroth at google.com>
Date:   Tue Jan 5 16:07:42 2016 -0700

    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.
    
    This supplies two targets to check the toolchain:
    test_toolchain_and_halt - dies if the toolchain is not
    the current version that is specified in the tree.
    
    test_toolchain - will print the status of the toolchain, but
    will continue to build if called as one of several targets.
    
    for example 'make test_toolchain all' will print the status,
    and then build the tree even if a toolchain component is out
    of date.
    
    Change-Id: I41daf6c4545c01dc21231d78fd081bbcf77c4726
    Signed-off-by: Martin Roth <martinroth at google.com>
---
 Makefile.inc  | 11 +++++++++++
 toolchain.inc | 15 +++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/Makefile.inc b/Makefile.inc
index 000ad63..fb7bed9 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -486,6 +486,7 @@ help_toolchain help::
 	@echo  '  crossgcc-clean  - Remove all built coreboot cross-compilers'
 	@echo  '  iasl            - Build coreboot IASL compiler (built by all cross targets)'
 	@echo  '  clang           - Build coreboot clang compiler'
+	@echo  '  test_toolchain  - Reports if toolchain components are out of date'
 	@echo  '  crossgcc-ARCH   - Build cross-compiler for specific architecture'
 	@echo  '  crosstools-ARCH - Build cross-compiler with GDB for specific architecture'
 	@echo  '  ARCH can be "i386", "x64", "arm", "aarch64", "mips", "riscv", or "power8"'
@@ -559,6 +560,16 @@ crossgcc-clean: clean-for-update
 
 tools: $(objutil)/kconfig/conf $(CBFSTOOL) $(FMAPTOOL) $(RMODTOOL) $(objutil)/nvramtool/nvramtool $(ROMCC_BIN) $(objutil)/sconfig/sconfig $(IFDTOOL) $(IFDFAKE) $(CBOOTIMAGE) $(AMDFWTOOL)
 
+test_toolchain_and_halt test_toolchain:
+ifeq ($(COMPILER_OUT_OF_DATE),1)
+	echo "The coreboot toolchain is not the current version"
+ifneq ($(filter test_toolchain_and_halt,$(MAKECMDGOALS)),)
+$(error )
+endif # ifneq ($(filter crossgcc_check_and_halt,$(MAKECMDGOALS)),)
+else
+	echo "The coreboot tools are the current version"
+endif # ifeq ($(COMPILER_OUT_OF_DATE),1)
+
 ###########################################################################
 # Common recipes for all stages
 ###########################################################################
diff --git a/toolchain.inc b/toolchain.inc
index f2a6232..609fe44 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -185,3 +185,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),)



More information about the coreboot-gerrit mailing list