Makefile revision 95520
1# $FreeBSD: head/release/Makefile 95520 2002-04-26 19:40:45Z ru $
2#
3# make release CHROOTDIR=/some/dir BUILDNAME=somename CVSROOT=/cvs/dir \
4#	[ RELEASETAG=tag ]
5#
6# Where "/some/dir" is the pathname of a directory on a some filesystem with
7# at least 1000MB of free space, "somename" is what you want the release to
8# call itself, "/cvs/dir" is where our source repo resides and, optionally,
9# which CVS "tag" name should be used when checking out the sources to build
10# the release (default is HEAD).
11#
12# Please note: the md(4) driver must be compiled into your kernel
13# or available as a kld(4)-style kernel module,
14# otherwise the target 'release.8' and possibly others will fail.
15#
16# Note:  "/some/dir" cannot reside on a filesystem mounted with
17# the "nodev" option, otherwise the chrooted "buildworld" will likely
18# fail.
19#
20# Note: If you add options to this file, please keep release(7) updated!
21#
22# Set these, release builder!
23#
24# Fixed version:
25#BUILDNAME=5.0-RELEASE
26#
27# Automatic SNAP versioning:
28DATE != date +%Y%m%d
29BASE = 5.0
30BUILDNAME?=${BASE}-${DATE}-SNAP
31#
32#CHROOTDIR=/junk/release
33# If this is a -stable snapshot, then set
34#RELEASETAG=RELENG_4
35#
36# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
37# are building an official release.  Otherwise, we are building for
38# a branch.
39.if defined(RELEASETAG)
40ISRELEASE!=	expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
41.if ${ISRELEASE} != 0
42# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
43AUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
44DOCRELEASETAG?=		${AUXRELEASETAG}
45PORTSRELEASETAG?=	${AUXRELEASETAG}
46.endif
47.endif
48
49# If you want to pass flags to the world build such as -j X, use
50# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
51# builds via KERNEL_FLAGS.
52#WORLD_FLAGS=-j4
53#KERNEL_FLAGS=-j4
54
55# If you are using a local CVS repository with components stored in 
56# non-standard modules, override these on the make commandline or
57# in the environment.
58RELEASESRCMODULE?=	src
59RELEASEDOCMODULE?=	doc
60RELEASEPORTSMODULE?=	ports
61
62# Unless set elsewhere, indicate the object format we'll be using.
63OBJFORMAT?=		elf
64
65# Uncomment this to disable the doc.1 target.  Docs normally require
66# the ports tree, so NOPORTS can be set together with NODOC in order
67# to have neither ports or docs.  If only NOPORTS is set to YES, but
68# docs are still desired, the DOMINIMALDOCPORTS logic below will only
69# install the ports that are minimally required for the docs.  This is
70# intended as a compromise, less disk space is required than for using
71# the entire ports collection (und much less time due to the huge number
72# of directories it would create), but still quite a bit as well as some
73# CPU cycles (some of the programs are C++, and things like ghostscript
74# belong to the required ports nevertheless).
75#
76# Setting this also disables building of release note documentation
77# (RELNOTESng).
78#NODOC=  YES
79#NOPORTS=  YES
80
81# Uncomment and modify this definition if you want the release notes 
82# and other release documentation in a language other than English.
83#RELNOTES_LANG=	en_US.ISO8859-1
84
85# As an alternative to installing the entire ports collection (which
86# can take a huge amount of time, in particular on slower disks),
87# setting ${MINIMALDOCPORTS} allows to install and build just those
88# ports that are really required for getting the docs up & running.
89.if defined(NOPORTS) && !defined(NODOC)
90DOMINIMALDOCPORTS=	YES
91.include "Makefile.inc.docports"
92.endif
93
94# Helper variable
95.if defined(NOPORTS)
96.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
97NOPORTSATALL=	YES
98.endif
99.endif
100
101# Set ALLLANG=no if you want the documentation (e.g. Handbook, FAQ) to be
102# in English only.  The language for the release notes is controlled
103# by the RELNOTES_LANG variable above.
104ALLLANG?=	yes
105DOCPORTS=	textproc/docproj
106# Set this to wherever the distfiles required by release procedures.
107.if defined(DOCDISTFILES)
108# Respect DOCDISTFILES which is used before.
109RELEASEDISTFILES?=	${DOCDISTFILES}
110.else
111RELEASEDISTFILES?=	${.CURDIR}/../../ports/distfiles
112.endif
113# Set this to 1 if you want -P to be used for automatic keyboard detection
114# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
115AUTO_KEYBOARD_DETECT?= 0
116
117.if !defined(NODOC)
118DIST_DOCS_ARCH_INDEP=	readme errata
119DIST_DOCS_ARCH_DEP=	installation relnotes hardware
120.endif
121
122# Things which without too much trouble can be considered variables
123# BASE_DISTS are special in that they get full /etc installation sets.
124#
125.if ${MACHINE_ARCH} == "i386"
126COMPAT_DISTS?=	compat1x compat20 compat21 compat22 compat3x compat4x
127.else
128COMPAT_DISTS?=	compat4x
129.endif
130OTHER_DISTS?=	games catpages manpages proflibs dict info doc
131CRYPTO_DISTS?=	crypto krb4 krb5
132BASE_DISTS?=	base
133DISTRIBUTIONS?=	${BASE_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
134
135BOOT1=	etc/defaults/rc.conf
136
137# mountpoint for filesystems.
138MNT=			/mnt
139
140# Various floppy image parameters.
141#
142
143.if ${MACHINE_ARCH} == "i386"
144.if ${MACHINE} == "pc98"
145SMALLBOOTSIZE=		1200
146BOOTSIZE=		1440
147FIXITSIZE=		1440
148MFSSIZE=		4320
149BOOTINODE=		80000
150FIXITINODE=		40000
151MFSINODE=		8000
152SMALLBOOTLABEL=		fd1200
153BOOTLABEL=		fd1440
154FIXITLABEL=		fd1440
155MFSLABEL=		minimum3
156.else
157BOOTSIZE=		1440
158FIXITSIZE=		1440
159MFSSIZE=		4320
160BIGBOOTSIZE=		2880
161BOOTINODE=		80000
162FIXITINODE=		40000
163MFSINODE=		8000
164BOOTLABEL=		fd1440
165FIXITLABEL=		fd1440
166MFSLABEL=		minimum3
167BIGBOOTLABEL=		minimum2
168.endif
169.elif ${MACHINE_ARCH} == "alpha"
170BOOTSIZE=		1440
171FIXITSIZE=		2880
172MFSSIZE=		4320
173BIGBOOTSIZE=		2880
174BOOTINODE=		80000
175FIXITINODE=		40000
176MFSINODE=		8000
177BOOTLABEL=		fd1440
178FIXITLABEL=		minimum2
179MFSLABEL=		auto
180BIGBOOTLABEL=		minimum2
181.endif
182
183ZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
184
185# Things that need to be recompiled with Kerberos support.
186K4PROGS!=	cd ${.CURDIR}/../kerberosIV; ${MAKE} -V KPROGS
187K5PROGS!=	cd ${.CURDIR}/../kerberos5; ${MAKE} -V KPROGS
188
189# Things that need to be compiled without crypto support in releases
190.if !defined(FIXCRYPTO)
191FIXCRYPTO=	bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/tcpdump/tcpdump 
192.if !defined(NO_SENDMAIL)
193FIXCRYPTO+=	usr.sbin/sendmail
194.endif
195.endif
196
197
198# Things which may get you into trouble if you change them
199MTREEFILES=		${.CURDIR}/../etc/mtree
200_R?=			/R
201RD=			${_R}/stage
202RND=			${RD}/release.doc
203FD=			${_R}/ftp
204CD=			${_R}/cdrom
205CD_DISC1=		${CD}/disc1
206CD_DISC2=		${CD}/disc2
207
208# Where the bootstrap ports (see DOCPORTS) get installed.
209LOCALDIR=		/usr/local/bin
210
211# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
212# environment, rather than the target environment.  This is specifically
213# intended for kernel-dependent utilities that are used during the build.
214#
215# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
216# ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
217BOOTSTRAPDIR=	/bootstrap
218#
219# The mount subsystem has been changed between 2.2 and 3.0 by the
220# Lite2 import.
221BOOTSTRAPUTILS=	/sbin/mount /sbin/umount
222#
223# 3.0 cpio tries to reference lchown(2) which is not available in 2.2
224BOOTSTRAPUTILS+= /usr/bin/cpio
225
226.if !defined(CRUNCH_TARGETS)
227CRUNCH_TARGETS=	boot fixit
228.endif
229
230EXTRAS= cdrom.1 ftp.1
231.if defined(MAKE_ISOS)
232EXTRAS+= iso.1
233.if ${MACHINE} != "pc98"
234BOOTABLE="-b"
235.endif
236.endif
237
238.if !defined(NODOC)
239DOCREL= doc.1 doc.2
240.endif
241
242.if !defined(NOPORTREADMES)
243MAKEREADMES=	make readmes PORTSDIR=${CHROOTDIR}/usr/ports
244.else
245MAKEREADMES=	true
246.endif
247
248WMAKEENV!=	cd ${.CURDIR}/..; ${MAKE} -f Makefile.inc1 -V WMAKEENV
249WMAKE=		${WMAKEENV} ${MAKE}
250
251rerelease release:
252.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
253	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
254.endif
255.if defined(NOPORTSATALL) && !defined(NODOC)
256	@echo "Ports are required for building the docs.  Either set NODOC or"
257	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
258	@exit 1
259.endif
260.if make(release)
261.if exists(${CHROOTDIR})
262# The first command will fail on a handful of files that have their schg
263# flags set.  But it greatly speeds up the next two commands.
264	-rm -rf ${CHROOTDIR} 2>/dev/null
265	-chflags -R noschg ${CHROOTDIR}/.
266	-rm -rf ${CHROOTDIR}
267.endif
268	mkdir -p ${CHROOTDIR}
269	@echo ">>> make release started on `LC_ALL=C TZ=GMT date`"
270	cd ${.CURDIR}/.. && ${MAKE} -DNOGAMES -DNOHTML -DNOINFO -DNOMAN \
271	    -DNOPROFILE installworld DESTDIR=${CHROOTDIR}
272	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
273	if [ -f /etc/resolv.conf ]; then \
274		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
275	fi
276	mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
277	for i in ${BOOTSTRAPUTILS} ; do \
278		cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
279	done
280.if !defined(RELEASETAG)
281	cd ${CHROOTDIR}/usr && rm -rf src && \
282		cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
283.else
284	cd ${CHROOTDIR}/usr && rm -rf src && \
285		cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
286.endif
287.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
288	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
289.endif
290.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
291	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
292.endif
293.if !defined(NOPORTS)
294.if defined(PORTSRELEASETAG)
295	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
296.else
297	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
298.endif
299.elif defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
300.if defined(PORTSRELEASETAG)
301	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
302.else
303	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${MINIMALDOCPORTS}
304.endif
305.endif
306.if !defined(NODOC)
307.if defined(DOCRELEASETAG)
308	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
309.else
310	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
311.endif
312	if [ -d ${RELEASEDISTFILES}/ ]; then \
313		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
314	else \
315		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
316	fi
317.endif
318.endif
319.if make(rerelease)
320.if !defined(RELEASENOUPDATE)
321.if !defined(RELEASETAG)
322	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -A
323.else
324	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
325.endif
326.if !defined(NOPORTS)
327	cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
328.endif
329.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
330	for i in ${MINIMALDOCPORTS}; do \
331		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q update -P -d ) ; \
332	done
333.endif
334.if !defined(NODOC)
335	cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
336.endif
337.endif
338.endif
339	# Add version information to those things that need it.
340	( cd ${CHROOTDIR}/usr/src/sys/conf && \
341	  mv newvers.sh foo && \
342	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
343	echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
344	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
345	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
346	echo "set -ex"				>> ${CHROOTDIR}/mk
347	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${CHROOTDIR}/mk
348	echo "export CFLAGS='-O -pipe'"	>> ${CHROOTDIR}/mk
349	echo "export WITHOUT_X11=YES"		>> ${CHROOTDIR}/mk
350	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
351	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
352	echo "export OBJFORMAT=${OBJFORMAT}"	>> ${CHROOTDIR}/mk
353.if defined(RELEASETAG)
354	echo "export RELEASETAG=\"${RELEASETAG}\""	>> ${CHROOTDIR}/mk
355.endif
356.if defined(NOPORTS)
357	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
358.endif
359.if defined(MAKE_ISOS)
360	echo "export MAKE_ISOS=${MAKE_ISOS}"	>> ${CHROOTDIR}/mk
361.endif
362.if defined(DOMINIMALDOCPORTS)
363	echo "export DOMINIMALDOCPORTS=${DOMINIMALDOCPORTS}" >> ${CHROOTDIR}/mk
364.endif
365.if defined(NODOC)
366	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
367.endif
368.if defined(ALLLANG) && ${ALLLANG} != "NO" && ${ALLLANG} != "no"
369	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
370.else
371	echo "export DOC_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
372.endif
373.if defined(NOSRC)
374	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
375.endif
376.if defined(RELNOTES_LANG)
377	echo "export RELNOTES_LANG=${RELNOTES_LANG}"	>> ${CHROOTDIR}/mk
378.else
379	echo "export RELNOTES_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
380.endif
381.if defined(NOSHARED)
382	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
383.endif
384.if defined(BOOT_CONFIG)
385	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
386.endif
387.if defined(WORLD_FLAGS)
388	echo "export WORLD_FLAGS=\"${WORLD_FLAGS}\""	>> ${CHROOTDIR}/mk
389.endif
390.if defined(KERNEL_FLAGS)
391	echo "export KERNEL_FLAGS=\"${KERNEL_FLAGS}\"" >> ${CHROOTDIR}/mk
392.endif
393	# Don't remove this, or the build will fall over!
394	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
395	echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
396	echo "export TMPDIR=/tmp"		>> ${CHROOTDIR}/mk
397	echo "export MAKEOBJDIRPREFIX=/usr/obj"	>> ${CHROOTDIR}/mk
398	echo "export MANBUILDCAT=YES"		>> ${CHROOTDIR}/mk
399	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
400	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
401	echo "	make ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${CHROOTDIR}/mk
402	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
403	echo "fi"				>> ${CHROOTDIR}/mk
404	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
405	echo "make obj"				>> ${CHROOTDIR}/mk
406	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
407	echo "echo \">>> make ${.TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
408	chmod 755 ${CHROOTDIR}/mk
409	chroot ${CHROOTDIR} /mk
410
411clean:
412	rm -rf boot_crunch release.[0-9]
413
414# Clean out ${_R} and make the directory structure.
415release.1:
416	mkdir -p ${_R}
417	-rm -rf ${_R}/* 2> /dev/null
418	-chflags -R noschg ${_R}/.
419	rm -rf ${_R}/*
420	mkdir ${RD}
421	mkdir ${RD}/floppies
422	mkdir ${RD}/trees
423	mkdir ${RD}/kernels
424	for i in ${DISTRIBUTIONS} ; do \
425		mkdir ${RD}/trees/$$i && \
426		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
427		    -p ${RD}/trees/$$i > /dev/null && \
428		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
429		    -p ${RD}/trees/$$i/usr > /dev/null && \
430		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
431		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
432		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
433		    -p ${RD}/trees/$$i/var > /dev/null ; \
434	done
435	touch release.1
436
437# Install the system into the various distributions.
438release.2:
439	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
440	cd ${.CURDIR}/.. && make distribworld DISTDIR=${RD}/trees
441	# Handle some grief caused by the munition braindeadness.
442	cd ${.CURDIR}/..; \
443	${MAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DNOCRYPT \
444	    SUBDIR_OVERRIDE="${FIXCRYPTO}" \
445	    buildworld distribworld DISTDIR=${RD}/trees
446.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
447	cd ${.CURDIR}/..; \
448	${MAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS4 \
449	    SUBDIR_OVERRIDE="kerberosIV ${K4PROGS}" \
450	    buildworld distribworld DISTDIR=${RD}/trees
451.endif
452.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
453	cd ${.CURDIR}/..; \
454	${MAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS5 \
455	    SUBDIR_OVERRIDE="kerberos5 ${K5PROGS}" \
456	    buildworld distribworld DISTDIR=${RD}/trees
457.endif
458	-chflags -R noschg ${RD}/trees
459	touch release.2
460
461# Make and install the generic kernel(s).
462release.3:
463.for kernel in ${KERNELS}
464	cd ${.CURDIR}/..; \
465	${MAKE} ${KERNEL_FLAGS} -DNO_WERROR -DNO_MODULES \
466	    KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
467	    DESTDIR=${RD}/trees/base
468.endfor
469	# Install a standard boot kernel+modules.
470	cd ${.CURDIR}/..; \
471	${MAKE} ${KERNEL_FLAGS} -DNO_WERROR \
472	    kernel \
473	    DESTDIR=${RD}/trees/base; \
474	cd ${.CURDIR}/..; \
475	${MAKE} ${KERNEL_FLAGS} -DNO_MODULES \
476	    reinstallkernel -DINSTALL_DEBUG \
477	    DESTDIR=${RD}/trees/base
478	touch release.3
479
480# Make and install the three crunched binaries which live on the floppies.
481# You are not supposed to like this :-)
482release.4:
483	rm -rf ${RD}/crunch
484	mkdir -p ${RD}/crunch
485	for j in ${CRUNCH_TARGETS} ; do \
486		rm -rf $${j}_crunch && \
487		mkdir $${j}_crunch && \
488		( cd $${j}_crunch && \
489		  ( ( [ -f ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ] && \
490		    crunchgen ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ) || \
491		    ( crunchgen ${.CURDIR}/$${j}_crunch.conf ) ) && \
492		  ${WMAKE} -f $${j}_crunch.mk subclean all ) && \
493		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
494		true || { rm -rf $${j}_crunch ; false ; } ; \
495	done
496	touch release.4
497
498#
499# --==## Fix up the distributions. ##==--
500#
501release.5:
502	# Create any "synthetic dists" now.
503	@for i in ${DISTRIBUTIONS}; do \
504		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
505			echo -n "Running $$i dist creation script... "; \
506			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
507			echo "Done."; \
508		fi \
509	done \
510
511	# Remove all the directories we don't need.
512	-cd ${RD}/trees && \
513		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
514	touch release.5
515
516#
517# --==## Package up the tarballs from assembled trees ##==--
518#
519release.6:
520	rm -rf ${RD}/dists
521	mkdir -p ${RD}/dists
522	@for i in ${DISTRIBUTIONS} ; \
523	do \
524		if [ -d ${RD}/trees/$${i} ] ; then \
525			cd ${.CURDIR} && $(MAKE) doTARBALL \
526				SD=${RD}/trees/$${i} \
527				TN=$$i TD=$$i ARG="." && \
528			echo "$${i} distribution is finished."; \
529		fi ; \
530	done
531	# More munition braindeadness.
532	( cd ${RD}/dists && \
533		if [ -f krb4/krb4.aa ] ; then \
534			mv krb4/krb4.* crypto && \
535			cat krb4/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
536			rm -r krb4; \
537		fi )
538	( cd ${RD}/dists && \
539		if [ -f krb5/krb5.aa ] ; then \
540			mv krb5/krb5.* crypto && \
541			cat krb5/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
542			rm -r krb5; \
543		fi )
544	touch release.6
545
546
547#
548# --==## Make source dists ##==--
549#
550release.7:
551.if !defined(NOSRC)
552	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
553		TD=src TN=sbase ARG="[A-Z]*"
554	@for i in `cd /usr/src && echo [a-z]*` ; do \
555		if [ -d /usr/src/$$i ] ; then \
556			cd ${.CURDIR} && $(MAKE) doTARBALL \
557				TN=`echo s$$i | tr -d '.' | \
558				    sed -e 's/usr/u/' \
559					-e 's/kerberosIV/krb4/' \
560					-e 's/kerberos5/krb5/'` \
561				SD=/usr/src TD=src ARG="$$i" ; \
562		fi ; \
563	done
564.if defined(EXTRA_SRC)
565	@set ${EXTRA_SRC} && \
566	while [ $$# -ge 2 ] ; do \
567		if [ -d /usr/src/$$1 ] ; then \
568			cd ${.CURDIR} && $(MAKE) doTARBALL \
569				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
570		fi && shift && shift ; \
571	done
572.endif
573	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
574		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
575		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
576		if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
577		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
578		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
579		md5 * > CHECKSUM.MD5 ) ; fi
580	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
581	@echo "src distribution is finished."
582.endif
583	touch release.7
584
585# Complete the bootfd
586#
587# Now, just to get this picture down once and for all:
588#
589# +------------------------------------------------------------------------+
590# |boot.flp                                                                |
591# +-----+-----+------------------------------------------------------------+
592# |boot1|boot2|floppy filesystem "bootfd"                                  |
593# +-----+-----+-+----------------------+---------------------------------+-+
594#               |kernel.gz             |mfsroot.gz                       |
595#               +----------------------+---------------------------------+
596#
597
598release.8:
599	rm -rf ${RD}/mfsfd
600	mkdir ${RD}/mfsfd
601	cd ${RD}/mfsfd && \
602		mkdir -p etc/defaults dev mnt stand/help
603	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
604		DIR=${RD}/mfsfd/stand ZIP=false
605	( cd ${RD}/trees/base/dev && \
606		ls console tty bpf0 ttyd0 ttyv0 ttyv1 ttyv2 ttyv3 null zero card0 card1 card2 card3 usb usb0 uhid0 ums0 ulpt0 ugen0 kbd0 kmem mem xpt0 | \
607	cpio -dump ${RD}/mfsfd/dev )
608	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
609	( cd ${RD}/mfsfd && \
610	  for dir in bin sbin ; do \
611		ln -sf /stand $$dir; \
612	  done )
613	cp /sbin/dhclient-script ${RD}/mfsfd/stand
614.if ${MACHINE_ARCH} == "i386"
615	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
616.endif
617	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
618	cd ${RD}/trees/base && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
619	( for F in netconfig protocols ; do \
620		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
621		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
622	  done )
623	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
624	    ${RD}/trees/base/etc/services | \
625	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
626	    > ${RD}/mfsfd/stand/etc/services
627	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
628	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
629	gzip -9c ${RD}/trees/base/COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
630.if !defined(NODOC)
631	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
632	  gzip -9c ${RND}/${RELNOTES_LANG}/$$i/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
633	done
634	@for i in ${DIST_DOCS_ARCH_DEP}; do \
635	  gzip -9c ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
636	done
637	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT.gz ${RD}/mfsfd/stand/help/INSTALL.TXT.gz
638.endif
639	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
640	@mkdir -p ${RD}/mfsfd/boot
641	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
642.if ${MACHINE} == "i386"
643	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
644.endif
645	@cp ${RD}/trees/base/boot/loader.help ${RD}/mfsfd/boot
646	@cd ${.CURDIR}/../sys/${MACHINE}/conf && \
647	    sh ${.CURDIR}/${MACHINE_ARCH}/dokern.sh ${FDSIZE} < GENERIC > BOOTMFS && \
648	    [ -r GENERIC.hints ] && cp GENERIC.hints BOOTMFS.hints
649.if exists(${.CURDIR}/${MACHINE}/drivers.conf)
650	@perl ${.CURDIR}/scripts/driver-remove.pl \
651		${.CURDIR}/${MACHINE}/drivers.conf \
652		${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
653	@mkdir -p ${RD}/mfsfd/stand/modules
654	@perl ${.CURDIR}/scripts/driver-copy2.pl \
655	    ${.CURDIR}/${MACHINE}/drivers.conf \
656	    ${RD}/trees/base/boot/kernel ${RD}/mfsfd/stand/modules
657.endif
658	@echo "Making the regular boot floppy."
659	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
660		tar xf - -C ${RD}/mfsfd/stand
661	@echo "Compressing doc files..."
662	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
663.if ${MACHINE_ARCH} == "alpha"
664	rm -rf ${RD}/mfsfd/stand/help/*
665.endif
666	sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
667		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
668	@gzip -9vc mfsroot > mfsroot.gz
669.if ${MACHINE} == "pc98"
670	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
671		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
672		${BOOTINODE} ${SMALLBOOTLABEL}
673	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
674	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
675.else
676	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
677		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
678	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
679	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
680.endif
681	@rm mfsroot mfsroot.gz
682	@echo "Regular and MFS boot floppies made."
683	touch release.8
684
685#
686# --==## Create a fixit floppy ##==--
687#
688release.9:
689	@echo "Making fixit floppy."
690	@rm -rf ${RD}/fixitfd
691	@mkdir ${RD}/fixitfd
692	@cd ${RD}/fixitfd && \
693		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
694		usr/share/misc
695	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
696		DIR=${RD}/fixitfd/stand ZIP=false
697	@( cd ${RD}/fixitfd/dev && \
698		cp ${RD}/trees/base/dev/MAKEDEV MAKEDEV && \
699		chmod 755 MAKEDEV)
700	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
701		${RD}/trees/base/etc/protocols ${RD}/fixitfd/etc
702	@cp ${RD}/trees/base/usr/share/misc/scsi_modes \
703		${RD}/fixitfd/usr/share/misc
704	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
705	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
706	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
707	@chmod 555 ${RD}/fixitfd/stand/tar
708	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
709		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
710# Do our last minute floppies directory setup in a convenient place.
711.if !defined(NODOC)
712	@cp ${RND}/${RELNOTES_LANG}/installation/${MACHINE_ARCH}/article.txt \
713		${RD}/floppies/README.TXT
714	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
715.else
716	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
717.endif
718	touch release.9
719
720#
721# --==## Setup a suitable ftp-area ##==--
722#
723ftp.1:
724	@echo "Setting up FTP distribution area"
725	@mkdir -p ${FD}
726	-@ln -s . ${FD}/${BUILDNAME}
727	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
728	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
729.if !defined(NODOC)
730	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
731	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
732	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
733	done
734	@for i in ${DIST_DOCS_ARCH_DEP}; do \
735	  cp ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
736	  cp ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
737	done
738	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
739	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
740	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
741.endif
742	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
743.if !defined(NOPORTS)
744	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
745.endif
746	touch ftp.1
747
748#
749# --==## Setup a suitable cdrom-area ##==--
750#
751cdrom.1:
752	@echo "Setting up CDROM distribution area"
753	@mkdir -p ${CD_DISC1} ${CD_DISC2}
754	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
755	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
756	@for i in ${DISTRIBUTIONS} ; \
757	do \
758		if [ -d ${RD}/trees/$${i} ] ; then \
759			chflags -R noschg ${RD}/trees/$${i} || true ; \
760			( cd ${RD}/trees/$${i} && \
761			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
762		fi \
763	done
764	@rm -f ${CD_DISC2}/.profile
765	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
766	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
767	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
768.if !defined(NODOC)
769	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
770	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
771	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
772	done
773	@for i in ${DIST_DOCS_ARCH_DEP}; do \
774	  cp ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
775	  cp ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
776	done
777	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
778	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
779	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
780.endif
781.if ${MACHINE} != "pc98"
782	@echo "Setting up /boot"
783	@cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
784	@ln -f ${RD}/image.boot/mfsroot.gz ${CD_DISC1}/boot/mfsroot.gz
785	@ln -f ${CD_DISC1}/boot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
786	@echo 'mfsroot_load="YES"' > ${CD_DISC1}/boot/loader.conf
787	@echo 'mfsroot_type="mfs_root"' >> ${CD_DISC1}/boot/loader.conf
788	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC1}/boot/loader.conf
789	@ln -f ${CD_DISC1}/boot/loader.conf ${CD_DISC2}/boot/loader.conf
790.endif
791.if ${MACHINE} == "i386"
792	@mkdir -p ${CD_DISC2}/floppies
793	@cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
794.endif
795.if !defined(NOPORTS)
796	@mkdir -p ${CD_DISC1}/ports && \
797	  tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
798	  ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
799	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
800	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
801.endif
802	touch cdrom.1
803
804iso.1:
805	@if [ -r ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ]; then \
806		echo "Creating ISO images..."; \
807		sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ${BOOTABLE} \
808		  fbsd_miniinst ${CD}/miniinst.iso ${CD_DISC1}; \
809		sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ${BOOTABLE} \
810		  fbsd_livefs ${CD}/disc2.iso ${CD_DISC2}; \
811		if [ "x${CD_EXTRA_BITS}" != "x" ]; then \
812			sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ${BOOTABLE} \
813			  fbsd_boot ${CD}/disc1.iso ${CD_DISC1} ${CD_EXTRA_BITS}; \
814			    && false; \
815		fi \
816	else \
817		echo "Do not know how to create an ISO for ${MACHINE_ARCH}."; \
818	fi
819	touch iso.1
820
821#
822# --==## Documentation Project files such as the Handbook and FAQ ##==--
823#
824doc.1:
825	@echo "Making docs..."
826	@for i in ${DOCPORTS}; do \
827	  cd /usr/ports/$$i && make all install clean BATCH=yes JADETEX=no FORCE_PKG_REGISTER=yes; \
828	done
829	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc
830	touch doc.1
831
832#
833# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
834#
835doc.2:
836	@echo "Making release documentation..."
837	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' INSTALL_COMPRESSED='' DOCDIR=${RND}
838	touch doc.2
839
840# Various "subroutine" and other supporting targets.
841
842# RD=
843# SD=
844# TD=
845# ARG=
846doTARBALL:
847.if !defined(SD)
848	@echo "SD undefined in doTARBALL" && exit 1
849.endif
850.if !defined(TD)
851	@echo "TD undefined in doTARBALL" && exit 1
852.endif
853.if !defined(ARG)
854	@echo "ARG undefined in doTARBALL" && exit 1
855.endif
856	@rm -rf ${RD}/dists/${TD}/${TN}*
857	@mkdir -p ${RD}/dists/${TD}
858	@( cd ${SD} && \
859		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
860		echo rolling ${TD}/$$tn tarball &&\
861		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
862		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
863		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
864		   ${RD}/dists/${TD}/$$tn.inf && \
865		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
866		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
867		fi && \
868		if [ "${SD}" != "/usr/src" ]; then \
869			mtree -c -i -p ${SD}/${ARG} \
870			  -k gname,md5digest,mode,nlink,uname,size,link,type \
871			  > ${RD}/dists/${TD}/$$tn.mtree ; \
872		else \
873			true; \
874		fi; \
875		(cd ${RD}/dists/${TD}; \
876		   rm -f CHECKSUM.MD5; \
877		   md5 * > CHECKSUM.MD5) \
878	)
879
880doRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
881		release.6 release.7 release.8 release.9
882	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
883	@echo "Release done"
884
885floppies:
886	@cd ${.CURDIR} && ${MAKE} boot.flp
887	@cd ${.CURDIR} && ${MAKE} fixit.flp
888	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
889
890boot.flp:
891	@rm -f release.4 release.8
892	@cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
893
894fixit.flp:
895	@rm -f release.4 release.9
896	@cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
897
898installCRUNCH:
899.if !defined(CRUNCH)
900	@echo "CRUNCH undefined in installCRUNCH" && exit 1
901.endif
902.if !defined(DIR)
903	@echo "DIR undefined in installCRUNCH" && exit 1
904.endif
905.if !defined(ZIP)
906	@echo "ZIP undefined in installCRUNCH" && exit 1
907.endif
908	@if ${ZIP} ; then \
909		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
910	else \
911		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
912	fi
913	@chmod 555 ${DIR}/${CRUNCH}_crunch
914	@if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \
915		for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \
916			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
917		done \
918	else \
919		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
920			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
921		done \
922	fi
923
924#
925# --==## Put a filesystem into a BOOTMFS kernel ##==--
926#
927doMFSKERN:
928	@echo "Running ${.TARGET} for ${FSIMAGE}"
929	@rm -f ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
930	cd ${.CURDIR}/..; \
931	KERNEL_KO=BOOTMFS KODIR= \
932	    ${MAKE} ${KERNEL_FLAGS} -DNO_WERROR -DNO_MODULES -DNO_KERNELCLEAN \
933	    KERNCONF=BOOTMFS buildkernel reinstallkernel \
934	    DESTDIR=${RD}/kernels
935.if exists(${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS.hints)
936	cp ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS.hints ${RD}/kernels
937.endif
938	@rm -rf ${RD}/image.${FSIMAGE}
939	@mkdir ${RD}/image.${FSIMAGE}
940	@cd ${RD}/kernels && \
941	  (chflags noschg BOOTMFS || true) && \
942	  strip BOOTMFS && \
943	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
944	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
945	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
946	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
947	@mkdir -p ${RD}/image.${FSIMAGE}/boot
948.if ${MACHINE} == "i386"
949	@kgzip -vo ${RD}/image.${FSIMAGE}/boot/loader /boot/loader
950.else
951	@cp /boot/loader ${RD}/image.${FSIMAGE}/boot
952.endif
953	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
954	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
955	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
956	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
957	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
958	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
959.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
960	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
961	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
962	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
963.endif
964	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
965	@echo "set hint.acpi.0.disable=1" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
966	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
967	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
968.if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
969	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
970.endif
971	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
972	@rm -f ${RD}/floppies/${FSIMAGE}.flp
973.if defined(FDSIZE) && ${FDSIZE} == "BIG"
974	@cp mfsroot.gz ${RD}/image.${FSIMAGE}
975	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
976		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
977		${BOOTINODE} ${BIGBOOTLABEL}
978.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
979	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
980		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
981		${BOOTINODE} ${SMALLBOOTLABEL}
982.else
983	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
984		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
985		${BOOTINODE} ${BOOTLABEL}
986.endif
987	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
988
989.include <bsd.prog.mk>
990