From owner-svn-src-all@freebsd.org Sun Jul 24 18:05:06 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F284EBA3F83; Sun, 24 Jul 2016 18:05:06 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D002E16B5; Sun, 24 Jul 2016 18:05:06 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6OI56LH092926; Sun, 24 Jul 2016 18:05:06 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6OI55np092924; Sun, 24 Jul 2016 18:05:05 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607241805.u6OI55np092924@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sun, 24 Jul 2016 18:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303272 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2016 18:05:07 -0000 Author: bdrewery Date: Sun Jul 24 18:05:05 2016 New Revision: 303272 URL: https://svnweb.freebsd.org/changeset/base/303272 Log: SYSTEM_COMPILER: Rework the logic to allow a 'make test-system-compiler'. 1. Always calculate what the expected values are. 2. Add 'make test-system-compiler' to show all of the computed values vs the wanted values. 3. Extend the .info line to buildkernel/kernel-toolchain/toolchain/_cross-tools. 4. Consolidate all of the logic to one condition. MFC after: 3 days Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile head/Makefile.inc1 Modified: head/Makefile ============================================================================== --- head/Makefile Sun Jul 24 18:04:12 2016 (r303271) +++ head/Makefile Sun Jul 24 18:05:05 2016 (r303272) @@ -131,7 +131,8 @@ TGTS= all all-man buildenv buildenvvars builddtb xdev xdev-build xdev-install \ xdev-links native-xtools stageworld stagekernel stage-packages \ create-world-packages create-kernel-packages create-packages \ - packages installconfig real-packages sign-packages package-pkg + packages installconfig real-packages sign-packages package-pkg \ + test-system-compiler # XXX: r156740: This can't work since bsd.subdir.mk is not included ever. # It will only work for SUBDIR_TARGETS in make.conf. @@ -151,7 +152,8 @@ TGTS+= ${BITGTS} META_TGT_WHITELIST+= \ _* build32 buildfiles buildincludes buildkernel buildsoft \ buildworld everything kernel-toolchain kernel-toolchains kernel \ - kernels libraries native-xtools showconfig tinderbox toolchain \ + kernels libraries native-xtools showconfig test-system-compiler \ + tinderbox toolchain \ toolchains universe world worlds xdev xdev-build .ORDER: buildworld installworld Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Sun Jul 24 18:04:12 2016 (r303271) +++ head/Makefile.inc1 Sun Jul 24 18:05:05 2016 (r303272) @@ -82,50 +82,66 @@ MK_CROSS_COMPILER= no .include "share/mk/src.opts.mk" # Check if there is a local compiler that can satisfy as an external compiler. -.if ${MK_SYSTEM_COMPILER} == "yes" && ${MK_CROSS_COMPILER} == "yes" && \ - (${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \ - !make(showconfig) && !make(native-xtools) && !make(xdev*) # Which compiler is expected to be used? .if ${MK_CLANG_BOOTSTRAP} == "yes" -_expected_compiler_type= clang +WANT_COMPILER_TYPE= clang .elif ${MK_GCC_BOOTSTRAP} == "yes" -_expected_compiler_type= gcc +WANT_COMPILER_TYPE= gcc .endif -# If the expected vs CC is different then we can't skip. -# GCC cannot be used for cross-arch yet. For clang we pass -target later if -# TARGET_ARCH!=MACHINE_ARCH. -.if ${_expected_compiler_type} == ${COMPILER_TYPE} && \ - (${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) -# It needs to be the same revision as we would build for the bootstrap. -.if !defined(CROSS_COMPILER_FREEBSD_VERSION) -.if ${_expected_compiler_type} == "clang" -CROSS_COMPILER_FREEBSD_VERSION!= \ +.if !defined(WANT_COMPILER_FREEBSD_VERSION) +.if ${WANT_COMPILER_TYPE} == "clang" +WANT_COMPILER_FREEBSD_VERSION_FILE= lib/clang/freebsd_cc_version.h +WANT_COMPILER_FREEBSD_VERSION!= \ awk '$$2 == "FREEBSD_CC_VERSION" {printf("%d\n", $$3)}' \ - ${SRCDIR}/lib/clang/freebsd_cc_version.h || echo unknown -CROSS_COMPILER_VERSION!= \ + ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown +WANT_COMPILER_VERSION_FILE= lib/clang/include/clang/Basic/Version.inc +WANT_COMPILER_VERSION!= \ awk '$$2 == "CLANG_VERSION" {split($$3, a, "."); print a[1] * 10000 + a[2] * 100 + a[3]}' \ - ${SRCDIR}/lib/clang/include/clang/Basic/Version.inc || echo unknown -.elif ${_expected_compiler_type} == "gcc" -CROSS_COMPILER_FREEBSD_VERSION!= \ + ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown +.elif ${WANT_COMPILER_TYPE} == "gcc" +WANT_COMPILER_FREEBSD_VERSION_FILE= gnu/usr.bin/cc/cc_tools/freebsd-native.h +WANT_COMPILER_FREEBSD_VERSION!= \ awk '$$2 == "FBSD_CC_VER" {printf("%d\n", $$3)}' \ - ${SRCDIR}/gnu/usr.bin/cc/cc_tools/freebsd-native.h || echo unknown -CROSS_COMPILER_VERSION!= \ + ${SRCDIR}/${WANT_COMPILER_FREEBSD_VERSION_FILE} || echo unknown +WANT_COMPILER_VERSION_FILE= contrib/gcc/BASE-VER +WANT_COMPILER_VERSION!= \ awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3}' \ - ${SRCDIR}/contrib/gcc/BASE-VER || echo unknown + ${SRCDIR}/${WANT_COMPILER_VERSION_FILE} || echo unknown .endif -.export CROSS_COMPILER_FREEBSD_VERSION CROSS_COMPILER_VERSION -.endif # !defined(CROSS_COMPILER_FREEBSD_VERSION) -.if ${COMPILER_VERSION} == ${CROSS_COMPILER_VERSION} && \ - ${COMPILER_FREEBSD_VERSION} == ${CROSS_COMPILER_FREEBSD_VERSION} +.export WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_VERSION +.endif # !defined(WANT_COMPILER_FREEBSD_VERSION) +# It needs to be the same revision as we would build for the bootstrap. +# If the expected vs CC is different then we can't skip. +# GCC cannot be used for cross-arch yet. For clang we pass -target later if +# TARGET_ARCH!=MACHINE_ARCH. +.if ${MK_SYSTEM_COMPILER} == "yes" && ${MK_CROSS_COMPILER} == "yes" && \ + (${MK_CLANG_BOOTSTRAP} == "yes" || ${MK_GCC_BOOTSTRAP} == "yes") && \ + !make(showconfig) && !make(native-xtools) && !make(xdev*) && \ + ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} && \ + (${COMPILER_TYPE} == "clang" || ${TARGET_ARCH} == ${MACHINE_ARCH}) && \ + ${COMPILER_VERSION} == ${WANT_COMPILER_VERSION} && \ + ${COMPILER_FREEBSD_VERSION} == ${WANT_COMPILER_FREEBSD_VERSION} # Everything matches, disable the bootstrap compiler. MK_CLANG_BOOTSTRAP= no MK_GCC_BOOTSTRAP= no -.if make(buildworld) +USING_SYSTEM_COMPILER= yes +.endif # ${WANT_COMPILER_TYPE} == ${COMPILER_TYPE} +USING_SYSTEM_COMPILER?= no +TEST_SYSTEM_COMPILER_VARS= \ + USING_SYSTEM_COMPILER MK_SYSTEM_COMPILER \ + MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP MK_GCC_BOOTSTRAP \ + WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \ + WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ + CC COMPILER_TYPE COMPILER_VERSION COMPILER_FREEBSD_VERSION +test-system-compiler: .PHONY +.for v in ${TEST_SYSTEM_COMPILER_VARS} + ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" +.endfor +.if ${USING_SYSTEM_COMPILER} == "yes" && \ + (make(buildworld) || make(buildkernel) || make(kernel-toolchain) || \ + make(toolchain) || make(_cross-tools)) .info SYSTEM_COMPILER: Determined that CC=${CC} matches the source tree. Not bootstrapping a cross-compiler. .endif -.endif # ${COMPILER_VERSION} == ${CROSS_COMPILER_VERSION} -.endif # ${_expected_compiler_type} == ${COMPILER_TYPE} -.endif # ${XCC:N${CCACHE_BIN}:M/*} # For installworld need to ensure that the looked-up compiler metadata is # passed along rather than trying to run cc from the restricted