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