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