o Add games/caesar to the list of bootstrap-tools so that a

buildworld doesn't break because the host doesn't have any
   games installed,
o  Add a new build stage: TMAKE. TMAKE builds all the build-tools
   targets in the respective makefiles. Note that these targets
   don't use the bootstrap tools,
o  Add elf2exe to the bootstrap-tools when cross-building Alpha on
   other platforms,
o  Add ${WORLDTMP}/usr/games to TMPPATH,
o  Remove ${WORLDTMP}/usr/bin even when NOCLEAN is defined. This
   prevents using any bootstrap-tools previously installed. Most
   importantly, it prevents using the cross-compiler when we still
   need the native compiler.

The current stages are BMAKE, TMAKE, XMAKE and IMAKE in that order.
BMAKE builds bootstrap-tools that either solve compatibility problems
      or are needed as cross-tools,
TMAKE builds the support tools necessary by some parts in the source
      tree and also performs the cleandir and par-obj targets,
XMAKE builds the includes, libraries and everything (resp.), and
IMAKE installs the world. This stage needs further work if it's to be
      used to install -current over -stable for example.

This is the last major update towards cross-building.
This commit is contained in:
Marcel Moolenaar 1999-12-16 13:47:34 +00:00
parent 35703ff899
commit bfc59eb8e0

View File

@ -106,6 +106,7 @@ SUP?= cvsup
SUPFLAGS?= -g -L 2 -P - SUPFLAGS?= -g -L 2 -P -
MAKEOBJDIRPREFIX?= /usr/obj MAKEOBJDIRPREFIX?= /usr/obj
TARGET_ARCH?= ${MACHINE_ARCH}
BUILD_ARCH!= sysctl -n hw.machine_arch BUILD_ARCH!= sysctl -n hw.machine_arch
.if ${BUILD_ARCH} == ${MACHINE_ARCH} .if ${BUILD_ARCH} == ${MACHINE_ARCH}
OBJTREE= ${MAKEOBJDIRPREFIX} OBJTREE= ${MAKEOBJDIRPREFIX}
@ -113,10 +114,11 @@ OBJTREE= ${MAKEOBJDIRPREFIX}
OBJTREE= ${MAKEOBJDIRPREFIX}/${MACHINE_ARCH} OBJTREE= ${MAKEOBJDIRPREFIX}/${MACHINE_ARCH}
.endif .endif
WORLDTMP= ${OBJTREE}${.CURDIR}/${BUILD_ARCH} WORLDTMP= ${OBJTREE}${.CURDIR}/${BUILD_ARCH}
STRICTTMPPATH= ${WORLDTMP}/bin:${WORLDTMP}/usr/bin # /usr/games added for fortune which depend on strfile and caesar.
STRICTTMPPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin:${WORLDTMP}/usr/games
TMPPATH= ${STRICTTMPPATH}:${PATH} TMPPATH= ${STRICTTMPPATH}:${PATH}
# bootstrap/tools make # bootstrap make
BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \ BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
DESTDIR=${WORLDTMP} \ DESTDIR=${WORLDTMP} \
INSTALL="sh ${.CURDIR}/tools/install.sh" \ INSTALL="sh ${.CURDIR}/tools/install.sh" \
@ -126,25 +128,31 @@ BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO \ BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO \
-DNO_FORTRAN -DNO_GDB -DNO_FORTRAN -DNO_GDB
# script/tool make
TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
INSTALL="sh ${.CURDIR}/tools/install.sh"
TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1
CROSSENV= COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ CROSSENV= COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \ LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib \
OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \
PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503 \ PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503
MAKEOBJDIRPREFIX=${OBJTREE}
# cross make used for compilation # cross make used for compilation
XMAKEENV= ${CROSSENV} \ XMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
${CROSSENV} \
DESTDIR=${WORLDTMP} \ DESTDIR=${WORLDTMP} \
INSTALL="sh ${.CURDIR}/tools/install.sh" \ INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${TMPPATH} PATH=${TMPPATH}
XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1
# cross make used for final installation # cross make used for final installation
IMAKEENV= ${CROSSENV} IMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
${CROSSENV}
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
USRDIRS= usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \ USRDIRS= usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
usr/libexec/${OBJFORMAT} usr/share/misc usr/libexec/${OBJFORMAT} usr/sbin usr/share/misc
.if ${MACHINE_ARCH} == "i386" && ${MACHINE} == "pc98" .if ${MACHINE_ARCH} == "i386" && ${MACHINE} == "pc98"
USRDIRS+= usr/libexec/aout USRDIRS+= usr/libexec/aout
@ -165,6 +173,9 @@ buildworld:
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
.if !defined(NOCLEAN) .if !defined(NOCLEAN)
rm -rf ${WORLDTMP} rm -rf ${WORLDTMP}
.else
rm -rf ${WORLDTMP}/usr/bin
rm -f ${WORLDTMP}/sys
.endif .endif
.for _dir in ${USRDIRS} .for _dir in ${USRDIRS}
mkdir -p ${WORLDTMP}/${_dir} mkdir -p ${WORLDTMP}/${_dir}
@ -172,27 +183,33 @@ buildworld:
.for _dir in ${INCDIRS} .for _dir in ${INCDIRS}
mkdir -p ${WORLDTMP}/usr/include/${_dir} mkdir -p ${WORLDTMP}/usr/include/${_dir}
.endfor .endfor
.if defined(NOCLEAN)
rm -f ${WORLDTMP}/sys
.endif
ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys ln -sf ${.CURDIR}/sys ${WORLDTMP}/sys
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Rebuilding tools" @echo ">>> Rebuilding bootstrap tools"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${BMAKE} tools cd ${.CURDIR}; ${BMAKE} bootstrap-tools
.if !empty(.MAKEFLAGS:M-j)
# Work-around for broken sh(1) hashing.
-hash -r
.endif
.if !defined(NOCLEAN) .if !defined(NOCLEAN)
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Cleaning up the object tree" @echo ">>> Cleaning up the object tree"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${XMAKE} ${CLEANDIR:S/^/par-/} cd ${.CURDIR}; ${TMAKE} ${CLEANDIR:S/^/par-/}
.endif .endif
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Rebuilding the object tree" @echo ">>> Rebuilding the object tree"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${XMAKE} par-obj cd ${.CURDIR}; ${TMAKE} par-obj
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Rebuilding build tools"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${TMAKE} build-tools
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Rebuilding ${WORLDTMP}/usr/include" @echo ">>> Rebuilding ${WORLDTMP}/usr/include"
@ -333,18 +350,34 @@ installmost:
# #
# #
# tools - Build tools needed to run the actual build. # bootstrap-tools - Build tools needed to run the actual build.
#
# WARNING: Because the bootstrap tools are expected to run on the
# build-machine, MACHINE_ARCH is *always* set to BUILD_ARCH when this
# target is being made. TARGET_ARCH is *always* set to reflect the
# target-machine (which you can set by specifying MACHINE_ARCH on
# make's command-line, get it?).
# The reason is simple: we build these tools not to be run on the
# architecture we're cross-building, but on the architecture we're
# currently building on (ie the host-machine) and we expect these
# tools to produce output for the architecture we're trying to
# cross-build.
# #
.if exists(${.CURDIR}/games) && !defined(NOGAMES) .if exists(${.CURDIR}/games) && !defined(NOGAMES)
_strfile= games/fortune/strfile _games_tools= games/caesar games/fortune/strfile
.endif .endif
.if ${MACHINE_ARCH} == "i386" && ${MACHINE} == "pc98" # XXX - MACHINE should actually be TARGET. But we don't set that...
.if ${TARGET_ARCH} == "i386" && ${MACHINE} == "pc98"
_aout_tools= usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld _aout_tools= usr.bin/size usr.bin/strip gnu/usr.bin/as gnu/usr.bin/ld
.endif .endif
tools:: .if ${TARGET_ARCH} == "alpha" && ${MACHINE_ARCH} != "alpha"
.for _tool in ${_strfile} ${_aout_tools} usr.bin/gensetdefs \ _elf2exe= usr.sbin/elf2exe
.endif
bootstrap-tools:
.for _tool in ${_games_tools} ${_aout_tools} ${_elf2exe} usr.bin/gensetdefs \
gnu/usr.bin/binutils usr.bin/objformat usr.bin/yacc usr.bin/colldef \ gnu/usr.bin/binutils usr.bin/objformat usr.bin/yacc usr.bin/colldef \
gnu/usr.bin/bison gnu/usr.bin/cc gnu/usr.bin/bison gnu/usr.bin/cc
cd ${.CURDIR}/${_tool}; \ cd ${.CURDIR}/${_tool}; \
@ -354,6 +387,23 @@ tools::
${MAKE} install ${MAKE} install
.endfor .endfor
#
# build-tools
#
.if exists(${.CURDIR}/games) && !defined(NOGAMES)
_games= games/adventure games/hack games/phantasia
.endif
.if exists(${.CURDIR}/share) && !defined(NOSHARE)
_share= share/syscons/scrnmaps
.endif
build-tools:
.for _tool in bin/sh ${_games} gnu/usr.bin/cc/cc_tools gnu/usr.bin/cc/f771 \
lib/libncurses ${_share}
cd ${.CURDIR}/${_tool}; ${MAKE} build-tools
.endfor
# #
# hierarchy - ensure that all the needed directories are present # hierarchy - ensure that all the needed directories are present
# #