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