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