Index: head/Makefile =================================================================== --- head/Makefile +++ head/Makefile @@ -513,14 +513,20 @@ TARGET_ARCHES_${target}?= ${target} .endfor -# Remove architectures only supported by external toolchain from -# universe if required toolchain packages are missing. -# Note: We no longer have targets that require an external toolchain, but for -# now keep this block in case a new non-LLVM architecture is added and to reuse -# it for a future extenal GCC make universe variant. -_external_toolchain_targets= -.for target in ${_external_toolchain_targets} -.if ${_UNIVERSE_TARGETS:M${target}} +.if defined(USE_GCC_TOOLCHAINS) +TOOLCHAINS_amd64= amd64-gcc6 +TOOLCHAINS_arm64= aarch64-gcc6 +TOOLCHAINS_i386= i386-gcc6 +TOOLCHAINS_mips= mips-gcc6 +TOOLCHAINS_powerpc= powerpc-gcc6 powerpc64-gcc6 +TOOLCHAIN_powerpc64= powerpc64-gcc6 +.endif + +# If a target is using an external toolchain, set MAKE_PARAMS to enable use +# of the toolchain. If the external toolchain is missing, exclude the target +# from universe. +.for target in ${_UNIVERSE_TARGETS} +.if !empty(TOOLCHAINS_${target}) .for toolchain in ${TOOLCHAINS_${target}} .if !exists(/usr/local/share/toolchains/${toolchain}.mk) _UNIVERSE_TARGETS:= ${_UNIVERSE_TARGETS:N${target}} @@ -530,6 +536,10 @@ @echo ">> ${target} skipped - install ${toolchain} port or package to build" .endif .endfor +.for arch in ${TARGET_ARCHES_${target}} +TOOLCHAIN_${arch}?= ${TOOLCHAINS_${target}:[1]} +MAKE_PARAMS_${arch}?= CROSS_TOOLCHAIN=${TOOLCHAIN_${arch}} +.endfor .endif .endfor @@ -604,7 +614,7 @@ _need_clang_${target}_${target_arch} != \ env TARGET=${target} TARGET_ARCH=${target_arch} \ ${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-compiler \ - ${MAKE_PARAMS_${target}} -V MK_CLANG_BOOTSTRAP 2>/dev/null || \ + ${MAKE_PARAMS_${target_arch}} -V MK_CLANG_BOOTSTRAP 2>/dev/null || \ echo unknown .export _need_clang_${target}_${target_arch} .endif @@ -612,7 +622,7 @@ _need_lld_${target}_${target_arch} != \ env TARGET=${target} TARGET_ARCH=${target_arch} \ ${SUB_MAKE} -C ${.CURDIR} -f Makefile.inc1 test-system-linker \ - ${MAKE_PARAMS_${target}} -V MK_LLD_BOOTSTRAP 2>/dev/null || \ + ${MAKE_PARAMS_${target_arch}} -V MK_LLD_BOOTSTRAP 2>/dev/null || \ echo unknown .export _need_lld_${target}_${target_arch} .endif @@ -628,7 +638,7 @@ # supports all TARGETS though. # For now we only pass UNIVERSE_TOOLCHAIN_PATH which will be added at the end # of STRICTTMPPATH to ensure that the target-specific binaries come first. -MAKE_PARAMS_${target}+= \ +MAKE_PARAMS_${target_arch}+= \ XCC="${HOST_OBJTOP}/tmp/usr/bin/cc" \ XCXX="${HOST_OBJTOP}/tmp/usr/bin/c++" \ XCPP="${HOST_OBJTOP}/tmp/usr/bin/cpp" \ @@ -636,7 +646,7 @@ .endif .if defined(_need_lld_${target}_${target_arch}) && \ ${_need_lld_${target}_${target_arch}} == "yes" -MAKE_PARAMS_${target}+= \ +MAKE_PARAMS_${target_arch}+= \ XLD="${HOST_OBJTOP}/tmp/usr/bin/ld" .endif .endfor @@ -659,7 +669,7 @@ ${SUB_MAKE} ${JFLAG} ${UNIVERSE_TARGET} \ TARGET=${target} \ TARGET_ARCH=${target_arch} \ - ${MAKE_PARAMS_${target}} \ + ${MAKE_PARAMS_${target_arch}} \ > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \ (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \ "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \ @@ -724,7 +734,7 @@ ${SUB_MAKE} ${JFLAG} buildkernel \ TARGET=${TARGET} \ TARGET_ARCH=${TARGET_ARCH_${kernel}} \ - ${MAKE_PARAMS_${TARGET}} \ + ${MAKE_PARAMS_${TARGET_ARCH}} \ KERNCONF=${kernel} \ > _.${TARGET}.${kernel} 2>&1 || \ (echo "${TARGET} ${kernel} kernel failed," \