1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

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.
This commit is contained in:
Warner Losh 2014-04-18 17:03:58 +00:00
parent 0abe2561f6
commit 2bf36e7e08
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=264660
12 changed files with 64 additions and 26 deletions

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Set to build the Clang C/C++ compiler during the bootstrap phase of the build.

View File

@ -0,0 +1,2 @@
.\" $FreeBSD$
Set to build gcc and g++ as part of the bootstrap process.