Fix xdev TARGET/TARGET_ARCH assertion and expand to native-xtools.

The top of Makefile.inc1 requires TARGET/TARGET_ARCH be defined.  Just
building 'make xdev' would already set them, so this error was never
triggered.  Moving it to Makefile fixes the problem.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
This commit is contained in:
Bryan Drewery 2017-10-29 01:21:19 +00:00
parent bb3f65ea64
commit 24830684f2
2 changed files with 16 additions and 6 deletions

View File

@ -135,6 +135,9 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
packages installconfig real-packages sign-packages package-pkg \ packages installconfig real-packages sign-packages package-pkg \
print-dir test-system-compiler print-dir test-system-compiler
# These targets require a TARGET and TARGET_ARCH be defined.
XTGTS= native-xtools xdev xdev-build xdev-install xdev-links
# XXX: r156740: This can't work since bsd.subdir.mk is not included ever. # XXX: r156740: This can't work since bsd.subdir.mk is not included ever.
# It will only work for SUBDIR_TARGETS in make.conf. # It will only work for SUBDIR_TARGETS in make.conf.
TGTS+= ${SUBDIR_TARGETS} TGTS+= ${SUBDIR_TARGETS}
@ -270,6 +273,11 @@ _TARGET= ${XDEV}
.if defined(XDEV_ARCH) .if defined(XDEV_ARCH)
_TARGET_ARCH= ${XDEV_ARCH} _TARGET_ARCH= ${XDEV_ARCH}
.endif .endif
# Some targets require a set TARGET/TARGET_ARCH, check before the default
# MACHINE and after the compatibility handling.
.if !defined(_TARGET) || !defined(_TARGET_ARCH)
${XTGTS}: _assert_target
.endif
# Otherwise, default to current machine type and architecture. # Otherwise, default to current machine type and architecture.
_TARGET?= ${MACHINE} _TARGET?= ${MACHINE}
_TARGET_ARCH?= ${MACHINE_ARCH} _TARGET_ARCH?= ${MACHINE_ARCH}
@ -278,6 +286,14 @@ _TARGET_ARCH?= ${MACHINE_ARCH}
.SILENT: .SILENT:
.endif .endif
_assert_target: .PHONY .MAKE
.for _tgt in ${XTGTS}
.if make(${_tgt})
@echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${_tgt}\" target"
@false
.endif
.endfor
# #
# Make sure we have an up-to-date make(1). Only world and buildworld # Make sure we have an up-to-date make(1). Only world and buildworld
# should do this as those are the initial targets used for upgrades. # should do this as those are the initial targets used for upgrades.

View File

@ -2760,8 +2760,6 @@ cleanworld: .PHONY
${_+_}@cd ${.CURDIR}; ${MAKE} cleandir ${_+_}@cd ${.CURDIR}; ${MAKE} cleandir
.endif .endif
.if defined(TARGET) && defined(TARGET_ARCH)
.if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH} .if ${TARGET} == ${MACHINE} && ${TARGET_ARCH} == ${MACHINE_ARCH}
XDEV_CPUTYPE?=${CPUTYPE} XDEV_CPUTYPE?=${CPUTYPE}
.else .else
@ -2908,7 +2906,3 @@ xdev-links: .PHONY
ln -sf ../../${XDTP}/usr/bin/$$i \ ln -sf ../../${XDTP}/usr/bin/$$i \
../../../../usr/bin/${XDDIR}${_REVISION}-$$i; \ ../../../../usr/bin/${XDDIR}${_REVISION}-$$i; \
done done
.else
xdev xdev-build xdev-install xdev-links: .PHONY
@echo "*** Error: Both TARGET and TARGET_ARCH must be defined for \"${.TARGET}\" target"
.endif