Follow-up r320149: Enable GPL_DTC if we're using GCC as the cross-compiler.

This fixes object files landing in the source tree in gnu/usr.bin/dtc
for GCC platforms.

We cannot reliably detect if an external compiler is used here, and the
default YES option does include GCC_BOOTSTRAP which implies that GCC may
be used for the build.

The problem manifests when not using an external compiler, and the host
compiler is clang.  When a fresh build is done (no OBJDIR yet) the
'make obj' treewalk is done before 'make cross-tools', so
COMPILER_FEATURES at this point contains 'c++11' since the host compiler
was used for COMPILER_FEATURES.  Once cross-tools builds the GCC
bootstrap compiler and then descends into 'make everything',
COMPILER_FEATURES no longer contains 'c++11' and MK_GPL_DTC defaults to
enabled.  Now it builds in gnu/usr.bin/dtc without an OBJDIR preset and
drops files into the source tree.

The COMPILER_FEATURES check here is useful for knowing if we can *bootstrap*
C++11 things.  Indeed we do bootstrap dtc as a build tool so it is
useful for enabling the BSD dtc for the build, but we end up needing the
GPL dtc for installation anyway.

Reviewed by:	manu, emaste
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12817
This commit is contained in:
Bryan Drewery 2017-10-31 00:03:32 +00:00
parent 54a03abb68
commit 83f4f35130

View File

@ -227,8 +227,8 @@ __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC
# If an external compiler that supports C++11 is used as ${CC} and Clang
# supports the target, then Clang is enabled but GCC is installed as the
# default /usr/bin/cc.
__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX
__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC GPL_DTC LLD
__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX GPL_DTC
__DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC LLD
.else
# Everything else disables Clang, and uses GCC instead.
__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC