Makefile revision 95509
1# $FreeBSD: head/release/Makefile 95509 2002-04-26 17:55:27Z 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.if make(release)
402	echo "	make ${WORLD_FLAGS} buildworld && \\" >> ${CHROOTDIR}/mk
403.endif
404.if make(rerelease)
405	echo "	make ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${CHROOTDIR}/mk
406.endif
407	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
408	echo "fi"				>> ${CHROOTDIR}/mk
409	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
410	echo "make obj"				>> ${CHROOTDIR}/mk
411	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
412	echo "echo \">>> make ${.TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
413	chmod 755 ${CHROOTDIR}/mk
414	chroot ${CHROOTDIR} /mk
415
416clean:
417	rm -rf boot_crunch release.[0-9]
418
419# Clean out ${_R} and make the directory structure.
420release.1:
421	mkdir -p ${_R}
422	-rm -rf ${_R}/* 2> /dev/null
423	-chflags -R noschg ${_R}/.
424	rm -rf ${_R}/*
425	mkdir ${RD}
426	mkdir ${RD}/floppies
427	mkdir ${RD}/trees
428	mkdir ${RD}/kernels
429	for i in ${DISTRIBUTIONS} ; do \
430		mkdir ${RD}/trees/$$i && \
431		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
432		    -p ${RD}/trees/$$i > /dev/null && \
433		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
434		    -p ${RD}/trees/$$i/usr > /dev/null && \
435		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
436		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
437		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
438		    -p ${RD}/trees/$$i/var > /dev/null ; \
439	done
440	touch release.1
441
442# Install the system into the various distributions.
443release.2:
444	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
445	cd ${.CURDIR}/.. && make distribworld DISTDIR=${RD}/trees
446	# Handle some grief caused by the munition braindeadness.
447	cd ${.CURDIR}/..; \
448	${MAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DNOCRYPT \
449	    SUBDIR_OVERRIDE="${FIXCRYPTO}" \
450	    buildworld distribworld DISTDIR=${RD}/trees
451.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
452	cd ${.CURDIR}/..; \
453	${MAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS4 \
454	    SUBDIR_OVERRIDE="kerberosIV ${K4PROGS}" \
455	    buildworld distribworld DISTDIR=${RD}/trees
456.endif
457.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
458	cd ${.CURDIR}/..; \
459	${MAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS5 \
460	    SUBDIR_OVERRIDE="kerberos5 ${K5PROGS}" \
461	    buildworld distribworld DISTDIR=${RD}/trees
462.endif
463	-chflags -R noschg ${RD}/trees
464	touch release.2
465
466# Make and install the generic kernel(s).
467release.3:
468.for kernel in ${KERNELS}
469	cd ${.CURDIR}/..; \
470	${MAKE} ${KERNEL_FLAGS} -DNO_WERROR -DNO_MODULES \
471	    KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
472	    DESTDIR=${RD}/trees/base
473.endfor
474	# Install a standard boot kernel+modules.
475	cd ${.CURDIR}/..; \
476	${MAKE} ${KERNEL_FLAGS} -DNO_WERROR \
477	    kernel \
478	    DESTDIR=${RD}/trees/base; \
479	cd ${.CURDIR}/..; \
480	${MAKE} ${KERNEL_FLAGS} -DNO_MODULES \
481	    reinstallkernel -DINSTALL_DEBUG \
482	    DESTDIR=${RD}/trees/base
483	touch release.3
484
485# Make and install the three crunched binaries which live on the floppies.
486# You are not supposed to like this :-)
487release.4:
488	rm -rf ${RD}/crunch
489	mkdir -p ${RD}/crunch
490	for j in ${CRUNCH_TARGETS} ; do \
491		rm -rf $${j}_crunch && \
492		mkdir $${j}_crunch && \
493		( cd $${j}_crunch && \
494		  ( ( [ -f ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ] && \
495		    crunchgen ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ) || \
496		    ( crunchgen ${.CURDIR}/$${j}_crunch.conf ) ) && \
497		  ${WMAKE} -f $${j}_crunch.mk subclean all ) && \
498		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
499		true || { rm -rf $${j}_crunch ; false ; } ; \
500	done
501	touch release.4
502
503#
504# --==## Fix up the distributions. ##==--
505#
506release.5:
507	# Create any "synthetic dists" now.
508	@for i in ${DISTRIBUTIONS}; do \
509		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
510			echo -n "Running $$i dist creation script... "; \
511			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
512			echo "Done."; \
513		fi \
514	done \
515
516	# Remove all the directories we don't need.
517	-cd ${RD}/trees && \
518		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
519	touch release.5
520
521#
522# --==## Package up the tarballs from assembled trees ##==--
523#
524release.6:
525	rm -rf ${RD}/dists
526	mkdir -p ${RD}/dists
527	@for i in ${DISTRIBUTIONS} ; \
528	do \
529		if [ -d ${RD}/trees/$${i} ] ; then \
530			cd ${.CURDIR} && $(MAKE) doTARBALL \
531				SD=${RD}/trees/$${i} \
532				TN=$$i TD=$$i ARG="." && \
533			echo "$${i} distribution is finished."; \
534		fi ; \
535	done
536	# More munition braindeadness.
537	( cd ${RD}/dists && \
538		if [ -f krb4/krb4.aa ] ; then \
539			mv krb4/krb4.* crypto && \
540			cat krb4/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
541			rm -r krb4; \
542		fi )
543	( cd ${RD}/dists && \
544		if [ -f krb5/krb5.aa ] ; then \
545			mv krb5/krb5.* crypto && \
546			cat krb5/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
547			rm -r krb5; \
548		fi )
549	touch release.6
550
551
552#
553# --==## Make source dists ##==--
554#
555release.7:
556.if !defined(NOSRC)
557	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
558		TD=src TN=sbase ARG="[A-Z]*"
559	@for i in `cd /usr/src && echo [a-z]*` ; do \
560		if [ -d /usr/src/$$i ] ; then \
561			cd ${.CURDIR} && $(MAKE) doTARBALL \
562				TN=`echo s$$i | tr -d '.' | \
563				    sed -e 's/usr/u/' \
564					-e 's/kerberosIV/krb4/' \
565					-e 's/kerberos5/krb5/'` \
566				SD=/usr/src TD=src ARG="$$i" ; \
567		fi ; \
568	done
569.if defined(EXTRA_SRC)
570	@set ${EXTRA_SRC} && \
571	while [ $$# -ge 2 ] ; do \
572		if [ -d /usr/src/$$1 ] ; then \
573			cd ${.CURDIR} && $(MAKE) doTARBALL \
574				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
575		fi && shift && shift ; \
576	done
577.endif
578	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
579		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
580		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
581		if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
582		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
583		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
584		md5 * > CHECKSUM.MD5 ) ; fi
585	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
586	@echo "src distribution is finished."
587.endif
588	touch release.7
589
590# Complete the bootfd
591#
592# Now, just to get this picture down once and for all:
593#
594# +------------------------------------------------------------------------+
595# |boot.flp                                                                |
596# +-----+-----+------------------------------------------------------------+
597# |boot1|boot2|floppy filesystem "bootfd"                                  |
598# +-----+-----+-+----------------------+---------------------------------+-+
599#               |kernel.gz             |mfsroot.gz                       |
600#               +----------------------+---------------------------------+
601#
602
603release.8:
604	rm -rf ${RD}/mfsfd
605	mkdir ${RD}/mfsfd
606	cd ${RD}/mfsfd && \
607		mkdir -p etc/defaults dev mnt stand/help
608	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
609		DIR=${RD}/mfsfd/stand ZIP=false
610	( cd ${RD}/trees/base/dev && \
611		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 | \
612	cpio -dump ${RD}/mfsfd/dev )
613	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
614	( cd ${RD}/mfsfd && \
615	  for dir in bin sbin ; do \
616		ln -sf /stand $$dir; \
617	  done )
618	cp /sbin/dhclient-script ${RD}/mfsfd/stand
619.if ${MACHINE_ARCH} == "i386"
620	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
621.endif
622	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
623	cd ${RD}/trees/base && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
624	( for F in netconfig protocols ; do \
625		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
626		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
627	  done )
628	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
629	    ${RD}/trees/base/etc/services | \
630	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
631	    > ${RD}/mfsfd/stand/etc/services
632	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
633	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
634	gzip -9c ${RD}/trees/base/COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
635.if !defined(NODOC)
636	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
637	  gzip -9c ${RND}/${RELNOTES_LANG}/$$i/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
638	done
639	@for i in ${DIST_DOCS_ARCH_DEP}; do \
640	  gzip -9c ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
641	done
642	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT.gz ${RD}/mfsfd/stand/help/INSTALL.TXT.gz
643.endif
644	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
645	@mkdir -p ${RD}/mfsfd/boot
646	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
647.if ${MACHINE} == "i386"
648	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
649.endif
650	@cp ${RD}/trees/base/boot/loader.help ${RD}/mfsfd/boot
651	@cd ${.CURDIR}/../sys/${MACHINE}/conf && \
652	    sh ${.CURDIR}/${MACHINE_ARCH}/dokern.sh ${FDSIZE} < GENERIC > BOOTMFS && \
653	    [ -r GENERIC.hints ] && cp GENERIC.hints BOOTMFS.hints
654.if exists(${.CURDIR}/${MACHINE}/drivers.conf)
655	@perl ${.CURDIR}/scripts/driver-remove.pl \
656		${.CURDIR}/${MACHINE}/drivers.conf \
657		${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
658	@mkdir -p ${RD}/mfsfd/stand/modules
659	@perl ${.CURDIR}/scripts/driver-copy2.pl \
660	    ${.CURDIR}/${MACHINE}/drivers.conf \
661	    ${RD}/trees/base/boot/kernel ${RD}/mfsfd/stand/modules
662.endif
663	@echo "Making the regular boot floppy."
664	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
665		tar xf - -C ${RD}/mfsfd/stand
666	@echo "Compressing doc files..."
667	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
668.if ${MACHINE_ARCH} == "alpha"
669	rm -rf ${RD}/mfsfd/stand/help/*
670.endif
671	sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
672		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
673	@gzip -9vc mfsroot > mfsroot.gz
674.if ${MACHINE} == "pc98"
675	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
676		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
677		${BOOTINODE} ${SMALLBOOTLABEL}
678	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
679	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
680.else
681	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
682		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
683	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
684	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
685.endif
686	@rm mfsroot mfsroot.gz
687	@echo "Regular and MFS boot floppies made."
688	touch release.8
689
690#
691# --==## Create a fixit floppy ##==--
692#
693release.9:
694	@echo "Making fixit floppy."
695	@rm -rf ${RD}/fixitfd
696	@mkdir ${RD}/fixitfd
697	@cd ${RD}/fixitfd && \
698		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
699		usr/share/misc
700	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
701		DIR=${RD}/fixitfd/stand ZIP=false
702	@( cd ${RD}/fixitfd/dev && \
703		cp ${RD}/trees/base/dev/MAKEDEV MAKEDEV && \
704		chmod 755 MAKEDEV)
705	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
706		${RD}/trees/base/etc/protocols ${RD}/fixitfd/etc
707	@cp ${RD}/trees/base/usr/share/misc/scsi_modes \
708		${RD}/fixitfd/usr/share/misc
709	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
710	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
711	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
712	@chmod 555 ${RD}/fixitfd/stand/tar
713	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
714		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
715# Do our last minute floppies directory setup in a convenient place.
716.if !defined(NODOC)
717	@cp ${RND}/${RELNOTES_LANG}/installation/${MACHINE_ARCH}/article.txt \
718		${RD}/floppies/README.TXT
719	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
720.else
721	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
722.endif
723	touch release.9
724
725#
726# --==## Setup a suitable ftp-area ##==--
727#
728ftp.1:
729	@echo "Setting up FTP distribution area"
730	@mkdir -p ${FD}
731	-@ln -s . ${FD}/${BUILDNAME}
732	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
733	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
734.if !defined(NODOC)
735	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
736	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
737	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
738	done
739	@for i in ${DIST_DOCS_ARCH_DEP}; do \
740	  cp ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
741	  cp ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
742	done
743	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
744	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
745	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
746.endif
747	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
748.if !defined(NOPORTS)
749	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
750.endif
751	touch ftp.1
752
753#
754# --==## Setup a suitable cdrom-area ##==--
755#
756cdrom.1:
757	@echo "Setting up CDROM distribution area"
758	@mkdir -p ${CD_DISC1} ${CD_DISC2}
759	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
760	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
761	@for i in ${DISTRIBUTIONS} ; \
762	do \
763		if [ -d ${RD}/trees/$${i} ] ; then \
764			chflags -R noschg ${RD}/trees/$${i} || true ; \
765			( cd ${RD}/trees/$${i} && \
766			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
767		fi \
768	done
769	@rm -f ${CD_DISC2}/.profile
770	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
771	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
772	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
773.if !defined(NODOC)
774	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
775	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
776	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
777	done
778	@for i in ${DIST_DOCS_ARCH_DEP}; do \
779	  cp ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
780	  cp ${RND}/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
781	done
782	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
783	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
784	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
785.endif
786.if ${MACHINE} != "pc98"
787	@echo "Setting up /boot"
788	@cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
789	@ln -f ${RD}/image.boot/mfsroot.gz ${CD_DISC1}/boot/mfsroot.gz
790	@ln -f ${CD_DISC1}/boot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
791	@echo 'mfsroot_load="YES"' > ${CD_DISC1}/boot/loader.conf
792	@echo 'mfsroot_type="mfs_root"' >> ${CD_DISC1}/boot/loader.conf
793	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC1}/boot/loader.conf
794	@ln -f ${CD_DISC1}/boot/loader.conf ${CD_DISC2}/boot/loader.conf
795.endif
796.if ${MACHINE} == "i386"
797	@mkdir -p ${CD_DISC2}/floppies
798	@cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
799.endif
800.if !defined(NOPORTS)
801	@mkdir -p ${CD_DISC1}/ports && \
802	  tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
803	  ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
804	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
805	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
806.endif
807	touch cdrom.1
808
809iso.1:
810	@if [ -r ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ]; then \
811		echo "Creating ISO images..."; \
812		sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ${BOOTABLE} \
813		  fbsd_miniinst ${CD}/miniinst.iso ${CD_DISC1}; \
814		sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ${BOOTABLE} \
815		  fbsd_livefs ${CD}/disc2.iso ${CD_DISC2}; \
816		if [ "x${CD_EXTRA_BITS}" != "x" ]; then \
817			sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ${BOOTABLE} \
818			  fbsd_boot ${CD}/disc1.iso ${CD_DISC1} ${CD_EXTRA_BITS}; \
819			    && false; \
820		fi \
821	else \
822		echo "Do not know how to create an ISO for ${MACHINE_ARCH}."; \
823	fi
824	touch iso.1
825
826#
827# --==## Documentation Project files such as the Handbook and FAQ ##==--
828#
829doc.1:
830	@echo "Making docs..."
831	@for i in ${DOCPORTS}; do \
832	  cd /usr/ports/$$i && make all install clean BATCH=yes JADETEX=no FORCE_PKG_REGISTER=yes; \
833	done
834	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc
835	touch doc.1
836
837#
838# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
839#
840doc.2:
841	@echo "Making release documentation..."
842	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' INSTALL_COMPRESSED='' DOCDIR=${RND}
843	touch doc.2
844
845# Various "subroutine" and other supporting targets.
846
847# RD=
848# SD=
849# TD=
850# ARG=
851doTARBALL:
852.if !defined(SD)
853	@echo "SD undefined in doTARBALL" && exit 1
854.endif
855.if !defined(TD)
856	@echo "TD undefined in doTARBALL" && exit 1
857.endif
858.if !defined(ARG)
859	@echo "ARG undefined in doTARBALL" && exit 1
860.endif
861	@rm -rf ${RD}/dists/${TD}/${TN}*
862	@mkdir -p ${RD}/dists/${TD}
863	@( cd ${SD} && \
864		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
865		echo rolling ${TD}/$$tn tarball &&\
866		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
867		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
868		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
869		   ${RD}/dists/${TD}/$$tn.inf && \
870		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
871		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
872		fi && \
873		if [ "${SD}" != "/usr/src" ]; then \
874			mtree -c -i -p ${SD}/${ARG} \
875			  -k gname,md5digest,mode,nlink,uname,size,link,type \
876			  > ${RD}/dists/${TD}/$$tn.mtree ; \
877		else \
878			true; \
879		fi; \
880		(cd ${RD}/dists/${TD}; \
881		   rm -f CHECKSUM.MD5; \
882		   md5 * > CHECKSUM.MD5) \
883	)
884
885doRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
886		release.6 release.7 release.8 release.9
887	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
888	@echo "Release done"
889
890floppies:
891	@cd ${.CURDIR} && ${MAKE} boot.flp
892	@cd ${.CURDIR} && ${MAKE} fixit.flp
893	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
894
895boot.flp:
896	@rm -f release.4 release.8
897	@cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
898
899fixit.flp:
900	@rm -f release.4 release.9
901	@cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
902
903installCRUNCH:
904.if !defined(CRUNCH)
905	@echo "CRUNCH undefined in installCRUNCH" && exit 1
906.endif
907.if !defined(DIR)
908	@echo "DIR undefined in installCRUNCH" && exit 1
909.endif
910.if !defined(ZIP)
911	@echo "ZIP undefined in installCRUNCH" && exit 1
912.endif
913	@if ${ZIP} ; then \
914		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
915	else \
916		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
917	fi
918	@chmod 555 ${DIR}/${CRUNCH}_crunch
919	@if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \
920		for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \
921			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
922		done \
923	else \
924		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
925			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
926		done \
927	fi
928
929#
930# --==## Put a filesystem into a BOOTMFS kernel ##==--
931#
932doMFSKERN:
933	@echo "Running ${.TARGET} for ${FSIMAGE}"
934	@rm -f ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
935	cd ${.CURDIR}/..; \
936	KERNEL_KO=BOOTMFS KODIR= \
937	    ${MAKE} ${KERNEL_FLAGS} -DNO_WERROR -DNO_MODULES -DNO_KERNELCLEAN \
938	    KERNCONF=BOOTMFS buildkernel reinstallkernel \
939	    DESTDIR=${RD}/kernels
940.if exists(${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS.hints)
941	cp ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS.hints ${RD}/kernels
942.endif
943	@rm -rf ${RD}/image.${FSIMAGE}
944	@mkdir ${RD}/image.${FSIMAGE}
945	@cd ${RD}/kernels && \
946	  (chflags noschg BOOTMFS || true) && \
947	  strip BOOTMFS && \
948	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
949	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
950	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
951	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
952	@mkdir -p ${RD}/image.${FSIMAGE}/boot
953.if ${MACHINE} == "i386"
954	@kgzip -vo ${RD}/image.${FSIMAGE}/boot/loader /boot/loader
955.else
956	@cp /boot/loader ${RD}/image.${FSIMAGE}/boot
957.endif
958	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
959	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
960	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
961	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
962	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
963	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
964.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
965	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
966	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
967	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
968.endif
969	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
970	@echo "set hint.acpi.0.disable=1" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
971	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
972	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
973.if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
974	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
975.endif
976	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
977	@rm -f ${RD}/floppies/${FSIMAGE}.flp
978.if defined(FDSIZE) && ${FDSIZE} == "BIG"
979	@cp mfsroot.gz ${RD}/image.${FSIMAGE}
980	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
981		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
982		${BOOTINODE} ${BIGBOOTLABEL}
983.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
984	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
985		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
986		${BOOTINODE} ${SMALLBOOTLABEL}
987.else
988	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
989		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
990		${BOOTINODE} ${BOOTLABEL}
991.endif
992	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
993
994.include <bsd.prog.mk>
995