Subject: Re: Build System Changes Backed Out
To: Chris G. Demetriou <cgd@pa.dec.com>
From: Ted Lemon <mellon@hoffman.vix.com>
List: current-users
Date: 06/01/1997 00:21:55
I actually hacked a build that builds the toolchain before building
the rest of the tree.   I don't claim it's perfect, and that's why I
didn't submit it, but FWIW, here it is:

safebuild:
.ifndef BUILD_ROOT
	echo BUILD_ROOT must be set before make safebuild.
.else
	echo ${MAKE} ${MFLAGS} DESTDIR=${BUILD_ROOT}
	${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} beforeinstall
.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
	(cd ${.CURDIR}/domestic/lib/libkrb; make krb_err.h)
	(cd ${.CURDIR}/domestic/lib/libkadm; make kadm_err.h)
	(cd ${.CURDIR}/domestic/lib/libss; make ss_err.h)
.endif
	${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} includes 
	${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} cleandir
	@-echo "Building first stage compiler tools..."
	(for tool in usr.bin/yacc usr.bin/nm usr.bin/lorder usr.bin/tsort \
		     gnu/usr.bin/gas usr.bin/lex usr.bin/make; do \
	    cd ${.CURDIR}/$$tool && \
	    ${MAKE} -m ${.CURDIR}/share/mk && \
	    ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} install; \
	 done)
	 (cd ${.CURDIR}/gnu/usr.bin/ld && \
	  ${MAKE} -m ${.CURDIR}/share/mk SUBDIR= && \
	  ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} SUBDIR= install)
	 (cd ${.CURDIR}/usr.bin/ar && \
	  ${MAKE} -m ${.CURDIR}/share/mk \
			CFLAGS="-O -nostdinc -I${BUILD_ROOT}/usr/include" && \
	  ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} install)
	@-echo "Building first stage compiler..."
	(PATH=${BUILD_ROOT}/usr/bin:$$PATH; export PATH; \
	 cd ${.CURDIR}/gnu/usr.bin/gcc && \
	 ${MAKE} -m ${.CURDIR}/share/mk && \
	 ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} install)
	(PATH=${BUILD_ROOT}/usr/bin:$$PATH; export PATH; \
	 INCLUDE_PATH=${BUILD_ROOT}/usr/include/; export INCLUDE_PATH; \
	 COMPILER_PATH=${BUILD_ROOT}/usr/libexec/; export INCLUDE_PATH; \
	 cd ${.CURDIR}/lib && \
	 ${MAKE} -m ${.CURDIR}/share/mk depend && \
	 ${MAKE} -m ${.CURDIR}/share/mk && \
	 ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} install)
	(PATH=${BUILD_ROOT}/usr/bin:$$PATH; export PATH; \
	 INCLUDE_PATH=${BUILD_ROOT}/usr/include/; export INCLUDE_PATH; \
	 COMPILER_PATH=${BUILD_ROOT}/usr/libexec/; export INCLUDE_PATH; \
	 cd ${.CURDIR}/gnu/lib && \
	 ${MAKE} -m ${.CURDIR}/share/mk depend && \
	 ${MAKE} -m ${.CURDIR}/share/mk && \
	 ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} install)
.if exists(domestic) && !defined(EXPORTABLE_SYSTEM)
	(PATH=${BUILD_ROOT}/usr/bin:$$PATH; export PATH; \
	 INCLUDE_PATH=${BUILD_ROOT}/usr/include/; export INCLUDE_PATH; \
	 COMPILER_PATH=${BUILD_ROOT}/usr/libexec/; export INCLUDE_PATH; \
	 cd ${.CURDIR}/domestic/lib/ && \
	 ${MAKE} -m ${.CURDIR}/share/mk depend && \
	 ${MAKE} -m ${.CURDIR}/share/mk && \
	 ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} install)
.endif
	@-echo Cleaning up first stage tool directories...
	(for tool in usr.bin/yacc usr.bin/nm usr.bin/lorder usr.bin/tsort \
		     gnu/usr.bin/gas gnu/usr.bin/gcc gnu/usr.bin/ld \
		     usr.bin/lex; do \
	    cd ${.CURDIR}/$$tool; \
	    ${MAKE} -m ${.CURDIR}/share/mk cleandir; \
         done)
	(PATH=${BUILD_ROOT}/usr/bin:$$PATH; export PATH; \
	 INCLUDE_PATH=${BUILD_ROOT}/usr/include/; export INCLUDE_PATH; \
	 COMPILER_PATH=${BUILD_ROOT}/usr/libexec/; export INCLUDE_PATH; \
	 LIBRARY_PATH=${BUILD_ROOT}/usr/lib; export LIBRARY_PATH; \
	 echo ${MAKE} -m ${.CURDIR}/share/mk depend && \
	 echo ${MAKE} -m ${.CURDIR}/share/mk && \
	 ${MAKE} -m ${.CURDIR}/share/mk DESTDIR=${BUILD_ROOT} install)
.endif