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