summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2014-04-18 17:03:58 +0000
committerimp <imp@FreeBSD.org>2014-04-18 17:03:58 +0000
commit05af977d7ba66a5a516211f67fae465e5bf34863 (patch)
tree04a3a7ae5a3e2ee005a82992aa612466d9e72ea6
parent45481ab5835a397fc7869e0509e561e115d872e6 (diff)
downloadFreeBSD-src-05af977d7ba66a5a516211f67fae465e5bf34863.zip
FreeBSD-src-05af977d7ba66a5a516211f67fae465e5bf34863.tar.gz
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.
-rw-r--r--Makefile.inc115
-rw-r--r--share/mk/bsd.own.mk21
-rw-r--r--tools/build/options/WITHOUT_BINUTILS12
-rw-r--r--tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP8
-rw-r--r--tools/build/options/WITHOUT_CLANG2
-rw-r--r--tools/build/options/WITHOUT_CLANG_BOOTSTRAP5
-rw-r--r--tools/build/options/WITHOUT_CROSS_COMPILER14
-rw-r--r--tools/build/options/WITHOUT_GCC2
-rw-r--r--tools/build/options/WITHOUT_GCC_BOOTSTRAP5
-rw-r--r--tools/build/options/WITH_CLANG2
-rw-r--r--tools/build/options/WITH_CLANG_BOOTSTRAP2
-rw-r--r--tools/build/options/WITH_GCC_BOOTSTRAP2
12 files changed, 64 insertions, 26 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1
index 592cdda..c15a2ba 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -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
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index c3bf33b..b2ce100 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -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
diff --git a/tools/build/options/WITHOUT_BINUTILS b/tools/build/options/WITHOUT_BINUTILS
index 62a614e..5270bd7 100644
--- a/tools/build/options/WITHOUT_BINUTILS
+++ b/tools/build/options/WITHOUT_BINUTILS
@@ -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.
+
+
diff --git a/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP b/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
new file mode 100644
index 0000000..84ae1a17
--- /dev/null
+++ b/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
@@ -0,0 +1,8 @@
+.\" $FreeBSD$
+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 work for build targets unless some alternative
+toolchain is provided.
+.Ef
diff --git a/tools/build/options/WITHOUT_CLANG b/tools/build/options/WITHOUT_CLANG
index 62a90ba..51c9c51 100644
--- a/tools/build/options/WITHOUT_CLANG
+++ b/tools/build/options/WITHOUT_CLANG
@@ -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.
diff --git a/tools/build/options/WITHOUT_CLANG_BOOTSTRAP b/tools/build/options/WITHOUT_CLANG_BOOTSTRAP
new file mode 100644
index 0000000..a22046d
--- /dev/null
+++ b/tools/build/options/WITHOUT_CLANG_BOOTSTRAP
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+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.
diff --git a/tools/build/options/WITHOUT_CROSS_COMPILER b/tools/build/options/WITHOUT_CROSS_COMPILER
index 1ded25b..ab1bd23 100644
--- a/tools/build/options/WITHOUT_CROSS_COMPILER
+++ b/tools/build/options/WITHOUT_CROSS_COMPILER
@@ -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.
diff --git a/tools/build/options/WITHOUT_GCC b/tools/build/options/WITHOUT_GCC
index 7bb21f8..c746d16 100644
--- a/tools/build/options/WITHOUT_GCC
+++ b/tools/build/options/WITHOUT_GCC
@@ -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.
diff --git a/tools/build/options/WITHOUT_GCC_BOOTSTRAP b/tools/build/options/WITHOUT_GCC_BOOTSTRAP
new file mode 100644
index 0000000..668ff14
--- /dev/null
+++ b/tools/build/options/WITHOUT_GCC_BOOTSTRAP
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+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.
diff --git a/tools/build/options/WITH_CLANG b/tools/build/options/WITH_CLANG
index b0e300a..0174b4d 100644
--- a/tools/build/options/WITH_CLANG
+++ b/tools/build/options/WITH_CLANG
@@ -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.
diff --git a/tools/build/options/WITH_CLANG_BOOTSTRAP b/tools/build/options/WITH_CLANG_BOOTSTRAP
new file mode 100644
index 0000000..792512d
--- /dev/null
+++ b/tools/build/options/WITH_CLANG_BOOTSTRAP
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to build the Clang C/C++ compiler during the bootstrap phase of the build.
diff --git a/tools/build/options/WITH_GCC_BOOTSTRAP b/tools/build/options/WITH_GCC_BOOTSTRAP
new file mode 100644
index 0000000..8e04b11
--- /dev/null
+++ b/tools/build/options/WITH_GCC_BOOTSTRAP
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to build gcc and g++ as part of the bootstrap process.
OpenPOWER on IntegriCloud