svn commit: r264660 - in head: . share/mk tools/build/options

Warner Losh imp at FreeBSD.org
Fri Apr 18 17:04:01 UTC 2014


Author: imp
Date: Fri Apr 18 17:03:58 2014
New Revision: 264660
URL: http://svnweb.freebsd.org/changeset/base/264660

Log:
  Separate out enabling building clang and/or gcc for the system and
  building clang and/or gcc as the bootstrap compiler. Normally, the
  default compiler is used. WITH_CLANG_BOOTSTRAP and/or
  WITH_GCC_BOOTSTRAP will enable building these compilers as part
  bootstrap phase.  WITH/WITHOUT_CLANG_IS_CC controls which compiler is
  used by default for the bootstrap phase, as well as which compiler is
  installed as cc.  buildworld now successfully completes building the
  cross compiler with WITHOUT_CLANG=t and WITHOUT_GCC=t and produces a
  built system with neither of these included.
  
  Similarlly, MK_BINUTILS_BOOTSTRAP controls whether binutils is built
  during this phase.
  
  WITHOUT_CROSS_COMPILER will now force MK_BINUTILS_BOOTSTRAP=no,
  MK_CLANG_BOOTSTRAP=no and MK_GCC_BOOTSTRAP=no.
  
  BOOTSTRAP_COMPILER was considered, but rejected, since pc98 needs both
  clang and gcc to bootstrap still. It should be revisisted in the
  future if this requirement goes away. Values should be gcc, clang or
  none. It could also be a list.
  
  The odd interaction with Xfoo cross/external tools needs work, but
  is beyond the scope of this change as well.

Added:
  head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
     - copied, changed from r264659, head/tools/build/options/WITHOUT_BINUTILS
  head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP
     - copied, changed from r264659, head/tools/build/options/WITHOUT_CLANG
  head/tools/build/options/WITHOUT_GCC_BOOTSTRAP
     - copied, changed from r264659, head/tools/build/options/WITHOUT_GCC
  head/tools/build/options/WITH_CLANG_BOOTSTRAP
     - copied, changed from r264659, head/tools/build/options/WITHOUT_CLANG
  head/tools/build/options/WITH_GCC_BOOTSTRAP
     - copied, changed from r264659, head/tools/build/options/WITHOUT_GCC
Modified:
  head/Makefile.inc1
  head/share/mk/bsd.own.mk
  head/tools/build/options/WITHOUT_BINUTILS
  head/tools/build/options/WITHOUT_CLANG
  head/tools/build/options/WITHOUT_CROSS_COMPILER
  head/tools/build/options/WITHOUT_GCC
  head/tools/build/options/WITH_CLANG

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1	Fri Apr 18 17:03:49 2014	(r264659)
+++ head/Makefile.inc1	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1226,7 +1226,9 @@ _awk=		usr.bin/awk
 _gensnmptree=	usr.sbin/bsnmpd/gensnmptree
 .endif
 
-.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" || ${MK_CLANG} != "no"
+# We need to build tlbgen when we're building clang either as
+# the bootstrap compiler, or as the part of the normal build.
+.if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no"
 _clang_tblgen= \
 	lib/clang/libllvmsupport \
 	lib/clang/libllvmtablegen \
@@ -1366,22 +1368,19 @@ _kgzip=		usr.sbin/kgzip
 .endif
 .endif
 
-.if ${XAS:M/*} == "" && ${MK_BINUTILS} != "no"
+# If we're given an XAS, don't build binutils.
+.if ${XAS:M/*} == "" && ${MK_BINUTILS_BOOTSTRAP} != "no"
 _binutils=	gnu/usr.bin/binutils
 .endif
 
 # If an full path to an external cross compiler is given, don't build
 # a cross compiler.
 .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no"
-.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang"
+.if ${MK_CLANG_BOOTSTRAP} != "no"
 _clang=		usr.bin/clang
 _clang_libs=	lib/clang
-.else
-_cc=		gnu/usr.bin/cc
 .endif
-
-# The boot2 for pc98 requires gcc.
-.if ${TARGET} == "pc98"
+.if ${MK_GCC_BOOTSTRAP} != "no"
 _cc=		gnu/usr.bin/cc
 .endif
 .endif

Modified: head/share/mk/bsd.own.mk
==============================================================================
--- head/share/mk/bsd.own.mk	Fri Apr 18 17:03:49 2014	(r264659)
+++ head/share/mk/bsd.own.mk	Fri Apr 18 17:03:58 2014	(r264660)
@@ -237,6 +237,7 @@ __DEFAULT_YES_OPTIONS = \
     AUDIT \
     AUTHPF \
     BINUTILS \
+    BINUTILS_BOOTSTRAP \
     BLUETOOTH \
     BMAKE \
     BOOT \
@@ -387,13 +388,13 @@ __TT=${MACHINE}
 .endif
 # Clang is only for x86, powerpc and little-endian arm right now, by default.
 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
-__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL
+__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
 .elif ${__T} == "arm" || ${__T} == "armv6" || ${__T} == "armv6hf"
-__DEFAULT_YES_OPTIONS+=CLANG
+__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP
 # GCC is unable to build the full clang on arm, disable it by default.
 __DEFAULT_NO_OPTIONS+=CLANG_FULL
 .else
-__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL
+__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
 .endif
 # Clang the default system compiler only on little-endian arm and x86.
 .if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
@@ -403,14 +404,14 @@ __DEFAULT_NO_OPTIONS+=GNUCXX
 # The pc98 bootloader requires gcc to build and so we must leave gcc enabled
 # for pc98 for now.
 .if ${__TT} == "pc98"
-__DEFAULT_YES_OPTIONS+=GCC
+__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP
 .else
-__DEFAULT_NO_OPTIONS+=GCC
+__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP
 .endif
 .else
 # If clang is not cc, then build gcc by default
-__DEFAULT_NO_OPTIONS+=CLANG_IS_CC
-__DEFAULT_YES_OPTIONS+=GCC GNUCXX
+__DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP
+__DEFAULT_YES_OPTIONS+=GCC GNUCXX GCC_BOOTSTRAP
 .endif
 
 #
@@ -531,6 +532,12 @@ MK_AUTHPF:=	no
 MK_GROFF:=	no
 .endif
 
+.if ${MK_CROSS_COMPILER} == "no"
+MK_BINUTILS_BOOTSTRAP:= no
+MK_CLANG_BOOTSTRAP:= no
+MK_GCC_BOOTSTRAP:= no
+.endif
+
 .if ${MK_TOOLCHAIN} == "no"
 MK_BINUTILS:=	no
 MK_CLANG:=	no

Modified: head/tools/build/options/WITHOUT_BINUTILS
==============================================================================
--- head/tools/build/options/WITHOUT_BINUTILS	Fri Apr 18 17:03:49 2014	(r264659)
+++ head/tools/build/options/WITHOUT_BINUTILS	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,7 +1,7 @@
 .\" $FreeBSD$
-Set to not install binutils (as, c++-filt, gconv,
-ld, nm, objcopy, objdump, readelf, size and strip).
-.Bf -symbolic
-The option does not generally work for build targets, unless some alternative
-toolchain is enabled.
-.Ef
+Set to not build or install binutils (as, c++-filt, gconv,
+ld, nm, objcopy, objdump, readelf, size and strip) as part
+of the normal system build.
+The resulting system cannot build programs from source.
+
+

Copied and modified: head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP (from r264659, head/tools/build/options/WITHOUT_BINUTILS)
==============================================================================
--- head/tools/build/options/WITHOUT_BINUTILS	Fri Apr 18 17:03:49 2014	(r264659, copy source)
+++ head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,7 +1,8 @@
 .\" $FreeBSD$
-Set to not install binutils (as, c++-filt, gconv,
-ld, nm, objcopy, objdump, readelf, size and strip).
+Set to not build binutils (as, c++-filt, gconv,
+ld, nm, objcopy, objdump, readelf, size and strip)
+as part of the bootstrap process.
 .Bf -symbolic
-The option does not generally work for build targets, unless some alternative
-toolchain is enabled.
+The option does not work for build targets unless some alternative
+toolchain is provided.
 .Ef

Modified: head/tools/build/options/WITHOUT_CLANG
==============================================================================
--- head/tools/build/options/WITHOUT_CLANG	Fri Apr 18 17:03:49 2014	(r264659)
+++ head/tools/build/options/WITHOUT_CLANG	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to not build the Clang C/C++ compiler.
+Set to not build the Clang C/C++ compiler during the regular phase of the build.

Copied and modified: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP (from r264659, head/tools/build/options/WITHOUT_CLANG)
==============================================================================
--- head/tools/build/options/WITHOUT_CLANG	Fri Apr 18 17:03:49 2014	(r264659, copy source)
+++ head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,2 +1,5 @@
 .\" $FreeBSD$
-Set to not build the Clang C/C++ compiler.
+Set to not build the Clang C/C++ compiler during the bootstrap phase of the build.
+You must enable wither gcc or clang bootstrap to be able to build the system,
+unless an alternative compiiler is provided via
+XCC.

Modified: head/tools/build/options/WITHOUT_CROSS_COMPILER
==============================================================================
--- head/tools/build/options/WITHOUT_CROSS_COMPILER	Fri Apr 18 17:03:49 2014	(r264659)
+++ head/tools/build/options/WITHOUT_CROSS_COMPILER	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,3 +1,13 @@
 .\" $FreeBSD$
-Set to not build a cross compiler in the cross-tools stage of
-buildworld, buildkernel, etc.
+Set to not build any cross compiler in the cross-tools stage of buildworld.
+If you are compiling a different version of
+.Fx 
+than what is installed on the system, you will need to provide an alternate
+compiler with XCC to ensure success.
+If you are compiling with an identical version of
+.Fx 
+to the host, this option may be safely used.
+This option may also be safe when the host version of
+.Fx 
+is close to the sources being built, but all bets are off if there have
+been any changes to the toolchain between the versions.

Modified: head/tools/build/options/WITHOUT_GCC
==============================================================================
--- head/tools/build/options/WITHOUT_GCC	Fri Apr 18 17:03:49 2014	(r264659)
+++ head/tools/build/options/WITHOUT_GCC	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to not build and install gcc and g++.
+Set to not build and install gcc and g++ as part of the normal build process.

Copied and modified: head/tools/build/options/WITHOUT_GCC_BOOTSTRAP (from r264659, head/tools/build/options/WITHOUT_GCC)
==============================================================================
--- head/tools/build/options/WITHOUT_GCC	Fri Apr 18 17:03:49 2014	(r264659, copy source)
+++ head/tools/build/options/WITHOUT_GCC_BOOTSTRAP	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,2 +1,5 @@
 .\" $FreeBSD$
-Set to not build and install gcc and g++.
+Set to not build gcc and g++ as part of the bootstrap process.
+You must enable wither gcc or clang bootstrap to be able to build the system,
+unless an alternative compiiler is provided via
+XCC.

Modified: head/tools/build/options/WITH_CLANG
==============================================================================
--- head/tools/build/options/WITH_CLANG	Fri Apr 18 17:03:49 2014	(r264659)
+++ head/tools/build/options/WITH_CLANG	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to build the Clang C/C++ compiler.
+Set to build the Clang C/C++ compiler during the normal phase of the build.

Copied and modified: head/tools/build/options/WITH_CLANG_BOOTSTRAP (from r264659, head/tools/build/options/WITHOUT_CLANG)
==============================================================================
--- head/tools/build/options/WITHOUT_CLANG	Fri Apr 18 17:03:49 2014	(r264659, copy source)
+++ head/tools/build/options/WITH_CLANG_BOOTSTRAP	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to not build the Clang C/C++ compiler.
+Set to build the Clang C/C++ compiler during the bootstrap phase of the build.

Copied and modified: head/tools/build/options/WITH_GCC_BOOTSTRAP (from r264659, head/tools/build/options/WITHOUT_GCC)
==============================================================================
--- head/tools/build/options/WITHOUT_GCC	Fri Apr 18 17:03:49 2014	(r264659, copy source)
+++ head/tools/build/options/WITH_GCC_BOOTSTRAP	Fri Apr 18 17:03:58 2014	(r264660)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to not build and install gcc and g++.
+Set to build gcc and g++ as part of the bootstrap process.


More information about the svn-src-head mailing list