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