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