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