Makefile revision 68987
162587Sitojun# $FreeBSD: head/release/Makefile 68987 2000-11-21 04:37:30Z marcel $
295023Ssuz#
362587Sitojun# make release CHROOTDIR=/some/dir BUILDNAME=somename [ RELEASETAG=tag ]
4139823Simp#
554263Sshin# Where "/some/dir" is the pathname of a directory on a some
654263Sshin# filesystem with at least 1000MB of free space, "somename" is what
754263Sshin# you want the release to call itself and, optionally, which CVS "tag"
854263Sshin# name should be used when checking out the sources to build the release
954263Sshin# (default is HEAD).
1054263Sshin#
1154263Sshin# Please note: the vn driver must also be compiled into your kernel,
1254263Sshin# otherwise the target 'release.8' and possibly others will fail.
1354263Sshin#
1454263Sshin# Set these, release builder!
1554263Sshin#
1654263Sshin# Fixed version:
1754263Sshin#BUILDNAME=5.0-RELEASE
1854263Sshin#
1954263Sshin# Automatic SNAP versioning:
2054263SshinDATE != date +%Y%m%d
2154263SshinBASE = 5.0
2254263SshinBUILDNAME?=${BASE}-${DATE}-SNAP
2354263Sshin#
2454263Sshin#CHROOTDIR=/junk/release
2554263Sshin# If this is a -stable snapshot, then set
2654263Sshin#RELEASETAG=RELENG_4
2754263Sshin#
2854263Sshin# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
2954263Sshin# are building an official release.  Otherwise, we are building for
3054263Sshin# a branch.
3154263Sshin.if defined(RELEASETAG)
3254263SshinISRELEASE!=	expr ${RELEASETAG} : '^RELENG_.*_RELEASE$$' || true
3354263Sshin.if ${ISRELEASE} != 0
3454263Sshin# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
35101739SrwatsonAUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
3654263SshinDOCRELEASETAG?=		${AUXRELEASETAG}
3754263SshinPORTSRELEASETAG?=	${AUXRELEASETAG}
3854263Sshin.endif
3954263Sshin.endif
40101182Srwatson
4154263SshinKERNCONF=GENERIC
4254263Sshin
43129880Sphk# If you want to pass flags to the world build such as -j X, use
4454263Sshin# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
4554263Sshin# builds via KERNEL_FLAGS.
4654263Sshin#WORLD_FLAGS=-j4
4754263Sshin#KERNEL_FLAGS=-j4
4891270Sbrooks
4954263Sshin# If you are using a local CVS repository with components stored in 
5062587Sitojun# non-standard modules, override these on the make commandline or
5179106Sbrooks# in the environment.
5254263SshinRELEASESRCMODULE?=	src
5354263SshinRELEASEDOCMODULE?=	doc
5454263SshinRELEASEPORTSMODULE?=	ports
55130933Sbrooks
5654263Sshin# Unless set elsewhere, indicate the object format we'll be using.
5754263SshinOBJFORMAT?=		elf
5854263Sshin
5954263Sshin# Uncomment this to disable the doc.1 target.  It is also an ERROR
6054263Sshin# to set NOPORTS and not set NODOC since docs depend on ports.
6154263Sshin#NODOC=  YES
6254263Sshin#NOPORTS=  YES
6378064Sume# Set ALLLANG=no if you want the release documentation to be
6478064Sume# in English only.
6554263SshinALLLANG?=	yes
6654263SshinDOCPORTS=	textproc/docproj
6779106Sbrooks# Set this to wherever the distfiles required by ${DOCPORTS} live.
6854263SshinDOCDISTFILES?=	${.CURDIR}/../../ports/distfiles
6954263Sshin# Set this to 1 if you want -P to be used for automatic keyboard detection
7054263Sshin# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
7154263SshinAUTO_KEYBOARD_DETECT?= 0
7254263Sshin
7354263Sshin
7454263SshinDIST_DOCS= ABOUT.TXT ERRATA.TXT LAYOUT.TXT README.TXT HARDWARE.TXT \
7554263Sshin           RELNOTES.TXT TROUBLE.TXT UPGRADE.TXT INSTALL.TXT
7654263Sshin
77148385Sume# Things which without too much trouble can be considered variables
7854263Sshin# BIN_DISTS are special in that they get full /etc installation sets.
7962587Sitojun#
8054263SshinCOMPAT_DISTS?=	compat1x compat20 compat21 compat22 compat3x
8154263SshinOTHER_DISTS?=	manpages catpages games proflibs dict info doc
8262587SitojunCRYPTO_DISTS?=	crypto krb4 krb5
8354263SshinBIN_DISTS?=	bin
8454263SshinDISTRIBUTIONS?=	${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
8554263SshinKERNELS?=	GENERIC
8654263Sshin
8779106SbrooksBOOT1=	etc/protocols etc/defaults/rc.conf
8862587Sitojun
89127305Srwatson# mountpoint for filesystems.
90127898SruMNT=			/mnt
91127305Srwatson
92127305Srwatson# Various floppy image parameters.
93127305Srwatson#
9479106Sbrooks
9589065Smsmith.if ${MACHINE_ARCH} == "i386"
9679106Sbrooks.if ${MACHINE} == "pc98"
9783998SbrooksSMALLBOOTSIZE=		1200
9883998SbrooksBOOTSIZE=		1440
9983998SbrooksFIXITSIZE=		1440
10083998SbrooksMFSSIZE=		2880
10183998SbrooksBOOTINODE=		80000
102128209SbrooksFIXITINODE=		4000
103128209SbrooksMFSINODE=		8000
10479106SbrooksSMALLBOOTLABEL=		fd1200
105130933SbrooksBOOTLABEL=		fd1440
10679106SbrooksFIXITLABEL=		fd1440
10792725SalfredMFSLABEL=		minimum2
10879106Sbrooks.else
10991270SbrooksBOOTSIZE=		1440
11091270SbrooksFIXITSIZE=		1440
11191270SbrooksMFSSIZE=		4320
11262587SitojunBIGBOOTSIZE=		2880
11362587SitojunBOOTINODE=		80000
11491270SbrooksFIXITINODE=		4000
11562587SitojunMFSINODE=		8000
11662587SitojunBOOTLABEL=		fd1440
11762587SitojunFIXITLABEL=		fd1440
11895023SsuzMFSLABEL=		minimum3
11962587SitojunBIGBOOTLABEL=		minimum2
12062587Sitojun.endif
12162587Sitojun.elif ${MACHINE_ARCH} == "alpha"
12262587SitojunBOOTSIZE=		1440
12362587SitojunFIXITSIZE=		2880
12491270SbrooksMFSSIZE=		2880
12591270SbrooksBIGBOOTSIZE=		2880
12662587SitojunBOOTINODE=		80000
12791270SbrooksFIXITINODE=		4000
12891270SbrooksMFSINODE=		8000
12991270SbrooksBOOTLABEL=		fd1440
13091270SbrooksFIXITLABEL=		minimum2
13191270SbrooksMFSLABEL=		minimum2
13291270SbrooksBIGBOOTLABEL=		minimum2
13391270Sbrooks.endif
13491270Sbrooks
13591270SbrooksZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
13691270Sbrooks
13791270Sbrooks
13891270SbrooksVNDEVICE?=		vn0
13991270Sbrooks
140128209Sbrooks# Things which may get you into trouble if you change them
14179106SbrooksMTREEFILES=		${.CURDIR}/../etc/mtree
14279106Sbrooks_R=			/R
14392081SmuxRD=			${_R}/stage
14454263SshinFD=			${_R}/ftp
14578064SumeCD=			${_R}/cdrom
14654263SshinCD_DISC1=		${CD}/disc1
147131672SbmsCD_DISC2=		${CD}/disc2
148147256Sbrooks
149147256Sbrooks# Where the bootstrap ports (see DOCPORTS) get installed.
150147256SbrooksLOCALDIR=		/usr/local/bin
151147256Sbrooks
152147256Sbrooks# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
15379106Sbrooks# environment, rather than the target environment.  This is specifically
154147256Sbrooks# intended for kernel-dependent utilities that are used during the build.
155147256Sbrooks#
15679106Sbrooks# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
157105293Sume# ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
158105293SumeBOOTSTRAPDIR=	/bootstrap
159127305Srwatson#
160105293Sume# The mount subsystem has been changed between 2.2 and 3.0 by the
161127305Srwatson# Lite2 import.
162105293SumeBOOTSTRAPUTILS=	/sbin/mount /sbin/umount
163105293Sume#
164105293Sume# 3.0 cpio tries to reference lchown(2) which is not available in 2.2
165105293SumeBOOTSTRAPUTILS+= /usr/bin/cpio
166105293Sume
167105293Sume.if !defined(CRUNCH_TARGETS)
168105293SumeCRUNCH_TARGETS=	boot fixit
169105293Sume.endif
17079106Sbrooks
17162587Sitojun.if ${MACHINE} == "pc98"
172147256SbrooksEXTRAS= ftp.1
173147256Sbrooks.else
174147256SbrooksEXTRAS= cdrom.1 ftp.1
17578064Sume.endif
17679106Sbrooks
177147256Sbrooks.if !defined(NODOC)
17878064SumeDOCREL= doc.1
179147256Sbrooks.endif
180147256Sbrooks
181147256Sbrooks.if !defined(NOPORTREADMES)
182147256SbrooksMAKEREADMES=	make readmes PORTSDIR=${CHROOTDIR}/usr/ports
183147611Sdwmalone.else
18483998SbrooksMAKEREADMES=	true
185147256Sbrooks.endif
18679106Sbrooks
18779106Sbrooksrerelease release:
188127305Srwatson.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
189127305Srwatson	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
19079106Sbrooks.endif
191147256Sbrooks.if defined(NOPORTS) && !defined(NODOC)
19279106Sbrooks	@echo "Ports are required for building the docs.  Either set NODOC or"
19379106Sbrooks	@echo "unset NOPORTS!"
194127305Srwatson	@exit 1
195105293Sume.endif
196105293Sume	-vnconfig 2>/dev/null
197105293Sume.if make(release)
198105293Sume.if exists(${CHROOTDIR})
199105293Sume# The first command will fail on a handful of files that have their schg
200105293Sume# flags set.  But it greatly speeds up the next two commands.
201105293Sume	-rm -rf ${CHROOTDIR} 2>/dev/null
20279106Sbrooks	-chflags -R noschg ${CHROOTDIR}/.
20379106Sbrooks	-rm -rf ${CHROOTDIR}
20479106Sbrooks.endif
20579106Sbrooks	mkdir -p ${CHROOTDIR}
206105293Sume	@echo ">>> make release started on `LC_TIME=C TZ=GMT date`"
20779106Sbrooks	cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
20883998Sbrooks	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
20983998Sbrooks	if [ -f /etc/resolv.conf ]; then \
21079106Sbrooks		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
21179106Sbrooks	fi
212147256Sbrooks	cd ${.CURDIR}/.. && ${MAKE} installworld DESTDIR=${CHROOTDIR} NOMAN=1
21379106Sbrooks	mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
21479106Sbrooks	for i in ${BOOTSTRAPUTILS} ; do \
21579106Sbrooks		cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
21679106Sbrooks	done
217128209Sbrooks.if !defined(RELEASETAG)
218127305Srwatson	cd ${CHROOTDIR}/usr && rm -rf src && \
219127305Srwatson		cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
220127305Srwatson.else
221127305Srwatson	cd ${CHROOTDIR}/usr && rm -rf src && \
222127305Srwatson		cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
223127305Srwatson.endif
224127305Srwatson.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
225127305Srwatson	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
226127305Srwatson.endif
227127305Srwatson.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
228127305Srwatson	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
22979106Sbrooks.endif
23079106Sbrooks.if !defined(NOPORTS)
23179106Sbrooks.if defined(PORTSRELEASETAG)
23279106Sbrooks	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
23379106Sbrooks.else
23479106Sbrooks	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
235127305Srwatson.endif
23679106Sbrooks.endif
23779106Sbrooks.if !defined(NODOC)
23879106Sbrooks.if defined(DOCRELEASETAG)
239127305Srwatson	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
24083997Sbrooks.else
24179106Sbrooks	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
24279106Sbrooks.endif
24379106Sbrooks	if [ -d ${DOCDISTFILES}/ ]; then \
24479106Sbrooks		cp -rp ${DOCDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
24562587Sitojun	fi
24679106Sbrooks.endif
24779106Sbrooks.endif
24879106Sbrooks.if make(rerelease)
24979106Sbrooks.if !defined(RELEASENOUPDATE)
25079106Sbrooks.if !defined(RELEASETAG)
251127305Srwatson	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d
252127305Srwatson.else
253127305Srwatson	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
254127305Srwatson.endif
255127305Srwatson.if !defined(NOPORTS)
256127305Srwatson	cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
257127305Srwatson.endif
258127305Srwatson.if !defined(NODOC)
259127305Srwatson	cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
26079106Sbrooks.endif
26179106Sbrooks.endif
26262587Sitojun.endif
26379106Sbrooks	# Add version information to those things that need it.
264132199Sphk	( cd ${CHROOTDIR}/usr/src/sys/conf && \
265132199Sphk	  mv newvers.sh foo && \
26654263Sshin	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
26779106Sbrooks	echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
26854263Sshin	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
26954263Sshin	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
27079106Sbrooks	echo "set -ex"				>> ${CHROOTDIR}/mk
27179106Sbrooks	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${CHROOTDIR}/mk
27279106Sbrooks	echo "export CFLAGS='-O -pipe'"	>> ${CHROOTDIR}/mk
27379106Sbrooks	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
27479106Sbrooks	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
27554263Sshin	echo "export VNDEVICE=${VNDEVICE}"	>> ${CHROOTDIR}/mk
27679106Sbrooks	echo "export OBJFORMAT=${OBJFORMAT}"	>> ${CHROOTDIR}/mk
27783997Sbrooks.if defined(RELEASETAG)
27879106Sbrooks	echo "export RELEASETAG=${RELEASETAG}"	>> ${CHROOTDIR}/mk
279105293Sume.endif
28062587Sitojun.if defined(NOPORTS)
28162587Sitojun	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
28262587Sitojun.endif
28362587Sitojun.if defined(NODOC)
28462587Sitojun	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
28562587Sitojun.endif
28662587Sitojun.if defined(ALLLANG) && ${ALLLANG} != "NO" && ${ALLLANG} != "no"
28762587Sitojun	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
28862587Sitojun.else
28962587Sitojun	echo "export DOC_LANG=en_US.ISO_8859-1"	>> ${CHROOTDIR}/mk
29062587Sitojun.endif
29162587Sitojun.if defined(NOSRC)
29262587Sitojun	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
293147256Sbrooks.endif
29462587Sitojun.if defined(NOSHARED)
29562587Sitojun	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
29662587Sitojun.endif
29762587Sitojun.if defined(USA_RESIDENT)
29862587Sitojun	echo "export USA_RESIDENT=${USA_RESIDENT}" >> ${CHROOTDIR}/mk
29962587Sitojun.endif
30062587Sitojun.if defined(BOOT_CONFIG)
30162587Sitojun	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
30262587Sitojun.endif
30362587Sitojun.if defined(KERNEL_FLAGS)
30462587Sitojun	echo "export KERNEL_FLAGS=\"${KERNEL_FLAGS}\"" >> ${CHROOTDIR}/mk
30562587Sitojun.endif
30662587Sitojun	# Don't remove this, or the build will fall over!
30762587Sitojun	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
30862587Sitojun	echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
30962587Sitojun	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
31062587Sitojun	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
31162587Sitojun.if make(release)
31262587Sitojun	echo "	(cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
313105339Sume	echo "	make ${WORLD_FLAGS} world && \\"	>> ${CHROOTDIR}/mk
314105339Sume.endif
315105339Sume.if make(rerelease)
316105339Sume	echo "	make ${WORLD_FLAGS} all install && \\" >> ${CHROOTDIR}/mk
31791327Sbrooks.endif
31862587Sitojun	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
31962587Sitojun	echo "fi"				>> ${CHROOTDIR}/mk
32062587Sitojun	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
32162587Sitojun	echo "make obj"				>> ${CHROOTDIR}/mk
32262587Sitojun	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
32362587Sitojun	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
32462587Sitojun	echo "echo \">>> make ${.TARGET} finished on \`LC_TIME=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
32562587Sitojun	chmod 755 ${CHROOTDIR}/mk
32662587Sitojun	chroot ${CHROOTDIR} /mk
32762587Sitojun
32862587Sitojunclean:
329105293Sume	rm -rf boot_crunch release.[0-9]
330105293Sume
33162587Sitojun# Clean out ${_R} and make the directory structure.
33262587Sitojunrelease.1:
33362587Sitojun	mkdir -p ${_R}
33462587Sitojun	-rm -rf ${_R}/* 2> /dev/null
33562587Sitojun	-chflags -R noschg ${_R}/.
33662587Sitojun	rm -rf ${_R}/*
33762587Sitojun	mkdir ${RD}
33862587Sitojun	mkdir ${RD}/floppies
33962587Sitojun	mkdir ${RD}/trees
34062587Sitojun	mkdir ${RD}/dists
34154263Sshin	mkdir ${RD}/kernels
34254263Sshin	for i in ${DISTRIBUTIONS} ; do \
34354263Sshin		mkdir ${RD}/trees/$$i && \
34454263Sshin		mkdir ${RD}/dists/$$i && \
34554263Sshin		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
34654263Sshin		    -p ${RD}/trees/$$i > /dev/null && \
34754263Sshin		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
348147256Sbrooks		    -p ${RD}/trees/$$i/usr > /dev/null && \
349127898Sru		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
35054263Sshin		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
351127898Sru		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
352147611Sdwmalone		    -p ${RD}/trees/$$i/var > /dev/null ; \
35354263Sshin	done
354101182Srwatson	touch release.1
355101182Srwatson
356101739Srwatson# Install the system into the various distributions.
357101739Srwatsonrelease.2:
358101739Srwatson	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
359101739Srwatson	cd ${.CURDIR}/.. && make distribworld DISTDIR=${RD}/trees
360101182Srwatson.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
361101182Srwatson	cd ${.CURDIR}/../kerberosIV && ( \
36254263Sshin		make bootstrap &&\
36354263Sshin		make obj all help-distribute DISTDIR=${RD}/trees &&\
364127898Sru		make kprog \
365127898Sru	)
366127898Sru.endif
36754263Sshin.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
36854263Sshin	cd ${.CURDIR}/../kerberos5 && ( \
369127898Sru		make bootstrap &&\
370127898Sru		make obj all help-distribute DISTDIR=${RD}/trees &&\
371127898Sru		make kprog \
372127898Sru	)
373127898Sru.endif
374127898Sru	-chflags -R noschg ${RD}/trees
375127898Sru	touch release.2
376127898Sru
377127898Sru# Make and install the generic kernel(s).
378127898Srurelease.3:
379127898Sru.for kernel in ${KERNELS}
380127898Sru	-chflags -R noschg ${RD}/kernels/${kernel}
381127898Sru	rm -rf ${RD}/kernels/${kernel}
382127898Sru	rm -rf ${.CURDIR}/../sys/compile/${kernel}
383127898Sru	cd ${.CURDIR} && ${MAKE} doSTDKERNEL KERNEL=${kernel} KODIR=/${kernel}
38454263Sshin	rm -rf ${.CURDIR}/../sys/compile/${kernel}
38554263Sshin	-mkdir ${RD}/trees/bin/boot/${kernel}
386127303Srwatson	cp -p ${RD}/kernels/${kernel}/kernel ${RD}/trees/bin/boot/${kernel}
38754263Sshin.endfor
38854263Sshin	# Install a standard boot kernel+modules
38954263Sshin	mkdir -p ${RD}/trees/bin/boot/kernel
39054263Sshin	cp -Rp ${RD}/kernels/GENERIC/* ${RD}/trees/bin/boot/kernel
391127898Sru	touch release.3
392127898Sru
393127898Sru# Make and install the three crunched binaries which live on the floppies.
394127898Sru# You are not supposed to like this :-)
395127898Sru#
396127898Sru# NB: the "RELEASE_BUILD_FIXIT" magic prevents vi from including the
397127898Sru# Tcl and Perl APIs.  See also /usr/src/usr.bin/vi/Makefile.
398127898Sru# It also prevents ls linking against termcap by disabling color support.
399127898Sru# See /usr/src/bin/ls/Makefile.
40062587Sitojunrelease.4:
40154263Sshin	@mkdir -p /stand
40254263Sshin	cd ${.CURDIR}/sysinstall && make obj depend all install
40354263Sshin	rm -rf ${RD}/crunch
40454263Sshin	mkdir -p ${RD}/crunch
40554263Sshin	export RELEASE_BUILD_FIXIT=noway ; \
40654263Sshin	for j in ${CRUNCH_TARGETS} ; do \
40754263Sshin		rm -rf $${j}_crunch && \
40854263Sshin		mkdir $${j}_crunch && \
409147611Sdwmalone		( cd $${j}_crunch && \
410147611Sdwmalone		  ( ( [ -f ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ] && \
411147611Sdwmalone		    crunchgen ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ) || \
412147611Sdwmalone		    ( crunchgen ${.CURDIR}/$${j}_crunch.conf ) ) && \
413147611Sdwmalone		  ${MAKE} -DRELEASE_CRUNCH -f $${j}_crunch.mk subclean all \
414147611Sdwmalone		    NOCRYPT=yes "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
41554263Sshin		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
416147611Sdwmalone		true || { rm -rf $${j}_crunch ; false ; } ; \
417123922Ssam	done
41854263Sshin	touch release.4
41962587Sitojun
42054263Sshin#
42154263Sshin# --==## Fix up the distributions. ##==--
42278064Sume#
42378064Sumerelease.5:
42462587Sitojun	# Handle some grief caused by the munition braindeadness.
42562587Sitojun	for i in sbin/init bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/sendmail usr.sbin/tcpdump/tcpdump ; do \
42678064Sume		( cd ${.CURDIR}/../$$i; \
42754263Sshin		  make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
42854263Sshin	done
42954263Sshin
430105340Sume	# Create any "synthetic dists" now.
43154263Sshin	@for i in ${DISTRIBUTIONS}; do \
43254263Sshin		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
43354263Sshin			echo -n "Running $$i dist creation script... "; \
43454263Sshin			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
435105340Sume			echo "Done."; \
43654263Sshin		fi \
43754263Sshin	done \
43854263Sshin
43962587Sitojun	# Create symlinks for the MD5-based crypt lib, too.  The
44054263Sshin	# automatically created links still point to the DES stuff,
44178064Sume	# which went into its own distribution.
44254263Sshin	for i in ${RD}/trees/bin/usr/lib/libscrypt* ; do \
44354263Sshin		c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \
44454263Sshin		rm -f $$c ; \
44578064Sume		ln -s `basename $$i` $$c ; \
44678064Sume	done
44754263Sshin
44854263Sshin	# Remove all the directories we don't need.
44954263Sshin	-cd ${RD}/trees && \
45054263Sshin		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
451105338Sume	touch release.5
45254263Sshin
45354263Sshin#
454105338Sume# --==## Package up the tarballs from assembled trees ##==--
45554263Sshin#
45669152Sjlemonrelease.6:
45754263Sshin	rm -rf ${RD}/dists
458105338Sume	mkdir -p ${RD}/dists
45954263Sshin	@for i in ${DISTRIBUTIONS} ; \
46054263Sshin	do \
46154263Sshin		if [ -d ${RD}/trees/$${i} ] ; then \
46254263Sshin			cd ${.CURDIR} && $(MAKE) doTARBALL \
46354263Sshin				SD=${RD}/trees/$${i} \
464105338Sume				TN=$$i TD=$$i ARG="." && \
465101182Srwatson			echo "$${i} distribution is finished."; \
466101182Srwatson		fi ; \
467105338Sume	done
468101182Srwatson	# More munition braindeadness.
469101182Srwatson	( cd ${RD}/dists && \
470105338Sume		if [ -f krb4/krb4.aa ] ; then mv krb4/* crypto && rmdir krb4 ; fi )
47178064Sume	( cd ${RD}/dists && \
472123922Ssam		if [ -f krb5/krb5.aa ] ; then mv krb5/* crypto && rmdir krb5 ; fi )
47354263Sshin	touch release.6
47454263Sshin
47583998Sbrooks
476105338Sume#
47783998Sbrooks# --==## Make source dists ##==--
47883998Sbrooks#
47983998Sbrooksrelease.7:
48083998Sbrooks.if !defined(NOSRC)
48154263Sshin	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
48254263Sshin		TD=src TN=sbase ARG="[A-Z]*"
48354263Sshin	@for i in `cd /usr/src && echo [a-z]*` ; do \
48454263Sshin		if [ -d /usr/src/$$i ] ; then \
48595023Ssuz			cd ${.CURDIR} && $(MAKE) doTARBALL \
48654263Sshin				TN=`echo s$$i | tr -d '.' | \
48795023Ssuz				    sed -e 's/usr/u/' \
48854263Sshin					-e 's/kerberosIV/krb4/' \
48995023Ssuz					-e 's/kerberos5/krb5/'` \
49095023Ssuz				SD=/usr/src TD=src ARG="$$i" ; \
49154263Sshin		fi ; \
49254263Sshin	done
49354263Sshin.if defined(EXTRA_SRC)
49454263Sshin	@set ${EXTRA_SRC} && \
49554263Sshin	while [ $$# -ge 2 ] ; do \
49654263Sshin		if [ -d /usr/src/$$1 ] ; then \
49754263Sshin			cd ${.CURDIR} && $(MAKE) doTARBALL \
49854263Sshin				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
49954263Sshin		fi && shift && shift ; \
50054263Sshin	done
50154263Sshin.endif
50254263Sshin	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
50354263Sshin		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
50483998Sbrooks		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
505105338Sume		if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
50683998Sbrooks		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; ) ; fi
50783998Sbrooks	@echo "src distribution is finished."
50854263Sshin.endif
50954263Sshin	touch release.7
51054263Sshin
511105338Sume# Complete the bootfd
512105338Sume#
513111888Sjlemon# Now, just to get this picture down once and for all:
51454263Sshin#
51554263Sshin# +------------------------------------------------------------------------+
51662587Sitojun# |boot.flp                                                                |
51754263Sshin# +-----+-----+------------------------------------------------------------+
51854263Sshin# |boot1|boot2|floppy filesystem "bootfd"                                  |
51954263Sshin# +-----+-----+-+--------------------------------------------------------+-+
52054263Sshin#               |kernel                                                  |
52154263Sshin#               +------------+-----------------------------------------+-+
52254263Sshin#                            |mfs filesystem "mfsfd"                   |
523147256Sbrooks#                            +-----------------------------------------+
52454263Sshin#
52554263Sshin
52662587Sitojunrelease.8: write_mfs_in_kernel
527105339Sume	rm -rf ${RD}/mfsfd
528105339Sume	mkdir ${RD}/mfsfd
529105339Sume	cd ${RD}/mfsfd && \
530105339Sume		mkdir -p etc/defaults dev mnt stand/help
53154263Sshin	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
53254263Sshin		DIR=${RD}/mfsfd/stand ZIP=false
533105293Sume	( cd ${RD}/trees/bin/dev && \
53454263Sshin		ls console tty bpf0 ttyv0 ttyv1 ttyv2 ttyv3 null zero card0 card1 card2 card3 usb usb0 uhid0 ums0 ulpt0 ugen0 kbd0 kmem mem | \
53562587Sitojun	cpio -dump ${RD}/mfsfd/dev )
53654263Sshin	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
53754263Sshin	( cd ${RD}/mfsfd && \
53854263Sshin	  for dir in bin sbin ; do \
53954263Sshin		ln -sf /stand $$dir; \
54054263Sshin	  done )
54154263Sshin	cp /sbin/dhclient-script ${RD}/mfsfd/stand
54254263Sshin	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
54362587Sitojun	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
54454263Sshin	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
54554263Sshin	echo "nameserver      42/tcp name"	> ${RD}/mfsfd/stand/etc/services
54662587Sitojun	echo "ftp             21/tcp"		>> ${RD}/mfsfd/stand/etc/services
54754263Sshin	echo "domain          53/tcp          nameserver" >> ${RD}/mfsfd/stand/etc/services
548105339Sume	echo "domain          53/udp          nameserver" >> ${RD}/mfsfd/stand/etc/services
549105339Sume	echo "cmd             514/tcp    shell" >> ${RD}/mfsfd/stand/etc/services
550105339Sume	gzip -9c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
551105339Sume	@for i in README.TXT RELNOTES.TXT INSTALL.TXT UPGRADE.TXT HARDWARE.TXT; do \
55254263Sshin	  if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
55362587Sitojun	     gzip -9c ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \
55454263Sshin	  else \
555105339Sume	     gzip -9c ${.CURDIR}/texts/$${i} > ${RD}/mfsfd/stand/help/$${i}.gz; \
55654263Sshin	  fi; \
557105339Sume	done
55854263Sshin	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
55954263Sshin	@mkdir -p ${RD}/mfsfd/boot
56054263Sshin	@cp /boot/boot* ${RD}/mfsfd/boot
56178064Sume	@cp /boot/loader.help ${RD}/mfsfd/boot
56262587Sitojun	@cd ${.CURDIR} && ${MAKE} createBOOTMFS 
56378064Sume.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
56462587Sitojun	@cd ${.CURDIR} && ${MAKE} doMODULES KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
56554263Sshin.endif
56654263Sshin	@echo "Making the regular boot floppy."
56754263Sshin	@tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
56854263Sshin		tar xf - -C ${RD}/mfsfd/stand
56962587Sitojun	@echo "Compressing doc files..."
57078064Sume	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
57162587Sitojun.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
57262587Sitojun	@mkdir -p ${RD}/mfsfd/stand/modules
57362587Sitojun	@perl ${.CURDIR}/scripts/driver-copy2.pl \
57462587Sitojun		${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
57562587Sitojun		${RD}/kernels ${RD}/mfsfd/stand/modules
57662587Sitojun.endif
57762587Sitojun	sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
57862587Sitojun		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
57978064Sume	@gzip -9vc mfsroot > mfsroot.gz
58078064Sume.if ${MACHINE} == "pc98"
58178064Sume	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
58278064Sume		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
58378064Sume		${BOOTINODE} ${SMALLBOOTLABEL}
584105293Sume	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
58591327Sbrooks	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
586105293Sume.else
58762587Sitojun	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
58854263Sshin		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
58978064Sume	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
59078064Sume	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
59178064Sume.endif
59278064Sume	@rm mfsroot mfsroot.gz mfsroot.size
59378064Sume	@echo "Regular and MFS boot floppies made."
59478064Sume	touch release.8
59578064Sume
59678064Sume#
59778064Sume# --==## Create a fixit floppy ##==--
59878064Sume#
59978064Sumerelease.9:
60078064Sume	@echo "Making fixit floppy."
60178064Sume	@rm -rf ${RD}/fixitfd
60278064Sume	@mkdir ${RD}/fixitfd
60378064Sume	@cd ${RD}/fixitfd && \
60478064Sume		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
60578064Sume		usr/share/misc
60678064Sume	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
60778064Sume		DIR=${RD}/fixitfd/stand ZIP=false
60878064Sume	@( cd ${RD}/fixitfd/dev && \
60978064Sume		cp ${RD}/trees/bin/dev/MAKEDEV MAKEDEV && \
61078064Sume		chmod 755 MAKEDEV && \
61178064Sume		sh MAKEDEV fixit )
61278064Sume	@cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
61378064Sume		${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
61478064Sume	@cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
61578064Sume		${RD}/fixitfd/usr/share/misc
61678064Sume	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
61778064Sume	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
61878064Sume	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
61978064Sume	@chmod 555 ${RD}/fixitfd/stand/tar
62078064Sume	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
62178064Sume		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
62278064Sume# Do our last minute floppies directory setup in a convenient place.
62378064Sume	@cp ${.CURDIR}/texts/FLOPPIES.TXT ${RD}/floppies/README.TXT
62478064Sume	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
62578064Sume	touch release.9
62678064Sume
62778064Sume#
62878064Sume# --==## Setup a suitable ftp-area ##==--
62978064Sume#
63078064Sumeftp.1:
63178064Sume	@echo "Setting up FTP distribution area"
63278064Sume	@mkdir -p ${FD}
63378064Sume	-@ln -s . ${FD}/${BUILDNAME}
63478064Sume	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
63578064Sume	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
63678064Sume	@for i in ${DIST_DOCS}; do \
63778064Sume	  if [ -f ${.CURDIR}/texts/$${i} ]; then \
63878064Sume	     cp ${.CURDIR}/texts/$${i} ${FD}; \
63978064Sume	  fi; \
64078064Sume	  if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
64178064Sume	     echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${FD}/$${i}; \
64278064Sume	     cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${FD}/$${i}; \
64378064Sume	  fi; \
644147256Sbrooks	done
64562587Sitojun	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
64662587Sitojun.if !defined(NOPORTS)
64762587Sitojun	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
64862587Sitojun.endif
649147256Sbrooks	touch ftp.1
65054263Sshin
65162587Sitojun#
65262587Sitojun# --==## Setup a suitable cdrom-area ##==--
65354263Sshin#
65454263Sshincdrom.1:
65554263Sshin	@echo "Setting up CDROM distribution area"
65654263Sshin	@mkdir -p ${CD_DISC1} ${CD_DISC2}
65754263Sshin	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
65854263Sshin	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
65954263Sshin	@ln -f ${RD}/kernels/MFSKERNEL.boot ${CD_DISC1}/kernel
66054263Sshin	@for i in ${DISTRIBUTIONS} ; \
66154263Sshin	do \
66278064Sume		if [ -d ${RD}/trees/$${i} ] ; then \
66354263Sshin			chflags -R noschg ${RD}/trees/$${i} || true ; \
66478064Sume			( cd ${RD}/trees/$${i} && \
66554263Sshin			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
66678064Sume		fi \
66754263Sshin	done
66854263Sshin	@rm -f ${CD_DISC2}/.profile
66954263Sshin	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
67078064Sume	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
67154263Sshin	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
67254263Sshin	@for i in ${DIST_DOCS}; do \
67378064Sume	  if [ -f ${.CURDIR}/texts/$${i} ]; then \
67454263Sshin	     cp ${.CURDIR}/texts/$${i} ${CD_DISC1}; \
67554263Sshin	  fi; \
67654263Sshin	  if [ -f ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} ]; then \
67754263Sshin	     echo "=== Platform specifics for ${MACHINE_ARCH}" >> ${CD_DISC1}/$${i}; \
67854263Sshin	     cat ${.CURDIR}/texts/${MACHINE_ARCH}/$${i} >> ${CD_DISC1}/$${i}; \
67954263Sshin	  fi; \
68078064Sume        done
68178064Sume.if ${MACHINE_ARCH} == "alpha"
68278064Sume	@echo "Setting up Alpha CD disc1 for booting"
683148385Sume	@cp -Rp ${RD}/image.boot/boot ${CD_DISC1}
684148385Sume	@ln -f ${CD_DISC2}/boot/cdboot ${CD_DISC1}/boot
685148385Sume	@ln -f ${CD_DISC1}/boot/loader.rc ${CD_DISC2}/boot
686148385Sume	@ln -f ${CD_DISC1}/kernel ${CD_DISC2}/kernel
687148385Sume.endif
688148385Sume.if !defined(NOPORTS)
689148385Sume	@-rm -rf /usr/ports/distfiles/*
69054263Sshin	@mkdir -p ${CD_DISC1}/ports && \
69162587Sitojun	  tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
69254263Sshin	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
69354263Sshin	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
69454263Sshin.endif
69554263Sshin	touch cdrom.1
69654263Sshin
69754263Sshindoc.1:
69854263Sshin	@echo "Making docs..."
69954263Sshin	@for i in ${DOCPORTS}; do \
70054263Sshin	  cd /usr/ports/$$i && make all install clean JADETEX=no FORCE_PKG_REGISTER=yes; \
70178064Sume	done
70254263Sshin	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc
70378064Sume	touch doc.1
70454263Sshin
70578064Sume# Various "subroutine" and other supporting targets.
70654263Sshin
70754263Sshin# RD=
70854263Sshin# SD=
70978064Sume# TD=
71054263Sshin# ARG=
71154263SshindoTARBALL:
71278064Sume.if !defined(SD)
71354263Sshin	@echo "SD undefined in doTARBALL" && exit 1
71454263Sshin.endif
71554263Sshin.if !defined(TD)
71654263Sshin	@echo "TB undefined in doTARBALL" && exit 1
71754263Sshin.endif
71854263Sshin.if !defined(ARG)
71978064Sume	@echo "ARG undefined in doTARBALL" && exit 1
72078064Sume.endif
72178064Sume	@rm -rf ${RD}/dists/${TD}/${TN}*
722148385Sume	@mkdir -p ${RD}/dists/${TD}
723148385Sume	@( cd ${SD} && \
724148385Sume		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
725148385Sume		echo rolling ${TD}/$$tn tarball &&\
726148385Sume		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
727148385Sume		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
728148385Sume		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
72954263Sshin		   ${RD}/dists/${TD}/$$tn.inf && \
73054263Sshin		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
73178064Sume		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
73278064Sume		fi && \
73378064Sume		if [ "${SD}" != "/usr/src" ]; then \
73478064Sume			mtree -c -i -p ${SD}/${ARG} \
73578064Sume			  -k gname,md5digest,mode,nlink,uname,size,link,type \
73678064Sume			  > ${RD}/dists/${TD}/$$tn.mtree ; \
73778064Sume		else \
73878064Sume			true; \
73978064Sume		fi; \
74078064Sume		(cd ${RD}/dists/${TD}; \
74178064Sume		   rm -f CHECKSUM.MD5; \
74278064Sume		   md5 * > CHECKSUM.MD5) \
74378064Sume	)
74478064Sume
74578064SumedoRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
74678064Sume		release.6 release.7 release.8 release.9
74778064Sume	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
74878064Sume	@echo "Release done"
74978064Sume
75078064Sumefloppies:
75178064Sume	@cd ${.CURDIR} && ${MAKE} boot.flp
75278064Sume	@cd ${.CURDIR} && ${MAKE} fixit.flp
75378064Sume	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
75478064Sume
75578064Sumeboot.flp:
75654263Sshin	@rm -f release.4 release.8
75762587Sitojun	@cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
75854263Sshin
75954263Sshinfixit.flp:
76054263Sshin	@rm -f release.4 release.9
76154263Sshin	@cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
76254263Sshin
76354263Sshinwrite_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
76454263Sshin	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
76554263Sshin
76654263SshininstallCRUNCH:
76779106Sbrooks.if !defined(CRUNCH)
768127305Srwatson	@echo "CRUNCH undefined in installCRUNCH" && exit 1
769127305Srwatson.endif
770127305Srwatson.if !defined(DIR)
771127305Srwatson	@echo "DIR undefined in installCRUNCH" && exit 1
772127305Srwatson.endif
773127305Srwatson.if !defined(ZIP)
774127305Srwatson	@echo "ZIP undefined in installCRUNCH" && exit 1
775105293Sume.endif
776105293Sume	@if ${ZIP} ; then \
777105293Sume		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
778105293Sume	else \
779105293Sume		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
780105293Sume	fi
781147256Sbrooks	@chmod 555 ${DIR}/${CRUNCH}_crunch
782105293Sume	@if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \
783105293Sume		for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \
784105293Sume			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
785105293Sume		done \
786105293Sume	else \
787105293Sume		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
788105293Sume			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
789127305Srwatson		done \
790105293Sume	fi
791105293Sume
792105293Sume#
793105293Sume# --==## BOOTMFS config file ##==--
794105293Sume#
795105293Sume
796105293SumecreateBOOTMFS:
797105293Sume	@cd ${.CURDIR}/../sys/${MACHINE}/conf && \
798105293Sume	  sh ${.CURDIR}/scripts/dokern.sh ${FDSIZE} < ${KERNCONF} > BOOTMFS && \
799105293Sume	  [ -r ${KERNCONF}.hints ] && cp ${KERNCONF}.hints BOOTMFS.hints
800105293Sume.if ${MACHINE_ARCH} == "i386"
801105293Sume	@echo "options  INTRO_USERCONFIG" >> \
802105293Sume	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
803105293Sume.endif
804105293Sume.if defined(FDSIZE) && ${FDSIZE} == "BIG"
805105293Sume	@echo "options MD_ROOT_SIZE=`cat mfsroot.size`" >> \
806105293Sume	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
807105293Sume.endif
808105293Sume.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
809127305Srwatson	@perl ${.CURDIR}/scripts/driver-remove.pl \
810105293Sume		${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
811105293Sume		${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
812105293Sume.endif
813105293Sume
814105293Sume#
815127305Srwatson# --==## Compile a kernel by name ${KERNEL} ##==--
816105293Sume#
817105293Sume# We don't erase the sys/compile/${KERNEL} directory, since somebody
818105293Sume# may want to reuse it (release.8 presently)
819105293Sume#
820105293SumedoKERNEL:
821105293Sume	@rm -f ${RD}/kernels/${KERNEL}
822105293Sume	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
823105293Sume	@cd ${.CURDIR}/../sys/compile/${KERNEL} && \
824105293Sume			make kernel-depend && \
825105293Sume			make ${KERNEL_FLAGS} ${KERNEL_KO} && \
826105293Sume			make kernel-reinstall DESTDIR=${RD}/kernels && \
827105293Sume			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
828105293Sume			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
829105293Sume
830105293SumedoMODULES:
831105293Sume	@rm -f ${RD}/kernels/*.ko
832105293Sume	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
833111119Simp	@cd ${.CURDIR}/../sys/compile/${KERNEL} && \
834105293Sume			make kernel-depend && \
835105293Sume			make ${KERNEL_FLAGS} modules && \
836105293Sume			make modules-reinstall DESTDIR=${RD}/kernels && \
837105293Sume
838111119SimpdoSTDKERNEL:
839105293Sume	@rm -f ${RD}/kernels/${KERNEL}
840105293Sume	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
841105293Sume	@cd ${.CURDIR}/../sys/compile/${KERNEL} && \
842105293Sume			make depend && \
843105293Sume			make ${KERNEL_FLAGS} KERNEL=${kernel} && \
844105293Sume			make KERNEL=${kernel} DESTDIR=${RD}/kernels install && \
845105293Sume			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
846105293Sume			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
847105293Sume
848105293Sume#
849105293Sume# --==## Put a filesystem into a BOOTMFS kernel ##==--
850148385Sume#
851148385SumedoMFSKERN:
852148385Sume	@echo "Running doMFSKERN for ${FSIMAGE}"
853148385Sume	@rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
854148385Sume	@cd ${.CURDIR} && ${MAKE} createBOOTMFS 
855148385Sume	@cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
856148385Sume	@rm -rf ${RD}/image.${FSIMAGE}
857148385Sume	@mkdir  ${RD}/image.${FSIMAGE}
858148385Sume	@cd ${RD}/kernels && \
859148385Sume	  (chflags noschg BOOTMFS || true) && \
860105293Sume	  strip BOOTMFS && \
861105293Sume	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
862105293Sume	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
863105293Sume	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
864105293Sume	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
865105293Sume	@mkdir -p ${RD}/image.${FSIMAGE}/boot
866105293Sume	@cp /boot/loader ${RD}/image.${FSIMAGE}/boot
867105293Sume	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
868105293Sume	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
869105293Sume	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
870105293Sume	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
871105293Sume	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
872105293Sume	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
873105293Sume.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
874105293Sume	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
875105293Sume	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
876105293Sume	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
877105293Sume	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
878105293Sume.endif
879105293Sume	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
880105293Sume	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
881105293Sume.if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
882105293Sume	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
883105293Sume.endif
884105293Sume.if defined(FDSIZE) && ${FDSIZE} == "BIG"
885105293Sume	@echo "Writing MFS image into kernel for ${FSIMAGE} floppy"
886105293Sume	@./write_mfs_in_kernel ${RD}/image.${FSIMAGE}/kernel mfsroot
887105293Sume	@cp ${RD}/image.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
888105293Sume.endif
889105293Sume	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
890105293Sume	@rm -f ${RD}/floppies/${FSIMAGE}.flp
891105293Sume.if defined(FDSIZE) && ${FDSIZE} == "BIG"
892105293Sume	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
893105293Sume		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
894105293Sume		${BOOTINODE} ${BIGBOOTLABEL}
895105293Sume.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
89679106Sbrooks	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
897105293Sume		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
898105293Sume		${BOOTINODE} ${SMALLBOOTLABEL}
89979106Sbrooks.else
900147256Sbrooks	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
901105293Sume		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
90279106Sbrooks		${BOOTINODE} ${BOOTLABEL}
903105293Sume.endif
904105293Sume	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
90579106Sbrooks
90679106Sbrooks.include <bsd.prog.mk>
90779106Sbrooks