Makefile revision 128959
1# $FreeBSD: head/release/Makefile 128959 2004-05-05 13:06:40Z hrs $
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.2-RELEASE
22#
23# Automatic SNAP versioning:
24DATE != date +%Y%m%d
25BASE = 5.2
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# Make changing names of disc1/disc2 CD's possible.
119DISC1_LABEL?=	fbsd_miniinst
120DISC1_NAME?=	miniinst
121DISC2_LABEL?=	fbsd_livefs
122DISC2_NAME?=	disc2
123
124# Helper variable
125.if defined(NOPORTS)
126.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
127NOPORTSATALL=	YES
128.endif
129.endif
130
131# By default, documentation (Handbook, FAQ, etc.) is built for all
132# the languages.  To speed up building, set the DOC_LANG to just
133# the languages you need.  (The language for the release notes is
134# controlled by the RELNOTES_LANG variable above.)
135#DOC_LANG=	en_US.ISO8859-1
136DOCPORTS=	textproc/docproj
137# Set this to wherever the distfiles required by release procedures.
138.if defined(DOCDISTFILES)
139# Respect DOCDISTFILES which is used before.
140RELEASEDISTFILES?=	${DOCDISTFILES}
141.else
142RELEASEDISTFILES?=	${.CURDIR}/../../ports/distfiles
143.endif
144# Set this to 1 if you want -P to be used for automatic keyboard detection
145# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
146AUTO_KEYBOARD_DETECT?= 0
147
148.if !defined(NODOC)
149DIST_DOCS_ARCH_INDEP=	readme errata early-adopter
150DIST_DOCS_ARCH_DEP=	installation relnotes hardware
151.endif
152
153# Things which without too much trouble can be considered variables
154# BASE_DISTS are special in that they get full /etc installation sets.
155#
156.if ${TARGET_ARCH} == "i386"
157COMPAT_DISTS?=	compat1x compat20 compat21 compat22 compat3x compat4x
158.elif ${TARGET_ARCH} == "alpha"
159COMPAT_DISTS?=	compat4x
160.endif
161OTHER_DISTS?=	catpages manpages games proflibs dict info doc
162CRYPTO_DISTS?=	crypto
163BASE_DISTS?=	base
164DISTRIBUTIONS?=	${BASE_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
165
166# mountpoint for filesystems.
167MNT=			/mnt
168
169# Various floppy image parameters.
170#
171
172.if ${TARGET_ARCH} == "i386"
173.if ${TARGET} == "pc98"
174SMALLFLOPPYSIZE=	1200
175SMALLFLOPPYSPLITSIZE=	1152
176SMALLFLOPPYLABEL=	fd1200
177SPLIT_MFSROOT=
178.endif
179FLOPPYSIZE=		1440
180FLOPPYSPLITSIZE=	1392
181FLOPPYINODE=		40000
182FLOPPYLABEL=		fd1440
183BOOTINODE=		80000
184MFSSIZE=		4320
185MFSINODE=		8000
186MFSLABEL=		minimum3
187.elif ${TARGET_ARCH} == "alpha"
188FLOPPYSIZE=		1440
189FLOPPYSPLITSIZE=	1392
190FLOPPYINODE=		40000
191FLOPPYLABEL=		fd1440
192BOOTINODE=		80000
193MFSSIZE=		4320
194MFSINODE=		8000
195MFSLABEL=		auto
196SPLIT_MFSROOT=
197.elif ${TARGET_ARCH} == "sparc64"
198DISKLABEL=		sunlabel
199MFSSIZE=		4096
200MFSINODE=		8192
201MFSLABEL=		auto
202MINIROOT=
203NO_FLOPPIES=
204.elif ${TARGET_ARCH} == "ia64"
205MFSSIZE=		8192
206MFSINODE=		8192
207MFSLABEL=		auto
208NO_FLOPPIES=
209.elif ${TARGET_ARCH} == "amd64"
210MFSSIZE=		4096
211MFSINODE=		8192
212MFSLABEL=		auto
213NO_FLOPPIES=
214.endif
215
216.if exists(/sbin/bsdlabel)
217DISKLABEL?=		bsdlabel
218.else
219DISKLABEL?=		disklabel
220.endif
221
222ZIPNSPLIT=		gzip --no-name -9 -c | split -b 1392k -
223
224# Things that need to be compiled without crypto support in releases
225.if !defined(FIXCRYPTO) && !make(release) && !make(rerelease)
226FIXCRYPTO!=	cd ${.CURDIR}/../secure; ${MAKE} -V SPROGS
227.endif
228
229# Things which may get you into trouble if you change them
230MTREEFILES=		${.CURDIR}/../etc/mtree
231_R?=			/R
232RD=			${_R}/stage
233RND=			${RD}/release.doc
234FD=			${_R}/ftp
235CD=			${_R}/cdrom
236.if ${TARGET} != "pc98"
237CD_BOOT=		${CD}/bootonly
238.endif
239CD_DISC1=		${CD}/disc1
240CD_DISC2=		${CD}/disc2
241_MK?=			${CHROOTDIR}/mk
242
243# Where the bootstrap ports (see DOCPORTS) get installed.
244LOCALDIR=		/usr/local/bin
245
246.if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel"
247DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
248.else
249DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
250.endif
251
252CRUNCH_TARGETS=	boot
253.if ${TARGET_ARCH} == "i386"
254CRUNCH_TARGETS+=fixit
255.if ${TARGET} == "pc98"
256CRUNCH_TARGETS+=fixit-small
257.endif
258.endif
259
260.if !defined(NO_FLOPPIES)
261EXTRAS= floppies.1
262.if ${TARGET_ARCH} == "i386"
263EXTRAS+= floppies.2
264.endif
265EXTRAS+= floppies.3
266.endif
267EXTRAS+= ftp.1
268.if !defined(NOCDROM)
269EXTRAS+= cdrom.1
270.if defined(MAKE_ISOS)
271EXTRAS+= iso.1
272.endif
273.if ${TARGET} == "pc98"
274BOOTABLE=
275.else
276BOOTABLE="-b"
277.endif
278.endif
279
280.if !defined(NODOC)
281DOCREL= doc.1 doc.2
282.endif
283
284.if !make(release) && !make(rerelease)
285BINMAKE!=	cd ${.CURDIR}/..; ${MAKE} -V BINMAKE
286WMAKEENV!=	cd ${.CURDIR}/..; \
287		${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV
288WMAKE=		${WMAKEENV} ${BINMAKE}
289.endif
290
291CVS_SRCARGS=	-P
292.if defined(RELEASETAG)
293CVS_SRCARGS+=	-r ${RELEASETAG}
294.endif
295
296CVS_DOCARGS=	-P
297.if defined(DOCRELEASETAG)
298CVS_DOCARGS+=	-r ${DOCRELEASETAG}
299.endif
300
301CVS_PORTSARGS=	-P
302.if defined(PORTSRELEASETAG)
303CVS_PORTSARGS+=	-r ${PORTSRELEASETAG}
304.endif
305
306WORLDDIR?=	${.CURDIR}/..
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 ${WORLDDIR} && ${NATIVEMAKE} -DNOGAMES -DNOHTML -DNOINFO -DNOMAN \
330	    -DNOPROFILE installworld DESTDIR=${CHROOTDIR}
331	cd ${WORLDDIR}/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 -H ${EXTLOCALDIR} local
338.endif
339	rm -rf ${CHROOTDIR}/usr/src
340.if defined(EXTSRCDIR)
341	cd ${CHROOTDIR}/usr && \
342	    cp -R -H ${EXTSRCDIR} src
343.else
344	cd ${CHROOTDIR}/usr && \
345	    ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
346	    co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
347.endif
348.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
349.for p in ${LOCAL_PATCHES}
350.if exists(${p})
351	patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p}
352.endif
353.endfor
354.endif
355.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
356	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \
357	    RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
358.endif
359	rm -rf ${CHROOTDIR}/usr/ports
360.if !defined(NOPORTSATALL)
361	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
362	    co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
363.endif
364.if !defined(NODOC)
365	rm -rf ${CHROOTDIR}/usr/doc
366.if defined(EXTDOCDIR)
367	cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
368.else
369	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
370	    co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
371.endif
372	if [ -d ${RELEASEDISTFILES}/ ]; then \
373		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
374	else \
375		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
376	fi
377.if !defined(NO_PREFETCHDISTFILES)
378	@cd ${.CURDIR} && ${MAKE} fetch-distfiles
379.endif
380.endif
381.endif
382.if make(rerelease)
383.if !defined(RELEASENOUPDATE)
384.if !defined(RELEASETAG)
385	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
386	    update ${CVSCMDARGS} -P -d -A
387.else
388	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
389	    update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
390.endif
391	rm -f ${CHROOTDIR}/tmp/.world_done 
392.if !defined(NOPORTS)
393	cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
394	    update ${CVSCMDARGS} -P -d
395.endif
396.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
397	for i in ${MINIMALDOCPORTS}; do \
398	    ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
399		update ${CVSCMDARGS} -P -d ) ; \
400	done
401.endif
402.if !defined(NODOC)
403	cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
404	    update ${CVSCMDARGS} -P -d
405.endif
406.endif
407.endif
408	# Add version information to those things that need it.
409	if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
410		cd ${CHROOTDIR}/usr/src/sys/conf && \
411		mv newvers.sh foo && \
412		sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
413		rm foo; \
414	fi
415	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
416	echo "#!/bin/sh"			> ${_MK}
417	echo "set -ex"				>> ${_MK}
418	echo "trap 'umount /dev || true' 0"	>> ${_MK}
419	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${_MK}
420.for var in \
421	AUTO_KEYBOARD_DETECT \
422	BOOT_CONFIG \
423	BUILDNAME \
424	CD_EXTRA_BITS \
425	DISC1_LABEL \
426	DISC1_NAME \
427	DISC2_LABEL \
428	DISC2_NAME \
429	DISTRIBUTIONS \
430	DOC_LANG \
431	DOMINIMALDOCPORTS \
432	EXTRA_SRC \
433	FIXCRYPTO \
434	FTP_PASSIVE_MODE \
435	FTP_PROXY \
436	HTTP_PROXY \
437	KERNELS \
438	KERNEL_FLAGS \
439	MAKE_ISOS \
440	NOCDROM \
441	NODOC \
442	NOPORTS \
443	NOSHARED \
444	NOSRC \
445	NO_CPU_CFLAGS \
446	NO_CPU_COPTFLAGS \
447	NO_FLOPPIES \
448	NO_SENDMAIL \
449	RELEASETAG \
450	RELNOTES_LANG \
451	TARGET \
452	TARGET_ARCH \
453	WORLD_FLAGS
454.if defined(${var})
455	echo "export ${var}=\"${${var}}\""	>> ${_MK}
456.endif
457.endfor
458	# Don't remove this, or the build will fall over!
459	echo "export RELEASEDIR=${_R}"		>> ${_MK}
460	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${_MK}
461	echo "export MANBUILDCAT=YES"		>> ${_MK}
462	# NB: these may fail if the host is running w/o devfs
463	echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK}
464	echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true"	>> ${_MK}
465	echo "if [ -x /etc/rc.d/ldconfig ]; then" >> ${_MK}
466	echo "	/etc/rc.d/ldconfig start"	>> ${_MK}
467	echo "else"				>> ${_MK}
468	echo "	ldconfig /lib /usr/lib /usr/local/lib || true" >> ${_MK}
469	echo "fi"				>> ${_MK}
470	echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK}
471	echo "	cd /usr/src"			>> ${_MK}
472	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${_MK}
473	echo "	touch /tmp/.world_done"		>> ${_MK}
474	echo "fi"				>> ${_MK}
475	echo "if [ ! -f /tmp/.skip_ports ]; then" >> ${_MK}
476	echo "	echo \">>> make readmes started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
477	echo "	cd /usr/ports"			>> ${_MK}
478	echo "	make ${PORTREADMES_FLAGS} readmes" >> ${_MK}
479	echo "	touch /tmp/.skip_ports"		>> ${_MK}
480	echo "	echo \">>> make readmes finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
481	echo "fi"				>> ${_MK}
482	echo "cd /usr/src/release"		>> ${_MK}
483	echo "make obj"				>> ${_MK}
484	echo "make \$${_RELTARGET}"		>> ${_MK}
485	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
486	chmod 755 ${_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 
491	# the kernel
492	-mdconfig 2>/dev/null
493	env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}`
494
495clean:
496	rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-9] ${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 non-crypto versions of some tools.
538release.3:
539	# Handle some grief caused by the munition braindeadness.
540	cd ${.CURDIR}/..; \
541	${CROSSMAKE} ${WORLD_FLAGS} -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.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
573	rm -rf ${j}_crunch
574	mkdir ${j}_crunch
575	cd ${j}_crunch; ${WMAKEENV} crunchgen -o \
576	    ${.CURDIR}/${TARGET}/${j}_crunch.conf
577	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
578	cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools
579	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk \
580	    CFLAGS="-Os -pipe" -DNO_CPU_CFLAGS all
581	${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
582	mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
583.endif
584.endfor
585	touch ${.TARGET}
586
587#
588# --==## Fix up the distributions. ##==--
589#
590release.6:
591	# Create any "synthetic dists" now.
592	@for i in ${DISTRIBUTIONS}; do \
593		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
594			echo -n "Running $$i dist creation script... "; \
595			env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
596			echo "Done."; \
597		fi \
598	done \
599
600	# Remove all the directories we don't need.
601	-cd ${RD}/trees && \
602		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
603	touch ${.TARGET}
604
605#
606# --==## Package up the tarballs from assembled trees ##==--
607#
608release.7:
609	rm -rf ${RD}/dists
610	mkdir -p ${RD}/dists
611	@for i in ${DISTRIBUTIONS} ; \
612	do \
613		if [ -d ${RD}/trees/$${i} ] ; then \
614			cd ${.CURDIR} && $(MAKE) doTARBALL \
615				SD=${RD}/trees/$${i} \
616				TN=$$i TD=$$i ARG="." && \
617			echo "$${i} distribution is finished."; \
618		fi ; \
619	done
620.if !defined(NOPORTS)
621	# XXX: Inline stripped version of doTARBALL
622	@rm -rf ${RD}/dists/ports/ports*
623	@mkdir -p ${RD}/dists/ports
624	@echo rolling ports/ports tarball
625	@tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
626	  ${RD}/dists/ports/ports.tgz -C /usr ports
627	@cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
628	@(cd ${RD}/dists/ports; \
629	  rm -f CHECKSUM.MD5; \
630	  md5 * > CHECKSUM.MD5)
631	@echo "ports distribution is finished."
632.endif
633	touch ${.TARGET}
634
635
636#
637# --==## Make source dists ##==--
638#
639release.8:
640.if !defined(NOSRC)
641	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
642		TD=src TN=sbase ARG="[A-Z]*"
643	@for i in `cd /usr/src && echo [a-z]*` ; do \
644		if [ -d /usr/src/$$i ] ; then \
645			cd ${.CURDIR} && $(MAKE) doTARBALL \
646				TN=`echo s$$i | tr -d '.' | \
647				    sed -e 's/usr/u/' \
648					-e 's/kerberos5/krb5/'` \
649				SD=/usr/src TD=src ARG="$$i" ; \
650		fi ; \
651	done
652.if defined(EXTRA_SRC)
653	@set ${EXTRA_SRC} && \
654	while [ $$# -ge 2 ] ; do \
655		if [ -d /usr/src/$$1 ] ; then \
656			cd ${.CURDIR} && $(MAKE) doTARBALL \
657				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
658		fi && shift && shift ; \
659	done
660.endif
661	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
662		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
663		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
664		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
665		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
666		md5 * > CHECKSUM.MD5 ) ; fi
667	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
668	@echo "src distribution is finished."
669.endif
670	touch ${.TARGET}
671
672# Build the memory root filesystem.
673release.9:
674	cp ${RD}/trees/base/etc/disktab /etc
675	rm -rf ${RD}/mfsfd
676	mkdir ${RD}/mfsfd
677	cd ${RD}/mfsfd && \
678		mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help
679	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
680		DIR=${RD}/mfsfd/stand ZIP=false
681	( cd ${RD}/mfsfd && \
682	  for dir in bin sbin ; do \
683		ln -sf /stand $$dir; \
684	  done )
685	cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
686.if ${TARGET} == "pc98"
687	cp ${.CURDIR}/../etc/defaults/pccard.conf \
688	    ${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	grep 'operator' ${RD}/trees/base/etc/group \
700	    > ${RD}/mfsfd/stand/etc/group
701	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
702	ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group
703	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
704	cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
705.if !defined(NODOC)
706	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
707	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
708	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
709	done
710	@for i in ${DIST_DOCS_ARCH_DEP}; do \
711	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
712	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
713	done
714	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT \
715	    ${RD}/mfsfd/stand/help/INSTALL.TXT
716	@mv ${RD}/mfsfd/stand/help/EARLY-ADOPTER.TXT \
717	    ${RD}/mfsfd/stand/help/EARLY.TXT
718.endif
719	-test -f ${.CURDIR}/install.cfg \
720	    && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
721	@mkdir -p ${RD}/mfsfd/boot
722.if ${TARGET_ARCH} != "ia64"
723	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
724.endif
725.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
726	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
727.endif
728	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
729		tar xf - -C ${RD}/mfsfd/stand
730	@mkdir -p ${RD}/mfsroot
731	sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
732	    ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
733	@gzip -9fnv ${RD}/mfsroot/mfsroot
734	touch ${.TARGET}
735
736KERNFLOPPYSET=		${RD}/floppyset/kern/kernel.gz
737.if defined(SMALLFLOPPYSIZE)
738SMALLKERNFLOPPYSET=	${RD}/floppyset/kern-small/kernel.gz
739.endif
740.if defined(SPLIT_MFSROOT)
741MFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot/mfsroot.gz
742.if defined(SMALLFLOPPYSIZE)
743SMALLMFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot-small/mfsroot.gz
744.endif
745.endif
746
747# Build boot and install floppies.
748floppies.1:
749	@gzip -9nc ${RD}/trees/base/boot/kernel/kernel > ${RD}/kernels/kernel.gz
750	@echo "Making the kernel boot floppies..."
751	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \
752	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz
753.if defined(SMALLFLOPPYSIZE)
754	@echo "Making the small kernel boot floppies..."
755	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern-small \
756	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz \
757	    FDSIZE="SMALL"
758.endif
759.if defined(SPLIT_MFSROOT)
760	@echo "Making the mfsroot boot floppies..."
761	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot \
762	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz
763.if defined(SMALLFLOPPYSIZE)
764	@echo "Making the small mfsroot boot floppies..."
765	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot-small \
766	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz \
767	    FDSIZE="SMALL"
768.endif
769	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
770	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
771	    MFSROOTFILE="${MFSROOTFLOPPYSET}.split ${MFSROOTFLOPPYSET}.boot"
772.if defined(SMALLFLOPPYSIZE)
773	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
774	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
775	    MFSROOTFILE="${SMALLMFSROOTFLOPPYSET}.split ${SMALLMFSROOTFLOPPYSET}.boot" \
776	    FDSIZE="SMALL"
777.endif
778.else	# !SPLIT_MFSROOT
779	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
780	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
781	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz
782.if defined(SMALLFLOPPYSIZE)
783	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
784	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
785	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz \
786	    FDSIZE="SMALL"
787.endif
788.endif	# SPLIT_MFSROOT
789	touch ${.TARGET}
790
791# Build fixit floppy.
792floppies.2:
793	@echo "Making fixit floppy."
794	@rm -rf ${RD}/fixitfd
795	@mkdir ${RD}/fixitfd
796	@cd ${RD}/fixitfd && \
797	    mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
798	    usr/share/misc
799	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
800	    ${RD}/fixitfd/etc
801	@sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
802	    > ${RD}/fixitfd/etc/protocols
803	@sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
804	    > ${RD}/fixitfd/usr/share/misc/scsi_modes
805	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
806	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
807	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
808	@chmod 555 ${RD}/fixitfd/stand/tar
809.if defined(SMALLFLOPPYSIZE)
810	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
811	    DIR=${RD}/fixitfd/stand ZIP=false
812	@sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \
813	    ${SMALLFLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${SMALLFLOPPYLABEL}
814	@rm -rf ${RD}/fixitfd/stand
815	@mkdir ${RD}/fixitfd/stand
816.endif
817	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
818	    DIR=${RD}/fixitfd/stand ZIP=false
819	@sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \
820	    ${FLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${FLOPPYLABEL}
821	touch ${.TARGET}
822
823# Do our last minute floppies directory setup
824floppies.3:
825.if !defined(NODOC)
826	@cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \
827	    ${RD}/floppies/README.TXT
828	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
829.else
830	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
831.endif
832	touch ${.TARGET}
833
834#
835# --==## Setup a suitable ftp-area ##==--
836#
837ftp.1:
838	@echo "Setting up FTP distribution area"
839	@mkdir -p ${FD}
840	-@ln -s . ${FD}/${BUILDNAME}
841.if !defined(NO_FLOPPIES)
842	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
843.endif
844	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
845.if !defined(NODOC)
846	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
847		cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
848		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
849		cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
850		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
851	done
852	@for i in ${DIST_DOCS_ARCH_DEP}; do \
853		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
854		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
855		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
856		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
857	done
858	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
859	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
860	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
861	@mv ${FD}/EARLY-ADOPTER.TXT ${FD}/EARLY.TXT
862	@mv ${FD}/EARLY-ADOPTER.HTM ${FD}/EARLY.HTM
863.endif
864	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
865	touch ${.TARGET}
866
867#
868# --==## Setup a suitable cdrom-area ##==--
869#
870cdrom.1:
871	@echo "Setting up CDROM distribution area"
872	@mkdir -p ${CD_BOOT} ${CD_DISC1} ${CD_DISC2}
873	-@ln -s . ${CD_DISC1}/${BUILDNAME}
874.if !defined(NO_FLOPPIES)
875	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
876.endif
877	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
878	@for i in ${DISTRIBUTIONS} ; \
879	do \
880		if [ -d ${RD}/trees/$${i} ] ; then \
881			chflags -R noschg ${RD}/trees/$${i} || true ; \
882			( cd ${RD}/trees/$${i} && \
883			    find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
884		fi \
885	done
886	@rm -f ${CD_DISC2}/.profile
887	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
888	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
889	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
890.if !defined(NODOC)
891	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
892	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
893	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
894	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
895	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
896	done
897	@for i in ${DIST_DOCS_ARCH_DEP}; do \
898	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
899	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
900	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
901	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
902	done
903	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
904	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
905	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
906	@mv ${CD_DISC1}/EARLY-ADOPTER.TXT ${CD_DISC1}/EARLY.TXT
907	@mv ${CD_DISC1}/EARLY-ADOPTER.HTM ${CD_DISC1}/EARLY.HTM
908.endif
909.if ${TARGET} != "pc98"
910	@echo "Setting up boot area"
911	@rm -f ${CD_DISC2}/boot/loader.conf
912	@cp ${RD}/mfsroot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
913	@echo 'mfsroot_load="YES"' > ${CD_DISC2}/boot/loader.conf
914	@echo 'mfsroot_type="mfs_root"' >> ${CD_DISC2}/boot/loader.conf
915	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC2}/boot/loader.conf
916.if defined(CD_BOOT)
917	@cp -Rp ${CD_DISC2}/boot ${CD_BOOT}
918.if defined(MINIROOT)
919	@mkdir -p ${FD}/miniroot
920	@sh -e ${DOFS_SH} ${FD}/miniroot/miniroot.ufs \
921	    ${RD} ${MNT} 0 ${CD_BOOT} 8192 auto
922	@gzip -9v ${FD}/miniroot/miniroot.ufs
923.endif
924.endif
925	@cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
926.endif
927	touch ${.TARGET}
928
929iso.1:
930.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
931	@echo "Creating ISO images..."
932.if defined(CD_BOOT)
933	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
934	    fbsd_bootonly \
935	    ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT}
936.endif
937	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
938	    ${DISC1_LABEL} \
939	    ${CD}/${BUILDNAME}-${TARGET}-${DISC1_NAME}.iso ${CD_DISC1}
940	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
941	    ${DISC2_LABEL} \
942	    ${CD}/${BUILDNAME}-${TARGET}-${DISC2_NAME}.iso ${CD_DISC2}
943.if defined(CD_EXTRA_BITS)
944	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
945	    fbsd_boot \
946	    ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
947	    ${CD_EXTRA_BITS} \
948	    && false
949.endif
950	@(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5)
951	touch ${.TARGET}
952.else
953	@echo "Do not know how to create an ISO for ${TARGET_ARCH}."
954.endif
955
956#
957# --==## Documentation Project files such as the Handbook and FAQ ##==--
958#
959doc.1:
960	@echo "Making docs..."
961	@for i in ${DOCPORTS}; do \
962	    cd /usr/ports/$$i && \
963	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
964		make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
965		WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
966	done
967	@cd /usr/doc && make all install 'FORMATS=html html-split txt' \
968	    INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc \
969	    URLS_ABSOLUTE=YES	
970	touch ${.TARGET}
971
972#
973# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
974#
975doc.2:
976	@echo "Making release documentation..."
977	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \
978	    INSTALL_COMPRESSED='' DOCDIR=${RND}
979	touch ${.TARGET}
980
981# Various "subroutine" and other supporting targets.
982
983# RD=
984# SD=
985# TD=
986# ARG=
987doTARBALL:
988.if !defined(SD)
989	@echo "SD undefined in doTARBALL" && exit 1
990.endif
991.if !defined(TD)
992	@echo "TD undefined in doTARBALL" && exit 1
993.endif
994.if !defined(ARG)
995	@echo "ARG undefined in doTARBALL" && exit 1
996.endif
997	@rm -rf ${RD}/dists/${TD}/${TN}*
998	@mkdir -p ${RD}/dists/${TD}
999	@( cd ${SD} && \
1000		tn=`echo ${TN} | tr 'A-Z' 'a-z' | cut -c1-8` && \
1001		echo rolling ${TD}/$$tn tarball &&\
1002		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
1003		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
1004		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
1005		    > ${RD}/dists/${TD}/$$tn.inf && \
1006		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
1007			cp -p ${.CURDIR}/scripts/$${TD}-install.sh \
1008			    ${RD}/dists/${TD}/install.sh; \
1009		fi && \
1010		if [ "${SD}" != "/usr/src" ]; then \
1011			mtree -c -i -p ${SD}/${ARG} \
1012			  -k gname,md5digest,mode,nlink,uname,size,link,type \
1013			  > ${RD}/dists/${TD}/$$tn.mtree ; \
1014		else \
1015			true; \
1016		fi; \
1017		( cd ${RD}/dists/${TD}; \
1018		rm -f CHECKSUM.MD5; \
1019		md5 * > CHECKSUM.MD5 ) \
1020	)
1021
1022doRELEASE: release.1 release.2 release.3 ${DOCREL} release.4 release.5 \
1023    release.6 release.7 release.8 release.9 ${EXTRAS}
1024	@echo "Release done"
1025
1026floppies:
1027	@rm -f release.5 release.9 floppies.[123]
1028	@cd ${.CURDIR} && ${MAKE} release.5 release.9 floppies.1 floppies.2 \
1029	    floppies.3
1030	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
1031
1032installCRUNCH:
1033.if !defined(CRUNCH)
1034	@echo "CRUNCH undefined in installCRUNCH" && exit 1
1035.endif
1036.if !defined(DIR)
1037	@echo "DIR undefined in installCRUNCH" && exit 1
1038.endif
1039.if !defined(ZIP)
1040	@echo "ZIP undefined in installCRUNCH" && exit 1
1041.endif
1042	@if ${ZIP} ; then \
1043		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1044	else \
1045		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1046	fi
1047	@chmod 555 ${DIR}/${CRUNCH}_crunch
1048	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1049		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1050			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1051		done \
1052	else \
1053		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1054			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1055		done \
1056	fi
1057
1058#
1059# --==## Build a floppy set for a splitfs file ##==--
1060#
1061# FLOPPYBASE - basename of floppy image files
1062# FLOPPYDESC - description of floppy set
1063# SPLITFILE - filename of the file to split
1064# FDSIZE - if specified and "small", small floppy is created
1065
1066.if make(makeFloppySet)
1067SPLITDIR=	${RD}/floppyset/${FLOPPYBASE}
1068.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1069FLPSPLITSIZE=	${SMALLFLOPPYSPLITSIZE}
1070FLPSIZE=	${SMALLFLOPPYSIZE}
1071FLPLABEL=	${SMALLFLOPPYLABEL}
1072.else
1073FLPSPLITSIZE=	${FLOPPYSPLITSIZE}
1074FLPSIZE=	${FLOPPYSIZE}
1075FLPLABEL=	${FLOPPYLABEL}
1076.endif
1077.endif
1078
1079makeFloppySet:
1080.if !defined(FLOPPYBASE)
1081	@echo "FLOPPYBASE undefined in ${.TARGET}" && exit 1
1082.endif
1083.if !defined(FLOPPYDESC)
1084	@echo "FLOPPYDESC undefined in ${.TARGET}" && exit 1
1085.endif
1086.if !defined(SPLITFILE)
1087	@echo "SPLITFILE undefined in ${.TARGET}" && exit 1
1088.endif
1089	sh ${.CURDIR}/scripts/split-file.sh ${SPLITFILE} \
1090	    ${RD}/floppyset/${FLOPPYBASE} ${FLPSPLITSIZE} "${FLOPPYDESC}"
1091	( splitfile=${SPLITDIR}/`basename ${SPLITFILE}`.split ; \
1092	lines=`cat $${splitfile} | wc -l`; \
1093	lines=$$((lines - 1)) ; \
1094	for line in `jot $$lines`; do \
1095		file=`head -n $$(($${line} + 1)) $${splitfile} | tail -1 | cut -f 1 -d ' '` ; \
1096		sh -e ${DOFS_SH} ${RD}/floppies/${FLOPPYBASE}$${line}.flp \
1097		${RD} ${MNT} ${FLPSIZE} ${SPLITDIR}/$${file} \
1098		${BOOTINODE} ${FLPLABEL}; \
1099	done )
1100
1101#
1102# --==## Build a boot floppy ##==--
1103#
1104# FSIMAGE - base floppy image name
1105# FDSIZE - if specified and "small", small floppy is created
1106# KERNFILE - path to kernel split file
1107# MFSROOTFILE - path to mfsroot split file
1108
1109.if make(buildBootFloppy)
1110IMAGEDIR=	${RD}/image.${FSIMAGE}
1111BOOTDIR=	${RD}/trees/base/boot
1112HINTSFILE=	${BOOTDIR}/device.hints
1113ACPI_KO=	${BOOTDIR}/kernel/acpi.ko
1114IMAGEFILE=	${RD}/floppies/${FSIMAGE}.flp
1115.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1116FLPSIZE=	${SMALLFLOPPYSIZE}
1117FLPLABEL=	${SMALLFLOPPYLABEL}
1118.else
1119FLPSIZE=	${FLOPPYSIZE}
1120FLPLABEL=	${FLOPPYLABEL}
1121.endif
1122.endif
1123
1124buildBootFloppy:
1125.if !defined(FSIMAGE)
1126	@echo "FSIMAGE undefined in ${.TARGET}" && exit 1
1127.endif
1128.if !defined(KERNFILE)
1129	@echo "KERNFILE undefined in ${.TARGET}" && exit 1
1130.endif
1131.if !defined(MFSROOTFILE)
1132	@echo "MFSROOTFILE undefined in ${.TARGET}" && exit 1
1133.endif
1134	@echo "Running ${.TARGET} for ${FSIMAGE}"
1135	@rm -rf ${IMAGEDIR}
1136	@mkdir ${IMAGEDIR}
1137	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
1138	@mkdir -p ${IMAGEDIR}/boot
1139.if ${TARGET} == "i386"
1140	@${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \
1141	    ${IMAGEDIR}/boot/loader ${BOOTDIR}/loader
1142.else
1143	@cp ${BOOTDIR}/loader ${IMAGEDIR}/boot
1144.endif
1145	@cp -Rp ${BOOTDIR}/*.4th ${BOOTDIR}/defaults ${BOOTDIR}/loader.help \
1146	    ${BOOTDIR}/loader.rc ${IMAGEDIR}/boot
1147.if exists(${HINTSFILE})
1148	@gzip -9nc ${HINTSFILE} > ${IMAGEDIR}/boot/device.hints.gz
1149.endif
1150	@gzip -9n ${IMAGEDIR}/boot/*.4th ${IMAGEDIR}/boot/loader.help \
1151	    ${IMAGEDIR}/boot/defaults/loader.conf
1152	@echo 'bootfile="/kernel"' > ${IMAGEDIR}/boot/loader.conf
1153.if exists(${ACPI_KO})
1154	@gzip -9nc ${ACPI_KO} > ${IMAGEDIR}/acpi.ko.gz
1155	@echo 'acpi_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
1156	@echo 'acpi_name="/acpi.ko"' >> ${IMAGEDIR}/boot/loader.conf
1157	@echo 'acpi_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1158.endif
1159	@echo 'mfsroot_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
1160	@echo 'mfsroot_type="mfs_root"' >> ${IMAGEDIR}/boot/loader.conf
1161	@echo 'mfsroot_name="/mfsroot"' >> ${IMAGEDIR}/boot/loader.conf
1162.if !exists(${ACPI_KO})
1163	@echo 'mfsroot_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1164.endif
1165.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
1166	@echo "-P" >> ${IMAGEDIR}/boot.config
1167.endif
1168	@rm -f ${IMAGEFILE}
1169	@cp ${KERNFILE} ${MFSROOTFILE} ${IMAGEDIR}
1170	sh -e ${DOFS_SH} ${IMAGEFILE} ${RD} ${MNT} ${FLPSIZE} ${IMAGEDIR} \
1171	    ${BOOTINODE} ${FLPLABEL}
1172	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1173
1174.include <bsd.obj.mk>
1175