Makefile revision 79340
11556Srgrimes# $FreeBSD: head/release/Makefile 79340 2001-07-05 22:14:25Z bmah $
21556Srgrimes#
31556Srgrimes# make release CHROOTDIR=/some/dir BUILDNAME=somename CVSROOT=/cvs/dir \
41556Srgrimes#	[ RELEASETAG=tag ]
51556Srgrimes#
61556Srgrimes# Where "/some/dir" is the pathname of a directory on a some filesystem with
71556Srgrimes# at least 1000MB of free space, "somename" is what you want the release to
81556Srgrimes# call itself, "/cvs/dir" is where our source repo resides and, optionally,
91556Srgrimes# which CVS "tag" name should be used when checking out the sources to build
101556Srgrimes# the release (default is HEAD).
111556Srgrimes#
121556Srgrimes# Please note: the md(4) driver must be compiled into your kernel
131556Srgrimes# or available as a kld(4)-style kernel module,
141556Srgrimes# otherwise the target 'release.8' and possibly others will fail.
151556Srgrimes#
161556Srgrimes# Set these, release builder!
171556Srgrimes#
181556Srgrimes# Fixed version:
191556Srgrimes#BUILDNAME=5.0-RELEASE
201556Srgrimes#
211556Srgrimes# Automatic SNAP versioning:
221556SrgrimesDATE != date +%Y%m%d
231556SrgrimesBASE = 5.0
241556SrgrimesBUILDNAME?=${BASE}-${DATE}-SNAP
251556Srgrimes#
261556Srgrimes#CHROOTDIR=/junk/release
271556Srgrimes# If this is a -stable snapshot, then set
281556Srgrimes#RELEASETAG=RELENG_4
291556Srgrimes#
301556Srgrimes# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
311556Srgrimes# are building an official release.  Otherwise, we are building for
321556Srgrimes# a branch.
331556Srgrimes.if defined(RELEASETAG)
341556SrgrimesISRELEASE!=	expr ${RELEASETAG} : '^RELENG_.*_RELEASE$$' || true
3536049Scharnier.if ${ISRELEASE} != 0
3636049Scharnier# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
3736049ScharnierAUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
381556SrgrimesDOCRELEASETAG?=		${AUXRELEASETAG}
3999110SobrienPORTSRELEASETAG?=	${AUXRELEASETAG}
4099110Sobrien.endif
411556Srgrimes.endif
421556Srgrimes
431556SrgrimesKERNCONF=GENERIC
441556Srgrimes
4576286Skris# If you want to pass flags to the world build such as -j X, use
4676286Skris# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
4776286Skris# builds via KERNEL_FLAGS.
4876286Skris#WORLD_FLAGS=-j4
4976286Skris#KERNEL_FLAGS=-j4
501556Srgrimes
51104548Stjr# If you are using a local CVS repository with components stored in 
5276286Skris# non-standard modules, override these on the make commandline or
531556Srgrimes# in the environment.
5476286SkrisRELEASESRCMODULE?=	src
551556SrgrimesRELEASEDOCMODULE?=	doc
561556SrgrimesRELEASEPORTSMODULE?=	ports
5776351Skris
581556Srgrimes# Unless set elsewhere, indicate the object format we'll be using.
591556SrgrimesOBJFORMAT?=		elf
601556Srgrimes
611556Srgrimes# Uncomment this to disable the doc.1 target.  Docs normally require
621556Srgrimes# the ports tree, so NOPORTS can be set together with NODOC in order
631556Srgrimes# to have neither ports or docs.  If only NOPORTS is set to YES, but
641556Srgrimes# docs are still desired, the DOMINIMALDOCPORTS logic below will only
651556Srgrimes# install the ports that are minimally required for the docs.  This is
661556Srgrimes# intended as a compromise, less disk space is required than for using
671556Srgrimes# the entire ports collection (und much less time due to the huge number
68114583Smarkm# of directories it would create), but still quite a bit as well as some
69114583Smarkm# CPU cycles (some of the programs are C++, and things like ghostscript
70114583Smarkm# belong to the required ports nevertheless).
71114583Smarkm#
721556Srgrimes# Setting this also disables building of release note documentation
731556Srgrimes# (RELNOTESng).
741556Srgrimes#NODOC=  YES
751556Srgrimes#NOPORTS=  YES
761556Srgrimes
771556Srgrimes# Uncomment and modify this definition if you want the release notes 
781556Srgrimes# and other release documentation in a language other than English.
791556Srgrimes#RELNOTES_LANG=	en_US.ISO8859-1
801556Srgrimes
811556Srgrimes# As an alternative to installing the entire ports collection (which
821556Srgrimes# can take a huge amount of time, in particular on slower disks),
83114583Smarkm# setting ${MINIMALDOCPORTS} allows to install and build just those
8476286Skris# ports that are really required for getting the docs up & running.
85281661Seadler.if defined(NOPORTS) && !defined(NODOC)
861556SrgrimesDOMINIMALDOCPORTS=	YES
8790110Simp.include "Makefile.inc.docports"
8890110Simp.endif
891556Srgrimes
901556Srgrimes# Helper variable
911556Srgrimes.if defined(NOPORTS)
921556Srgrimes.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
931556SrgrimesNOPORTSATALL=	YES
941556Srgrimes.endif
951556Srgrimes.endif
961556Srgrimes
971556Srgrimes# Set ALLLANG=no if you want the documentation (e.g. Handbook, FAQ) to be
981556Srgrimes# in English only.  The language for the release notes is controlled
991556Srgrimes# by the RELNOTES_LANG variable above.
100114583SmarkmALLLANG?=	yes
1011556SrgrimesDOCPORTS=	textproc/docproj
10276019Skris# Set this to wherever the distfiles required by ${DOCPORTS} live.
1031556SrgrimesDOCDISTFILES?=	${.CURDIR}/../../ports/distfiles
1041556Srgrimes# Set this to 1 if you want -P to be used for automatic keyboard detection
1051556Srgrimes# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
1061556SrgrimesAUTO_KEYBOARD_DETECT?= 0
1071556Srgrimes
1081556Srgrimes.if !defined(NODOC)
1091556SrgrimesDIST_DOCS_ARCH_INDEP=	readme errata
1101556SrgrimesDIST_DOCS_ARCH_DEP=	installation relnotes hardware
1111556Srgrimes.endif
1121556Srgrimes
1131556Srgrimes# Things which without too much trouble can be considered variables
1141556Srgrimes# BIN_DISTS are special in that they get full /etc installation sets.
1151556Srgrimes#
1161556Srgrimes.if ${MACHINE_ARCH} == "i386"
1171556SrgrimesCOMPAT_DISTS?=	compat1x compat20 compat21 compat22 compat3x compat4x
1181556Srgrimes.else
119114583SmarkmCOMPAT_DISTS?=	compat4x
1201556Srgrimes.endif
12176017SkrisOTHER_DISTS?=	manpages catpages games proflibs dict info doc
12276286SkrisCRYPTO_DISTS?=	crypto krb4 krb5
12376286SkrisBIN_DISTS?=	bin
1241556SrgrimesDISTRIBUTIONS?=	${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
1251556SrgrimesKERNELS?=	GENERIC
1261556Srgrimes
1271556SrgrimesBOOT1=	etc/defaults/rc.conf
128114583Smarkm
1291556Srgrimes# mountpoint for filesystems.
13076017SkrisMNT=			/mnt
1311556Srgrimes
1321556Srgrimes# Various floppy image parameters.
13376286Skris#
13476286Skris
1351556Srgrimes.if ${MACHINE_ARCH} == "i386"
1361556Srgrimes.if ${MACHINE} == "pc98"
1371556SrgrimesSMALLBOOTSIZE=		1200
1381556SrgrimesBOOTSIZE=		1440
139114583SmarkmFIXITSIZE=		1440
1401556SrgrimesMFSSIZE=		2880
14176017SkrisBOOTINODE=		80000
1421556SrgrimesFIXITINODE=		4000
1431556SrgrimesMFSINODE=		8000
1441556SrgrimesSMALLBOOTLABEL=		fd1200
1451556SrgrimesBOOTLABEL=		fd1440
1461556SrgrimesFIXITLABEL=		fd1440
1471556SrgrimesMFSLABEL=		minimum2
148114583Smarkm.else
1491556SrgrimesBOOTSIZE=		1440
1501556SrgrimesFIXITSIZE=		1440
1511556SrgrimesMFSSIZE=		4320
1521556SrgrimesBIGBOOTSIZE=		2880
1531556SrgrimesBOOTINODE=		80000
1541556SrgrimesFIXITINODE=		4000
15576351SkrisMFSINODE=		8000
156131085SobrienBOOTLABEL=		fd1440
15776351SkrisFIXITLABEL=		fd1440
158131085SobrienMFSLABEL=		minimum3
159131085SobrienBIGBOOTLABEL=		minimum2
1601556Srgrimes.endif
1611556Srgrimes.elif ${MACHINE_ARCH} == "alpha"
1621556SrgrimesBOOTSIZE=		1440
1631556SrgrimesFIXITSIZE=		2880
16476017SkrisMFSSIZE=		2880
1651556SrgrimesBIGBOOTSIZE=		2880
1661556SrgrimesBOOTINODE=		80000
1671556SrgrimesFIXITINODE=		4000
1681556SrgrimesMFSINODE=		8000
1691556SrgrimesBOOTLABEL=		fd1440
1701556SrgrimesFIXITLABEL=		minimum2
17176017SkrisMFSLABEL=		minimum2
1721556SrgrimesBIGBOOTLABEL=		minimum2
1731556Srgrimes.endif
1741556Srgrimes
1751556SrgrimesZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
1761556Srgrimes
1771556Srgrimes# Things that need to be compiled without crypto support in releases
1781556Srgrimes.if !defined(FIXCRYPTO)
1791556SrgrimesFIXCRYPTO=	bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/tcpdump/tcpdump 
1801556Srgrimes.if !defined(NO_SENDMAIL)
1811556SrgrimesFIXCRYPTO+=	usr.sbin/sendmail
1821556Srgrimes.endif
1831556Srgrimes.endif
1841556Srgrimes
1851556Srgrimes
1861556Srgrimes# Things which may get you into trouble if you change them
1871556SrgrimesMTREEFILES=		${.CURDIR}/../etc/mtree
1881556Srgrimes_R=			/R
1891556SrgrimesRD=			${_R}/stage
1901556SrgrimesFD=			${_R}/ftp
1911556SrgrimesCD=			${_R}/cdrom
1921556SrgrimesCD_DISC1=		${CD}/disc1
1931556SrgrimesCD_DISC2=		${CD}/disc2
1941556Srgrimes
1951556Srgrimes# Where the bootstrap ports (see DOCPORTS) get installed.
1961556SrgrimesLOCALDIR=		/usr/local/bin
1971556Srgrimes
1981556Srgrimes# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
1991556Srgrimes# environment, rather than the target environment.  This is specifically
2001556Srgrimes# intended for kernel-dependent utilities that are used during the build.
2011556Srgrimes#
2021556Srgrimes# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
2031556Srgrimes# ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
2041556SrgrimesBOOTSTRAPDIR=	/bootstrap
2051556Srgrimes#
206222177Suqs# The mount subsystem has been changed between 2.2 and 3.0 by the
2071556Srgrimes# Lite2 import.
2081556SrgrimesBOOTSTRAPUTILS=	/sbin/mount /sbin/umount
2091556Srgrimes#
2101556Srgrimes# 3.0 cpio tries to reference lchown(2) which is not available in 2.2
2111556SrgrimesBOOTSTRAPUTILS+= /usr/bin/cpio
2121556Srgrimes
2131556Srgrimes.if !defined(CRUNCH_TARGETS)
2141556SrgrimesCRUNCH_TARGETS=	boot fixit
2151556Srgrimes.endif
2161556Srgrimes
2171556Srgrimes.if ${MACHINE} == "pc98"
2181556SrgrimesEXTRAS= ftp.1
2191556Srgrimes.else
2201556SrgrimesEXTRAS= cdrom.1 ftp.1
2211556Srgrimes.endif
2221556Srgrimes
2231556Srgrimes.if !defined(NODOC)
2241556SrgrimesDOCREL= doc.1 doc.2
2251556Srgrimes.endif
2261556Srgrimes
2271556Srgrimes.if !defined(NOPORTREADMES)
2281556SrgrimesMAKEREADMES=	make readmes PORTSDIR=${CHROOTDIR}/usr/ports
2291556Srgrimes.else
2301556SrgrimesMAKEREADMES=	true
2311556Srgrimes.endif
2321556Srgrimes
2331556Srgrimesrerelease release:
2341556Srgrimes.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
2351556Srgrimes	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
2361556Srgrimes.endif
2371556Srgrimes.if defined(NOPORTSATALL) && !defined(NODOC)
2381556Srgrimes	@echo "Ports are required for building the docs.  Either set NODOC or"
2391556Srgrimes	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
2401556Srgrimes	@exit 1
2411556Srgrimes.endif
2421556Srgrimes.if make(release)
2431556Srgrimes.if exists(${CHROOTDIR})
2441556Srgrimes# The first command will fail on a handful of files that have their schg
2451556Srgrimes# flags set.  But it greatly speeds up the next two commands.
2461556Srgrimes	-rm -rf ${CHROOTDIR} 2>/dev/null
2471556Srgrimes	-chflags -R noschg ${CHROOTDIR}/.
2481556Srgrimes	-rm -rf ${CHROOTDIR}
2491556Srgrimes.endif
2501556Srgrimes	mkdir -p ${CHROOTDIR}
2511556Srgrimes	@echo ">>> make release started on `LC_ALL=C TZ=GMT date`"
2521556Srgrimes	cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
2531556Srgrimes	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
2541556Srgrimes	if [ -f /etc/resolv.conf ]; then \
2551556Srgrimes		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
2561556Srgrimes	fi
2571556Srgrimes	cd ${.CURDIR}/.. && ${MAKE} installworld DESTDIR=${CHROOTDIR} NOMAN=1
2581556Srgrimes	mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
2591556Srgrimes	for i in ${BOOTSTRAPUTILS} ; do \
2601556Srgrimes		cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
2611556Srgrimes	done
2621556Srgrimes.if !defined(RELEASETAG)
2631556Srgrimes	cd ${CHROOTDIR}/usr && rm -rf src && \
2641556Srgrimes		cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
2651556Srgrimes.else
2661556Srgrimes	cd ${CHROOTDIR}/usr && rm -rf src && \
2671556Srgrimes		cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
2681556Srgrimes.endif
2691556Srgrimes.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
2701556Srgrimes	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
2711556Srgrimes.endif
2721556Srgrimes.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
27346684Skris	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
2741556Srgrimes.endif
2751556Srgrimes.if !defined(NOPORTS)
2761556Srgrimes.if defined(PORTSRELEASETAG)
2771556Srgrimes	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
2781556Srgrimes.else
2791556Srgrimes	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
2801556Srgrimes.endif
2811556Srgrimes.elif defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
2821556Srgrimes.if defined(PORTSRELEASETAG)
2831556Srgrimes	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
2841556Srgrimes.else
2851556Srgrimes	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${MINIMALDOCPORTS}
2861556Srgrimes.endif
2878855Srgrimes.endif
2881556Srgrimes.if !defined(NODOC)
2891556Srgrimes.if defined(DOCRELEASETAG)
2901556Srgrimes	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
2911556Srgrimes.else
2921556Srgrimes	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
2931556Srgrimes.endif
2941556Srgrimes	if [ -d ${DOCDISTFILES}/ ]; then \
2951556Srgrimes		cp -rp ${DOCDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
2961556Srgrimes	fi
2971556Srgrimes.endif
2981556Srgrimes.endif
2991556Srgrimes.if make(rerelease)
3001556Srgrimes.if !defined(RELEASENOUPDATE)
3011556Srgrimes.if !defined(RELEASETAG)
3021556Srgrimes	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d
303143447Sobrien.else
3041556Srgrimes	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
3051556Srgrimes.endif
3061556Srgrimes.if !defined(NOPORTS)
3071556Srgrimes	cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
3081556Srgrimes.endif
3091556Srgrimes.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
3101556Srgrimes	for i in ${MINIMALDOCPORTS}; do \
3111556Srgrimes		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q update -P -d ) ; \
3121556Srgrimes	done
3131556Srgrimes.endif
3141556Srgrimes.if !defined(NODOC)
3151556Srgrimes	cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
3161556Srgrimes.endif
3171556Srgrimes.endif
31876351Skris.endif
31976351Skris	# Add version information to those things that need it.
3201556Srgrimes	( cd ${CHROOTDIR}/usr/src/sys/conf && \
3211556Srgrimes	  mv newvers.sh foo && \
32276351Skris	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
3231556Srgrimes	echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
3241556Srgrimes	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
3251556Srgrimes	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
3261556Srgrimes	echo "set -ex"				>> ${CHROOTDIR}/mk
3271556Srgrimes	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${CHROOTDIR}/mk
3281556Srgrimes	echo "export CFLAGS='-O -pipe'"	>> ${CHROOTDIR}/mk
3291556Srgrimes	echo "export WITHOUT_X11=YES"		>> ${CHROOTDIR}/mk
3301556Srgrimes	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
3311556Srgrimes	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
3321556Srgrimes	echo "export OBJFORMAT=${OBJFORMAT}"	>> ${CHROOTDIR}/mk
3331556Srgrimes.if defined(RELEASETAG)
3341556Srgrimes	echo "export RELEASETAG=${RELEASETAG}"	>> ${CHROOTDIR}/mk
33576286Skris.endif
33676286Skris.if defined(NOPORTS)
33776286Skris	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
33876286Skris.endif
339143447Sobrien.if defined(DOMINIMALDOCPORTS)
34076286Skris	echo "export DOMINIMALDOCPORTS=${DOMINIMALDOCPORTS}" >> ${CHROOTDIR}/mk
34176286Skris.endif
3421556Srgrimes.if defined(NODOC)
3431556Srgrimes	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
344143447Sobrien.endif
345143447Sobrien.if defined(ALLLANG) && ${ALLLANG} != "NO" && ${ALLLANG} != "no"
346143447Sobrien	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
347143447Sobrien.else
3481556Srgrimes	echo "export DOC_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
34976351Skris.endif
3501556Srgrimes.if defined(NOSRC)
35176351Skris	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
3521556Srgrimes.endif
3531556Srgrimes.if defined(RELNOTES_LANG)
3541556Srgrimes	echo "export RELNOTES_LANG=${RELNOTES_LANG}"	>> ${CHROOTDIR}/mk
3551556Srgrimes.else
3561556Srgrimes	echo "export RELNOTES_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
3571556Srgrimes.endif
3581556Srgrimes.if defined(NOSHARED)
3591556Srgrimes	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
3601556Srgrimes.endif
3611556Srgrimes.if defined(BOOT_CONFIG)
3621556Srgrimes	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
3631556Srgrimes.endif
3641556Srgrimes.if defined(KERNEL_FLAGS)
3651556Srgrimes	echo "export KERNEL_FLAGS=\"${KERNEL_FLAGS}\"" >> ${CHROOTDIR}/mk
3661556Srgrimes.endif
3671556Srgrimes	# Don't remove this, or the build will fall over!
3681556Srgrimes	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
3691556Srgrimes	echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
3701556Srgrimes	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
3711556Srgrimes	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
3721556Srgrimes.if make(release)
3731556Srgrimes	echo "	(cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
3741556Srgrimes	echo "	make ${WORLD_FLAGS} world && \\"	>> ${CHROOTDIR}/mk
3751556Srgrimes.endif
3761556Srgrimes.if make(rerelease)
37776351Skris	echo "	make ${WORLD_FLAGS} all install && \\" >> ${CHROOTDIR}/mk
3781556Srgrimes.endif
3791556Srgrimes	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
3801556Srgrimes	echo "fi"				>> ${CHROOTDIR}/mk
3811556Srgrimes	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
3821556Srgrimes	echo "make obj"				>> ${CHROOTDIR}/mk
383222177Suqs	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
3841556Srgrimes	echo "echo \">>> make ${.TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
3851556Srgrimes	chmod 755 ${CHROOTDIR}/mk
3861556Srgrimes	chroot ${CHROOTDIR} /mk
3871556Srgrimes
38876351Skrisclean:
389104548Stjr	rm -rf boot_crunch release.[0-9]
3901556Srgrimes
391104548Stjr# Clean out ${_R} and make the directory structure.
392104548Stjrrelease.1:
3931556Srgrimes	mkdir -p ${_R}
39476351Skris	-rm -rf ${_R}/* 2> /dev/null
3951556Srgrimes	-chflags -R noschg ${_R}/.
3961556Srgrimes	rm -rf ${_R}/*
3971556Srgrimes	mkdir ${RD}
3981556Srgrimes	mkdir ${RD}/floppies
39976351Skris	mkdir ${RD}/trees
400104548Stjr	mkdir ${RD}/dists
401104548Stjr	mkdir ${RD}/kernels
40276351Skris	for i in ${DISTRIBUTIONS} ; do \
40376351Skris		mkdir ${RD}/trees/$$i && \
4041556Srgrimes		mkdir ${RD}/dists/$$i && \
40576019Skris		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
406104548Stjr		    -p ${RD}/trees/$$i > /dev/null && \
4071556Srgrimes		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
408104548Stjr		    -p ${RD}/trees/$$i/usr > /dev/null && \
409104548Stjr		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
410104548Stjr		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
4111556Srgrimes		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
41276351Skris		    -p ${RD}/trees/$$i/var > /dev/null ; \
4131556Srgrimes	done
4141556Srgrimes	touch release.1
4151556Srgrimes
4161556Srgrimes# Install the system into the various distributions.
4171556Srgrimesrelease.2:
4181556Srgrimes	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
4191556Srgrimes	cd ${.CURDIR}/.. && make distribworld DISTDIR=${RD}/trees
4201556Srgrimes.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
4211556Srgrimes	cd ${.CURDIR}/../kerberosIV && ( \
4221556Srgrimes		make bootstrap &&\
4231556Srgrimes		make obj all help-distribute DISTDIR=${RD}/trees &&\
4241556Srgrimes		make kprog \
4251556Srgrimes	)
42690113Simp.endif
4271556Srgrimes.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
4281556Srgrimes	cd ${.CURDIR}/../kerberos5 && ( \
4291556Srgrimes		make bootstrap &&\
4301556Srgrimes		make obj all help-distribute DISTDIR=${RD}/trees &&\
4311556Srgrimes		make kprog \
4321556Srgrimes	)
4331556Srgrimes.endif
4341556Srgrimes	-chflags -R noschg ${RD}/trees
4351556Srgrimes	touch release.2
4361556Srgrimes
4371556Srgrimes# Make and install the generic kernel(s).
4381556Srgrimesrelease.3:
4391556Srgrimes.for kernel in ${KERNELS}
4401556Srgrimes	-chflags -R noschg ${RD}/kernels/${kernel}
4411556Srgrimes	rm -rf ${RD}/kernels/${kernel}
4421556Srgrimes	rm -rf ${.CURDIR}/../sys/${MACHINE}/compile/${kernel}
4431556Srgrimes	cd ${.CURDIR} && ${MAKE} doSTDKERNEL KERNEL=${kernel} KODIR=/${kernel}
4441556Srgrimes	rm -rf ${.CURDIR}/../sys/${MACHINE}/compile/${kernel}
4451556Srgrimes	-mkdir ${RD}/trees/bin/boot/${kernel}
4461556Srgrimes	cp -p ${RD}/kernels/${kernel}/kernel ${RD}/trees/bin/boot/${kernel}
4471556Srgrimes.endfor
4481556Srgrimes	# Install a standard boot kernel+modules
4491556Srgrimes	mkdir -p ${RD}/trees/bin/boot/kernel
4501556Srgrimes	cp -Rp ${RD}/kernels/GENERIC/* ${RD}/trees/bin/boot/kernel
4511556Srgrimes	touch release.3
4521556Srgrimes
4531556Srgrimes# Make and install the three crunched binaries which live on the floppies.
4541556Srgrimes# You are not supposed to like this :-)
4551556Srgrimesrelease.4:
4561556Srgrimes	@mkdir -p /stand
4571556Srgrimes	rm -rf ${RD}/crunch
4581556Srgrimes	mkdir -p ${RD}/crunch
4591556Srgrimes	for j in ${CRUNCH_TARGETS} ; do \
4601556Srgrimes		rm -rf $${j}_crunch && \
4611556Srgrimes		mkdir $${j}_crunch && \
4621556Srgrimes		( cd $${j}_crunch && \
4631556Srgrimes		  ( ( [ -f ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ] && \
4641556Srgrimes		    crunchgen ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ) || \
4658855Srgrimes		    ( crunchgen ${.CURDIR}/$${j}_crunch.conf ) ) && \
4668855Srgrimes		  ${MAKE} -f $${j}_crunch.mk subclean all ) && \
4671556Srgrimes		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
4681556Srgrimes		true || { rm -rf $${j}_crunch ; false ; } ; \
4691556Srgrimes	done
4701556Srgrimes	touch release.4
4711556Srgrimes
4721556Srgrimes#
4731556Srgrimes# --==## Fix up the distributions. ##==--
4741556Srgrimes#
4751556Srgrimesrelease.5:
4761556Srgrimes	# Handle some grief caused by the munition braindeadness.
4771556Srgrimes	for i in ${FIXCRYPTO}; do \
47876017Skris		( cd ${.CURDIR}/../$$i; \
4791556Srgrimes		  make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
4801556Srgrimes	done
4811556Srgrimes
4821556Srgrimes	# Create any "synthetic dists" now.
4831556Srgrimes	@for i in ${DISTRIBUTIONS}; do \
4841556Srgrimes		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
4851556Srgrimes			echo -n "Running $$i dist creation script... "; \
4861556Srgrimes			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
4878855Srgrimes			echo "Done."; \
4881556Srgrimes		fi \
4891556Srgrimes	done \
4901556Srgrimes
4911556Srgrimes	# Remove all the directories we don't need.
4921556Srgrimes	-cd ${RD}/trees && \
4931556Srgrimes		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
4941556Srgrimes	touch release.5
4951556Srgrimes
4961556Srgrimes#
49776017Skris# --==## Package up the tarballs from assembled trees ##==--
4981556Srgrimes#
4991556Srgrimesrelease.6:
5001556Srgrimes	rm -rf ${RD}/dists
5011556Srgrimes	mkdir -p ${RD}/dists
5021556Srgrimes	@for i in ${DISTRIBUTIONS} ; \
50376017Skris	do \
5041556Srgrimes		if [ -d ${RD}/trees/$${i} ] ; then \
5051556Srgrimes			cd ${.CURDIR} && $(MAKE) doTARBALL \
5061556Srgrimes				SD=${RD}/trees/$${i} \
5071556Srgrimes				TN=$$i TD=$$i ARG="." && \
5081556Srgrimes			echo "$${i} distribution is finished."; \
5091556Srgrimes		fi ; \
5101556Srgrimes	done
5111556Srgrimes	# More munition braindeadness.
5121556Srgrimes	( cd ${RD}/dists && \
5131556Srgrimes		if [ -f krb4/krb4.aa ] ; then \
5141556Srgrimes			mv krb4/krb4.* crypto && \
5151556Srgrimes			cat krb4/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
5161556Srgrimes			rm -r krb4; \
5171556Srgrimes		fi )
51890113Simp	( cd ${RD}/dists && \
5191556Srgrimes		if [ -f krb5/krb5.aa ] ; then \
52090113Simp			mv krb5/krb5.* crypto && \
5211556Srgrimes			cat krb5/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
5221556Srgrimes			rm -r krb5; \
5231556Srgrimes		fi )
5241556Srgrimes	touch release.6
5251556Srgrimes
5261556Srgrimes
5271556Srgrimes#
5281556Srgrimes# --==## Make source dists ##==--
5291556Srgrimes#
5301556Srgrimesrelease.7:
5311556Srgrimes.if !defined(NOSRC)
5321556Srgrimes	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
5331556Srgrimes		TD=src TN=sbase ARG="[A-Z]*"
5341556Srgrimes	@for i in `cd /usr/src && echo [a-z]*` ; do \
5351556Srgrimes		if [ -d /usr/src/$$i ] ; then \
5361556Srgrimes			cd ${.CURDIR} && $(MAKE) doTARBALL \
5371556Srgrimes				TN=`echo s$$i | tr -d '.' | \
5381556Srgrimes				    sed -e 's/usr/u/' \
5391556Srgrimes					-e 's/kerberosIV/krb4/' \
5401556Srgrimes					-e 's/kerberos5/krb5/'` \
5411556Srgrimes				SD=/usr/src TD=src ARG="$$i" ; \
5421556Srgrimes		fi ; \
5431556Srgrimes	done
5441556Srgrimes.if defined(EXTRA_SRC)
5451556Srgrimes	@set ${EXTRA_SRC} && \
5461556Srgrimes	while [ $$# -ge 2 ] ; do \
5471556Srgrimes		if [ -d /usr/src/$$1 ] ; then \
5481556Srgrimes			cd ${.CURDIR} && $(MAKE) doTARBALL \
5491556Srgrimes				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
5501556Srgrimes		fi && shift && shift ; \
5511556Srgrimes	done
5521556Srgrimes.endif
5531556Srgrimes	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
5541556Srgrimes		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
5551556Srgrimes		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
5561556Srgrimes		if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
5571556Srgrimes		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
5581556Srgrimes		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
5591556Srgrimes		md5 * > CHECKSUM.MD5 ) ; fi
5601556Srgrimes	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
5611556Srgrimes	@echo "src distribution is finished."
5621556Srgrimes.endif
5631556Srgrimes	touch release.7
5641556Srgrimes
5651556Srgrimes# Complete the bootfd
5661556Srgrimes#
5671556Srgrimes# Now, just to get this picture down once and for all:
5681556Srgrimes#
5691556Srgrimes# +------------------------------------------------------------------------+
5701556Srgrimes# |boot.flp                                                                |
5711556Srgrimes# +-----+-----+------------------------------------------------------------+
5721556Srgrimes# |boot1|boot2|floppy filesystem "bootfd"                                  |
5731556Srgrimes# +-----+-----+-+--------------------------------------------------------+-+
5741556Srgrimes#               |kernel                                                  |
5751556Srgrimes#               +------------+-----------------------------------------+-+
5761556Srgrimes#                            |mfs filesystem "mfsfd"                   |
5771556Srgrimes#                            +-----------------------------------------+
5781556Srgrimes#
5791556Srgrimes
5801556Srgrimesrelease.8: write_mfs_in_kernel
5811556Srgrimes	rm -rf ${RD}/mfsfd
5821556Srgrimes	mkdir ${RD}/mfsfd
58376017Skris	cd ${RD}/mfsfd && \
5841556Srgrimes		mkdir -p etc/defaults dev mnt stand/help
58576017Skris	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
5861556Srgrimes		DIR=${RD}/mfsfd/stand ZIP=false
5878855Srgrimes	( cd ${RD}/trees/bin/dev && \
5881556Srgrimes		ls console tty bpf0 ttyd0 ttyv0 ttyv1 ttyv2 ttyv3 null zero card0 card1 card2 card3 usb usb0 uhid0 ums0 ulpt0 ugen0 kbd0 kmem mem | \
5891556Srgrimes	cpio -dump ${RD}/mfsfd/dev )
5901556Srgrimes	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
5911556Srgrimes	( cd ${RD}/mfsfd && \
5921556Srgrimes	  for dir in bin sbin ; do \
5931556Srgrimes		ln -sf /stand $$dir; \
5941556Srgrimes	  done )
5951556Srgrimes	cp /sbin/dhclient-script ${RD}/mfsfd/stand
5961556Srgrimes	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
597222177Suqs	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
5981556Srgrimes	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
5991556Srgrimes	( for F in netconfig protocols ; do \
6001556Srgrimes		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
60190113Simp		${RD}/trees/bin/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
6021556Srgrimes	  done )
60390113Simp	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
6041556Srgrimes	    ${.CURDIR}/../etc/services | \
6051556Srgrimes	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
6061556Srgrimes	    > ${RD}/mfsfd/stand/etc/services
6071556Srgrimes	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
6081556Srgrimes	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
6091556Srgrimes	gzip -9c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
6101556Srgrimes.if !defined(NODOC)
6111556Srgrimes	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
6121556Srgrimes	  gzip -9c ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
6131556Srgrimes	done
6141556Srgrimes	@for i in ${DIST_DOCS_ARCH_DEP}; do \
6151556Srgrimes	  gzip -9c ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
6161556Srgrimes	done
6171556Srgrimes	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT.gz ${RD}/mfsfd/stand/help/INSTALL.TXT.gz
6181556Srgrimes.endif
6191556Srgrimes	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
6201556Srgrimes	@mkdir -p ${RD}/mfsfd/boot
6211556Srgrimes	@cp /boot/boot* ${RD}/mfsfd/boot
6221556Srgrimes	@cp /boot/loader.help ${RD}/mfsfd/boot
6231556Srgrimes	@cd ${.CURDIR} && ${MAKE} createBOOTMFS 
6241556Srgrimes.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
6251556Srgrimes	@cd ${.CURDIR} && ${MAKE} doMODULES KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
6261556Srgrimes.endif
6271556Srgrimes	@echo "Making the regular boot floppy."
6281556Srgrimes	@tar --exclude CVS -cf - -C /usr/src/usr.sbin/sysinstall help | \
6291556Srgrimes		tar xf - -C ${RD}/mfsfd/stand
6301556Srgrimes	@echo "Compressing doc files..."
6311556Srgrimes	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
6321556Srgrimes.if ${MACHINE_ARCH} == "alpha"
6331556Srgrimes	rm -rf ${RD}/mfsfd/stand/help/*
6341556Srgrimes.endif
6351556Srgrimes.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
6361556Srgrimes	@mkdir -p ${RD}/mfsfd/stand/modules
6371556Srgrimes	@perl ${.CURDIR}/scripts/driver-copy2.pl \
6381556Srgrimes		${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
6391556Srgrimes		${RD}/kernels ${RD}/mfsfd/stand/modules
6401556Srgrimes.endif
6411556Srgrimes	sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
6421556Srgrimes		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
6431556Srgrimes	@gzip -9vc mfsroot > mfsroot.gz
6441556Srgrimes.if ${MACHINE} == "pc98"
6451556Srgrimes	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
6461556Srgrimes		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
6471556Srgrimes		${BOOTINODE} ${SMALLBOOTLABEL}
6481556Srgrimes	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
6491556Srgrimes	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
6501556Srgrimes.else
6511556Srgrimes	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
6521556Srgrimes		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
6531556Srgrimes	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
6541556Srgrimes	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
6551556Srgrimes.endif
6561556Srgrimes	@rm mfsroot mfsroot.gz mfsroot.size
65776017Skris	@echo "Regular and MFS boot floppies made."
6581556Srgrimes	touch release.8
6591556Srgrimes
6601556Srgrimes#
6611556Srgrimes# --==## Create a fixit floppy ##==--
6621556Srgrimes#
6631556Srgrimesrelease.9:
6641556Srgrimes	@echo "Making fixit floppy."
6651556Srgrimes	@rm -rf ${RD}/fixitfd
6661556Srgrimes	@mkdir ${RD}/fixitfd
6671556Srgrimes	@cd ${RD}/fixitfd && \
6681556Srgrimes		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
6691556Srgrimes		usr/share/misc
6701556Srgrimes	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
6711556Srgrimes		DIR=${RD}/fixitfd/stand ZIP=false
6721556Srgrimes	@( cd ${RD}/fixitfd/dev && \
6731556Srgrimes		cp ${RD}/trees/bin/dev/MAKEDEV MAKEDEV && \
6741556Srgrimes		chmod 755 MAKEDEV && \
6751556Srgrimes		sh MAKEDEV fixit )
6761556Srgrimes	@cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
6771556Srgrimes		${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
6781556Srgrimes	@cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
67946684Skris		${RD}/fixitfd/usr/share/misc
6801556Srgrimes	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
681222177Suqs	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
6821556Srgrimes	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
6831556Srgrimes	@chmod 555 ${RD}/fixitfd/stand/tar
6841556Srgrimes	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
6851556Srgrimes		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
6861556Srgrimes# Do our last minute floppies directory setup in a convenient place.
6871556Srgrimes.if !defined(NODOC)
6881556Srgrimes	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/readme/article.txt \
6891556Srgrimes		${RD}/floppies/README.TXT
6901556Srgrimes	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
6911556Srgrimes.else
6921556Srgrimes	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
6931556Srgrimes.endif
6941556Srgrimes	touch release.9
69576017Skris
6961556Srgrimes#
6971556Srgrimes# --==## Setup a suitable ftp-area ##==--
6988855Srgrimes#
6998855Srgrimesftp.1:
70076017Skris	@echo "Setting up FTP distribution area"
7011556Srgrimes	@mkdir -p ${FD}
70276017Skris	-@ln -s . ${FD}/${BUILDNAME}
7031556Srgrimes	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
70476017Skris	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
7051556Srgrimes.if !defined(NODOC)
70676017Skris	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
7071556Srgrimes	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
7081556Srgrimes	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
7091556Srgrimes	done
7101556Srgrimes	@for i in ${DIST_DOCS_ARCH_DEP}; do \
7111556Srgrimes	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
7121556Srgrimes	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
7131556Srgrimes	done
7141556Srgrimes	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/readme/docbook.css ${FD}
7151556Srgrimes	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
7161556Srgrimes	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
7171556Srgrimes.endif
7181556Srgrimes	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
7191556Srgrimes.if !defined(NOPORTS)
7201556Srgrimes	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
7211556Srgrimes.endif
7221556Srgrimes	touch ftp.1
7231556Srgrimes
72476019Skris#
7251556Srgrimes# --==## Setup a suitable cdrom-area ##==--
7261556Srgrimes#
7271556Srgrimescdrom.1:
728108533Sschweikh	@echo "Setting up CDROM distribution area"
729108533Sschweikh	@mkdir -p ${CD_DISC1} ${CD_DISC2}
7301556Srgrimes	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
7311556Srgrimes	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
7321556Srgrimes	@ln -f ${RD}/kernels/MFSKERNEL.boot ${CD_DISC1}/kernel
7331556Srgrimes	@for i in ${DISTRIBUTIONS} ; \
7341556Srgrimes	do \
73576017Skris		if [ -d ${RD}/trees/$${i} ] ; then \
7361556Srgrimes			chflags -R noschg ${RD}/trees/$${i} || true ; \
7371556Srgrimes			( cd ${RD}/trees/$${i} && \
7381556Srgrimes			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
7391556Srgrimes		fi \
7401556Srgrimes	done
7411556Srgrimes	@rm -f ${CD_DISC2}/.profile
7421556Srgrimes	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
7431556Srgrimes	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
7441556Srgrimes	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
7451556Srgrimes.if !defined(NODOC)
7461556Srgrimes	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
74746684Skris	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
7481556Srgrimes	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
7491556Srgrimes	done
7501556Srgrimes	@for i in ${DIST_DOCS_ARCH_DEP}; do \
7511556Srgrimes	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
7521556Srgrimes	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
7531556Srgrimes	done
7541556Srgrimes	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
7551556Srgrimes	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
7561556Srgrimes	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
7571556Srgrimes.endif
7581556Srgrimes.if ${MACHINE_ARCH} == "alpha"
7591556Srgrimes	@echo "Setting up Alpha CD disc1 for booting"
7601556Srgrimes	@cp -Rp ${RD}/image.boot/boot ${CD_DISC1}
7611556Srgrimes	@ln -f ${CD_DISC2}/boot/cdboot ${CD_DISC1}/boot
7621556Srgrimes	@ln -f ${CD_DISC1}/boot/loader.rc ${CD_DISC2}/boot
7631556Srgrimes	@ln -f ${CD_DISC1}/kernel ${CD_DISC2}/kernel
7641556Srgrimes.endif
7651556Srgrimes.if !defined(NOPORTS)
7661556Srgrimes	@-rm -rf /usr/ports/distfiles/*
7671556Srgrimes	@mkdir -p ${CD_DISC1}/ports && \
7681556Srgrimes	  tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
7691556Srgrimes	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
7701556Srgrimes	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
7711556Srgrimes.endif
7721556Srgrimes	touch cdrom.1
7731556Srgrimes
7748855Srgrimes#
7751556Srgrimes# --==## Documentation Project files such as the Handbook and FAQ ##==--
7761556Srgrimes#
7771556Srgrimesdoc.1:
7781556Srgrimes	@echo "Making docs..."
7791556Srgrimes	@for i in ${DOCPORTS}; do \
7801556Srgrimes	  cd /usr/ports/$$i && make all install clean JADETEX=no FORCE_PKG_REGISTER=yes; \
7811556Srgrimes	done
7821556Srgrimes	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc
7831556Srgrimes	touch doc.1
7841556Srgrimes
7851556Srgrimes#
7861556Srgrimes# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
78776017Skris#
7881556Srgrimesdoc.2:
7891556Srgrimes	@echo "Making release documentation..."
79076017Skris	@cd ${.CURDIR}/doc && make all 'FORMATS=html txt'
7911556Srgrimes	touch doc.2
7921556Srgrimes
7931556Srgrimes# Various "subroutine" and other supporting targets.
7941556Srgrimes
7951556Srgrimes# RD=
796222177Suqs# SD=
7971556Srgrimes# TD=
7981556Srgrimes# ARG=
7991556SrgrimesdoTARBALL:
8001556Srgrimes.if !defined(SD)
8011556Srgrimes	@echo "SD undefined in doTARBALL" && exit 1
8021556Srgrimes.endif
8031556Srgrimes.if !defined(TD)
8041556Srgrimes	@echo "TD undefined in doTARBALL" && exit 1
8051556Srgrimes.endif
8061556Srgrimes.if !defined(ARG)
8071556Srgrimes	@echo "ARG undefined in doTARBALL" && exit 1
8081556Srgrimes.endif
8091556Srgrimes	@rm -rf ${RD}/dists/${TD}/${TN}*
8101556Srgrimes	@mkdir -p ${RD}/dists/${TD}
8111556Srgrimes	@( cd ${SD} && \
8121556Srgrimes		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
8131556Srgrimes		echo rolling ${TD}/$$tn tarball &&\
8141556Srgrimes		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
815222177Suqs		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
8161556Srgrimes		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
8171556Srgrimes		   ${RD}/dists/${TD}/$$tn.inf && \
8181556Srgrimes		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
8191556Srgrimes		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
8201556Srgrimes		fi && \
8211556Srgrimes		if [ "${SD}" != "/usr/src" ]; then \
8221556Srgrimes			mtree -c -i -p ${SD}/${ARG} \
8231556Srgrimes			  -k gname,md5digest,mode,nlink,uname,size,link,type \
824222177Suqs			  > ${RD}/dists/${TD}/$$tn.mtree ; \
8251556Srgrimes		else \
8268855Srgrimes			true; \
8271556Srgrimes		fi; \
8281556Srgrimes		(cd ${RD}/dists/${TD}; \
8291556Srgrimes		   rm -f CHECKSUM.MD5; \
8301556Srgrimes		   md5 * > CHECKSUM.MD5) \
8311556Srgrimes	)
8321556Srgrimes
8338855SrgrimesdoRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
8341556Srgrimes		release.6 release.7 release.8 release.9
8351556Srgrimes	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
8361556Srgrimes	@echo "Release done"
8371556Srgrimes
8381556Srgrimesfloppies:
8391556Srgrimes	@cd ${.CURDIR} && ${MAKE} boot.flp
8401556Srgrimes	@cd ${.CURDIR} && ${MAKE} fixit.flp
8411556Srgrimes	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
8421556Srgrimes
8431556Srgrimesboot.flp:
8441556Srgrimes	@rm -f release.4 release.8
8451556Srgrimes	@cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
8461556Srgrimes
84776017Skrisfixit.flp:
8481556Srgrimes	@rm -f release.4 release.9
8491556Srgrimes	@cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
8501556Srgrimes
8511556Srgrimeswrite_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
8521556Srgrimes	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
8531556Srgrimes
8541556SrgrimesinstallCRUNCH:
8551556Srgrimes.if !defined(CRUNCH)
8561556Srgrimes	@echo "CRUNCH undefined in installCRUNCH" && exit 1
8571556Srgrimes.endif
8581556Srgrimes.if !defined(DIR)
8591556Srgrimes	@echo "DIR undefined in installCRUNCH" && exit 1
8601556Srgrimes.endif
8611556Srgrimes.if !defined(ZIP)
8621556Srgrimes	@echo "ZIP undefined in installCRUNCH" && exit 1
8631556Srgrimes.endif
8641556Srgrimes	@if ${ZIP} ; then \
8651556Srgrimes		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
8661556Srgrimes	else \
86776019Skris		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
86890113Simp	fi
8691556Srgrimes	@chmod 555 ${DIR}/${CRUNCH}_crunch
8701556Srgrimes	@if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \
8711556Srgrimes		for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \
8721556Srgrimes			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
8731556Srgrimes		done \
8741556Srgrimes	else \
8751556Srgrimes		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
8761556Srgrimes			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
8771556Srgrimes		done \
8788855Srgrimes	fi
8791556Srgrimes
8801556Srgrimes#
8811556Srgrimes# --==## BOOTMFS config file ##==--
8821556Srgrimes#
88376017Skris
8841556SrgrimescreateBOOTMFS:
8851556Srgrimes	@cd ${.CURDIR}/../sys/${MACHINE}/conf && \
8861556Srgrimes	  sh ${.CURDIR}/scripts/dokern.sh ${FDSIZE} < ${KERNCONF} > BOOTMFS && \
8871556Srgrimes	  [ -r ${KERNCONF}.hints ] && cp ${KERNCONF}.hints BOOTMFS.hints
8881556Srgrimes.if 0 && ${MACHINE_ARCH} == "i386"
8891556Srgrimes	@echo "options  INTRO_USERCONFIG" >> \
8901556Srgrimes	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
8911556Srgrimes.endif
8921556Srgrimes.if defined(FDSIZE) && ${FDSIZE} == "BIG"
8931556Srgrimes	@echo "options MD_ROOT_SIZE=`cat mfsroot.size`" >> \
8941556Srgrimes	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
8951556Srgrimes.endif
8961556Srgrimes.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
8971556Srgrimes	@perl ${.CURDIR}/scripts/driver-remove.pl \
8981556Srgrimes		${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
8991556Srgrimes		${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
9001556Srgrimes.endif
90176017Skris
9021556Srgrimes#
9031556Srgrimes# --==## Compile a kernel by name ${KERNEL} ##==--
9041556Srgrimes#
9051556Srgrimes# We don't erase the sys/${MACHINE}/compile/${KERNEL} directory, since somebody
9061556Srgrimes# may want to reuse it (release.8 presently)
9071556Srgrimes#
9081556SrgrimesdoKERNEL:
909222177Suqs	@rm -f ${RD}/kernels/${KERNEL}
9101556Srgrimes	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
9111556Srgrimes	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
9121556Srgrimes			make kernel-depend && \
9131556Srgrimes			make ${KERNEL_FLAGS} ${KERNEL_KO} && \
9141556Srgrimes			make kernel-reinstall DESTDIR=${RD}/kernels && \
9151556Srgrimes			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
9161556Srgrimes			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
9171556Srgrimes
9181556SrgrimesdoMODULES:
91976017Skris	@rm -f ${RD}/kernels/*.ko
9201556Srgrimes	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
9211556Srgrimes	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
9221556Srgrimes			make kernel-depend && \
9231556Srgrimes			make ${KERNEL_FLAGS} modules && \
9241556Srgrimes			make modules-reinstall DESTDIR=${RD}/kernels && \
9251556Srgrimes
92676017SkrisdoSTDKERNEL:
9271556Srgrimes	@rm -f ${RD}/kernels/${KERNEL}
9281556Srgrimes	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
9291556Srgrimes	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
9301556Srgrimes			make depend && \
9311556Srgrimes			make ${KERNEL_FLAGS} KERNEL=${KERNEL} && \
9321556Srgrimes			make KERNEL=${KERNEL} DESTDIR=${RD}/kernels install && \
9331556Srgrimes			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
9341556Srgrimes			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
9351556Srgrimes	@-cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
9361556Srgrimes			make KERNEL=${KERNEL} DESTDIR=${RD}/kernels \
9371556Srgrimes				kernel-reinstall.debug
9381556Srgrimes
9391556Srgrimes#
9401556Srgrimes# --==## Put a filesystem into a BOOTMFS kernel ##==--
9411556Srgrimes#
9421556SrgrimesdoMFSKERN:
9431556Srgrimes	@echo "Running doMFSKERN for ${FSIMAGE}"
9441556Srgrimes	@rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
9451556Srgrimes	@cd ${.CURDIR} && ${MAKE} createBOOTMFS 
9461556Srgrimes	@cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
9471556Srgrimes	@rm -rf ${RD}/image.${FSIMAGE}
9481556Srgrimes	@mkdir  ${RD}/image.${FSIMAGE}
9491556Srgrimes	@cd ${RD}/kernels && \
9501556Srgrimes	  (chflags noschg BOOTMFS || true) && \
9511556Srgrimes	  strip BOOTMFS && \
9521556Srgrimes	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
9531556Srgrimes	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
9541556Srgrimes	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
9551556Srgrimes	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
9561556Srgrimes	@mkdir -p ${RD}/image.${FSIMAGE}/boot
9571556Srgrimes	@cp /boot/loader ${RD}/image.${FSIMAGE}/boot
9581556Srgrimes	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
9591556Srgrimes	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
9601556Srgrimes	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
96176017Skris	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
9621556Srgrimes	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
9631556Srgrimes	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
9641556Srgrimes.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
9651556Srgrimes	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
9661556Srgrimes	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
9671556Srgrimes	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
9681556Srgrimes	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
9691556Srgrimes.endif
9701556Srgrimes	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
9711556Srgrimes	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
9721556Srgrimes.if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
97376017Skris	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
9741556Srgrimes.endif
9751556Srgrimes.if defined(FDSIZE) && ${FDSIZE} == "BIG"
9761556Srgrimes	@echo "Writing MFS image into kernel for ${FSIMAGE} floppy"
9771556Srgrimes	@./write_mfs_in_kernel ${RD}/image.${FSIMAGE}/kernel mfsroot
9781556Srgrimes	@cp ${RD}/image.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
9791556Srgrimes.endif
9801556Srgrimes	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
9811556Srgrimes	@rm -f ${RD}/floppies/${FSIMAGE}.flp
9821556Srgrimes.if defined(FDSIZE) && ${FDSIZE} == "BIG"
9831556Srgrimes	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
9841556Srgrimes		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
9851556Srgrimes		${BOOTINODE} ${BIGBOOTLABEL}
9861556Srgrimes.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
9878855Srgrimes	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
9881556Srgrimes		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
9891556Srgrimes		${BOOTINODE} ${SMALLBOOTLABEL}
9901556Srgrimes.else
9911556Srgrimes	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
9921556Srgrimes		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
9931556Srgrimes		${BOOTINODE} ${BOOTLABEL}
9941556Srgrimes.endif
9951556Srgrimes	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
9961556Srgrimes
9971556Srgrimes.include <bsd.prog.mk>
99890113Simp