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
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to