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