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