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