This is a first stab at making it possible to select which LLVM targets
you want to build during buildworld. The current list is:
- MK_LLVM_TARGET_AARCH64
- MK_LLVM_TARGET_ARM
- MK_LLVM_TARGET_MIPS
- MK_LLVM_TARGET_POWERPC
- MK_LLVM_TARGET_SPARC
- MK_LLVM_TARGET_X86
To not influence anything right now, all of these are on by default, in
situations where clang is enabled. At a later stage we can add some
magic to only enable the target currently required for the cross-tools
stage, or other fancy things.
Selectively turning a few targets off manually should work. Turning on
only one target should work too, even if that target does not correspond
to the build architecture. (In that case, LLVM_NATIVE_ARCH will not be
defined, and you can only use the resulting clang executable for
cross-compiling.)
It is also possible to disable all targets, which will result in a clang
executable that runs, but cannot compile anything. Fairly nonsensical,
so maybe a seatbelt would be nice.
Note that clang provides no easy way to show the targets it supports, so
I submitted a review upstream to make that possible, which I might
probably add later after it is accepted.
With this, we can also add riscv or systemz support relatively easily,
but turned it off by default, so it does not trip anybody up who does
not ask for it explicitly. :)
Last but not least, I did some measurements on ref12-amd64.freebsd.org,
building clang from scratch, with all targets and with only the x86
target. The latter was ~14% faster in real time (on a 32-core box), and
~17% faster in user time. For a full buildworld the difference will
probably be less pronounced, but I have not measured it explicitly.