More cross-building related changes:

o  Build tools before doing anything in or with the object tree.
o  Tools don't use the object tree any more, but have there object
   tree located in the temp. world.
o  Use the proper make env. for cleaning and building the object tree.
o  Don't create kernel include subdirectories in the temp. world. These
   are removed later on and replaced by symlinks.
o  Change the layout of the object tree:

The temp. world now is /usr/obj/${MACHINE_ARCH}${.CURDIR}/${BUILD_ARCH}.
/usr/obj can be set/changed by using MAKEOBJDIRPREFIX, and {.CURDIR}
obviously depends on where the source tree is located. MACHINE_ARCH
is the arch. for which the world is to be build and BUILD_ARCH is the
arch. on which we are building.

The object tree now is /usr/obj/${MACHINE_ARCH}${.CURDIR}.

This allows concurrent cross-builds and allows the object tree to be
shared on different archs., each doing the same cross-build. This of
course assumes that the output on Alpha (for example) is the same as
the output of an Alpha cross-build on i386 (for example).

The use of NOCLEAN is is still dangerous, but should be usable in many
more situations than before. It should now be possible to safely
restart an interrupted build with NOCLEAN without side-effects. Because
the tools don't share the object tree with the normal (cross-build), no
tools have to be rebuild.
This commit is contained in:
Marcel Moolenaar 1999-12-10 10:48:20 +00:00
parent 5fe1db5b0a
commit 0ea234de3c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=54392

View File

@ -105,48 +105,47 @@ CLEANDIR= cleandir
SUP?= cvsup SUP?= cvsup
SUPFLAGS?= -g -L 2 -P - SUPFLAGS?= -g -L 2 -P -
# MAKEOBJDIRPREFIX?= /usr/obj
# Define the location of the temporary installation directory. Note that BUILD_ARCH!= sysctl -n hw.machine_arch
# MAKEOBJDIRPREFIX normally isn't defined so if the current directory is OBJTREE= ${MAKEOBJDIRPREFIX}/${MACHINE_ARCH}
# /usr/src, then the world temporary directory is /usr/obj/usr/src/tmp. WORLDTMP= ${OBJTREE}${.CURDIR}/${BUILD_ARCH}
#
# During the transition from aout to elf format on i386, MAKEOBJDIRPREFIX
# is set by the parent makefile (Makefile.inc0) to be /usr/obj/${OBJFORMAT}
# in order to keep aout and elf format files apart.
#
.if defined(MAKEOBJDIRPREFIX)
WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
.else
WORLDTMP= /usr/obj${.CURDIR}/tmp
.endif
STRICTTMPPATH= ${WORLDTMP}/bin:${WORLDTMP}/usr/bin STRICTTMPPATH= ${WORLDTMP}/bin:${WORLDTMP}/usr/bin
TMPPATH= ${STRICTTMPPATH}:${PATH} TMPPATH= ${STRICTTMPPATH}:${PATH}
BUILD_ARCH!= sysctl -n hw.machine_arch # bootstrap/tools make
BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ DESTDIR=${WORLDTMP} \
INSTALL="sh ${.CURDIR}/tools/install.sh" \
TARGET_ARCH=${MACHINE_ARCH} \ TARGET_ARCH=${MACHINE_ARCH} \
MACHINE_ARCH=${BUILD_ARCH} \ MACHINE_ARCH=${BUILD_ARCH} \
PATH=${TMPPATH} PATH=${TMPPATH}
BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DNOMAN -DNOINFO \
-DNO_FORTRAN -DNO_GDB -DNO_OBJC
XMAKEENV= 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 \
CFLAGS="-nostdinc ${CFLAGS}" \ CFLAGS="-nostdinc ${CFLAGS}" \
PERL5LIB=${DESTDIR}/usr/libdata/perl/5.00503 \ PERL5LIB=${WORLDTMP}/usr/libdata/perl/5.00503 \
PATH=${TMPPATH} MAKEOBJDIRPREFIX=${OBJTREE}
# bootstrap make
BMAKE= ${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP} -DNOMAN -DNOINFO \
-DNO_FORTRAN -DNO_GDB -DNO_OBJC
# cross make used for compilation # cross make used for compilation
XMAKE= ${XMAKEENV} ${MAKE} DESTDIR=${WORLDTMP} \ XMAKEENV= ${CROSSENV} \
INSTALL="sh ${.CURDIR}/tools/install.sh" DESTDIR=${WORLDTMP} \
INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${TMPPATH}
XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1
# cross make used for final installation # cross make used for final installation
IXMAKE= ${XMAKEENV} ${MAKE} IMAKEENV= ${CROSSENV} \
DESTDIR=/usr1/release \
PATH=${STRICTTMPPATH}
IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
USRDIRS= usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
usr/libexec/${OBJFORMAT} usr/share/misc
INCDIRS= arpa g++/std objc protocols readline rpc rpcsvc security ss
# #
# buildworld # buildworld
@ -154,70 +153,67 @@ IXMAKE= ${XMAKEENV} ${MAKE}
# Attempt to rebuild the entire system, with reasonable chance of # Attempt to rebuild the entire system, with reasonable chance of
# success, regardless of how old your existing system is. # success, regardless of how old your existing system is.
# #
USRDIRS= usr/bin usr/lib/compat/aout usr/games usr/libdata/ldscripts \
usr/libexec/${OBJFORMAT} usr/share/misc
INCDIRS= arpa cam/scsi g++/std isofs/cd9660 machine msdosfs net \
netatalk netatm netgraph netinet netinet6 netipx netkey \
netncp netns nfs ntfs nwfs objc pccard posix4 protocols \
readline rpc rpcsvc security ss sys ufs/ffs ufs/mfs ufs/ufs vm
buildworld: buildworld:
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Cleaning up the temporary build tree" @echo ">>> Rebuilding the temporary build tree"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
.if !defined(NOCLEAN)
rm -rf ${WORLDTMP} rm -rf ${WORLDTMP}
.endif
.for _dir in ${USRDIRS} .for _dir in ${USRDIRS}
mkdir -p ${WORLDTMP}/${_dir} mkdir -p ${WORLDTMP}/${_dir}
.endfor .endfor
.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 ">>> Rebuilding tools"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${BMAKE} tools
.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}; ${BMAKE} -f Makefile.inc1 ${CLEANDIR:S/^/par-/} cd ${.CURDIR}; ${XMAKE} ${CLEANDIR:S/^/par-/}
.endif .endif
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Rebuilding the object tree" @echo ">>> Rebuilding the object tree"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 par-obj cd ${.CURDIR}; ${XMAKE} par-obj
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Rebuilding tools" @echo ">>> Rebuilding ${WORLDTMP}/usr/include"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${BMAKE} -f Makefile.inc1 -DNOINFO -DNOMAN tools cd ${.CURDIR}; ${XMAKE} includes
@echo
@echo "--------------------------------------------------------------"
@echo ">>> Rebuilding ${DESTDIR}/usr/include"
@echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 includes
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Rebuilding dependencies" @echo ">>> Rebuilding dependencies"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 par-depend cd ${.CURDIR}; ${XMAKE} par-depend
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Building libraries" @echo ">>> Building libraries"
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN -f Makefile.inc1 libraries cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Building everything.." @echo ">>> Building everything.."
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all cd ${.CURDIR}; ${XMAKE} all
everything: everything:
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo ">>> Building everything.." @echo ">>> Building everything.."
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
cd ${.CURDIR}; ${XMAKE} -f Makefile.inc1 all cd ${.CURDIR}; ${XMAKE} all
# #
# installworld # installworld
@ -225,7 +221,7 @@ everything:
# Installs everything compiled by a 'buildworld'. # Installs everything compiled by a 'buildworld'.
# #
installworld: installworld:
cd ${.CURDIR}; ${IXMAKE} -f Makefile.inc1 reinstall cd ${.CURDIR}; ${IMAKE} reinstall
# #
# reinstall # reinstall
@ -298,12 +294,6 @@ most:
cd ${.CURDIR}/gnu/libexec; ${MAKE} all cd ${.CURDIR}/gnu/libexec; ${MAKE} all
cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all
cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all
#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
# cd ${.CURDIR}/kerberosIV; ${MAKE} most
#.endif
#.if !defined(NOSECURE) && !defined(NOCRYPT)
# cd ${.CURDIR}/secure; ${MAKE} most
#.endif
# #
# installmost # installmost
@ -323,12 +313,6 @@ installmost:
cd ${.CURDIR}/gnu/libexec; ${MAKE} install cd ${.CURDIR}/gnu/libexec; ${MAKE} install
cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install
cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install
#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost
#.endif
#.if !defined(NOSECURE) && !defined(NOCRYPT)
# cd ${.CURDIR}/secure; ${MAKE} installmost
#.endif
# #
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
@ -344,15 +328,14 @@ installmost:
# #
# tools - Build tools needed to run the actual build. # tools - Build tools needed to run the actual build.
# #
tools: tools::
.for _tool in games/fortune/strfile gnu/usr.bin/binutils usr.bin/objformat \ .for _tool in games/fortune/strfile gnu/usr.bin/binutils usr.bin/objformat \
usr.bin/yacc gnu/usr.bin/bison gnu/usr.bin/cc usr.bin/yacc gnu/usr.bin/bison gnu/usr.bin/cc
cd ${.CURDIR}/${_tool}; \ cd ${.CURDIR}/${_tool}; \
${MAKE} obj; \
${MAKE} depend; \ ${MAKE} depend; \
${MAKE} all; \ ${MAKE} all; \
${MAKE} install; \ ${MAKE} install
${MAKE} cleandir; \
${MAKE} obj
.endfor .endfor
# #