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