From owner-svn-src-stable@freebsd.org Wed Jul 27 05:17:56 2016 Return-Path: Delivered-To: svn-src-stable@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 F0A88A7AD91; Wed, 27 Jul 2016 05:17:56 +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 CB8261CCC; Wed, 27 Jul 2016 05:17:56 +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 u6R5HuTB044109; Wed, 27 Jul 2016 05:17:56 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6R5Ht1n044107; Wed, 27 Jul 2016 05:17:55 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201607270517.u6R5Ht1n044107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 27 Jul 2016 05:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r303359 - stable/11 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jul 2016 05:17:57 -0000 Author: bdrewery Date: Wed Jul 27 05:17:55 2016 New Revision: 303359 URL: https://svnweb.freebsd.org/changeset/base/303359 Log: MFC r303272,r303273: r303272: SYSTEM_COMPILER: Rework the logic to allow a 'make test-system-compiler'. r303273: Fix empty WANT_COMPILER_TYPE when neither compiler is bootstrapped. Approved by: re (kib) Modified: stable/11/Makefile stable/11/Makefile.inc1 Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile ============================================================================== --- stable/11/Makefile Wed Jul 27 05:03:58 2016 (r303358) +++ stable/11/Makefile Wed Jul 27 05:17:55 2016 (r303359) @@ -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: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Wed Jul 27 05:03:58 2016 (r303358) +++ stable/11/Makefile.inc1 Wed Jul 27 05:17:55 2016 (r303359) @@ -80,50 +80,68 @@ 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 +.else +WANT_COMPILER_TYPE= .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