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