Implement the xdev target. When you define XDEV=arch XDEV_ARCH=arch,

you can build the cross development tools and install them as
$XDEV-freebsd-xxx for each tool.  This allows one to use autoconf to
find the tools for cross building scenarios.
This commit is contained in:
Warner Losh 2009-03-13 07:23:58 +00:00
parent 3e5f41cf03
commit 25bacc7818
2 changed files with 87 additions and 1 deletions

View File

@ -88,7 +88,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
obj objlink regress rerelease showconfig tags toolchain update \ obj objlink regress rerelease showconfig tags toolchain update \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
_build-tools _cross-tools _includes _libraries _depend \ _build-tools _cross-tools _includes _libraries _depend \
build32 distribute32 install32 build32 distribute32 install32 xdev xdev-build xdev-install
TGTS+= ${SUBDIR_TARGETS} TGTS+= ${SUBDIR_TARGETS}
BITGTS= files includes BITGTS= files includes

View File

@ -1328,3 +1328,89 @@ check-old: check-old-files check-old-libs check-old-dirs
# #
showconfig: showconfig:
@${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort @${MAKE} -n -f bsd.own.mk -V dummy -dg1 | grep ^MK_ | sort
###############
.if defined(XDEV) && defined(XDEV_ARCH)
NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
-DWITHOUT_MAN -DWITHOUT_NLS -DWITHOUT_PROFILE \
-DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS
XDDIR=${XDEV}-freebsd
XDTP=/usr/${XDDIR}
CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \
TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH}
CDENV= ${CDBENV} \
_SHLIBDIRPREFIX=${XDTP} \
TOOLS_PREFIX=${XDTP}
CD2ENV=${CDENV} \
MACHINE=${XDEV} MACHINE_ARCH=${XDEV_ARCH}
CDTMP= ${MAKEOBJDIRPREFIX}/${XDEV}/${.CURDIR}/tmp
CDMAKE=${CDENV} ${MAKE} ${NOFUN}
CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN}
XDDESTDIR=${DESTDIR}${XDTP}
.ORDER: xdev-build xdev-install
xdev: xdev-build xdev-install
.ORDER: _xb-build-tools _xb-cross-tools
xdev-build: _xb-build-tools _xb-cross-tools
_xb-build-tools:
${_+_}cd ${.CURDIR}; \
${CDBENV} ${MAKE} -f Makefile.inc1 ${NOFUN} build-tools
_xb-cross-tools:
.for _tool in \
gnu/usr.bin/binutils \
gnu/usr.bin/cc
${_+_}@${ECHODIR} "===> xdev ${_tool} (obj,depend,all)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ obj; \
${CDMAKE} DIRPRFX=${_tool}/ depend; \
${CDMAKE} DIRPRFX=${_tool}/ all
.endfor
_xi-mtree:
${_+_}@${ECHODIR} "mtree populating ${XDDESTDIR}"
mkdir -p ${XDDESTDIR}
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \
-p ${XDDESTDIR} >/dev/null
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
-p ${XDDESTDIR}/usr >/dev/null
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
-p ${XDDESTDIR}/usr/include >/dev/null
.ORDER: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
xdev-install: _xi-mtree _xi-cross-tools _xi-includes _xi-libraries _xi-links
_xi-cross-tools:
@echo "_xi-cross-tools"
.for _tool in \
gnu/usr.bin/binutils \
gnu/usr.bin/cc
${_+_}@${ECHODIR} "===> xdev ${_tool} (install)"; \
cd ${.CURDIR}/${_tool}; \
${CDMAKE} DIRPRFX=${_tool}/ install DESTDIR=${XDDESTDIR}
.endfor
_xi-includes:
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 par-includes \
DESTDIR=${XDDESTDIR}
_xi-libraries:
${_+_}cd ${.CURDIR}; ${CD2MAKE} -f Makefile.inc1 libraries \
DESTDIR=${XDDESTDIR}
_xi-links:
${_+_}cd ${XDDESTDIR}/usr/bin; \
for i in *; do \
ln -sf ../../${XDTP}/usr/bin/$$i \
../../../../usr/bin/${XDDIR}-$$i; \
ln -sf ../../${XDTP}/usr/bin/$$i \
../../../../usr/bin/${XDDIR}${OSREL}-$$i; \
done
.endif