Makefile revision 124638
1# $FreeBSD: head/release/Makefile 124638 2004-01-17 19:22:36Z 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.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} != "ia64"
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"
168SMALLBOOTSIZE=		1200
169BOOTSIZE=		1440
170SMALLFIXITSIZE=		1200
171FIXITSIZE=		1440
172MFSSIZE=		4320
173BOOTINODE=		80000
174FIXITINODE=		40000
175MFSINODE=		8000
176SMALLBOOTLABEL=		fd1200
177BOOTLABEL=		fd1440
178SMALLFIXITLABEL=	fd1200
179FIXITLABEL=		fd1440
180MFSLABEL=		minimum3
181.else
182DRIVERSIZE=		1440
183BOOTSIZE=		1440
184FIXITSIZE=		1440
185MFSSIZE=		4320
186BIGBOOTSIZE=		2880
187DRIVERINODE=		40000
188BOOTINODE=		80000
189FIXITINODE=		40000
190MFSINODE=		8000
191DRIVERLABEL=		fd1440
192BOOTLABEL=		fd1440
193FIXITLABEL=		fd1440
194MFSLABEL=		minimum3
195BIGBOOTLABEL=		minimum2
196.endif
197.elif ${TARGET_ARCH} == "alpha"
198MFSSIZE=		4320
199MFSINODE=		8000
200MFSLABEL=		auto
201NO_FLOPPIES=
202.elif ${TARGET_ARCH} == "sparc64"
203DISKLABEL=		sunlabel
204MFSSIZE=		4096
205MFSINODE=		8192
206MFSLABEL=		auto
207MINIROOT=
208NO_FLOPPIES=
209.elif ${TARGET_ARCH} == "ia64"
210MFSINODE=		8192
211MFSLABEL=		auto
212MFSSIZE=		8192
213NO_FLOPPIES=
214.elif ${TARGET_ARCH} == "amd64"
215MFSSIZE=		4096
216MFSINODE=		8192
217MFSLABEL=		auto
218NO_FLOPPIES=
219.endif
220
221.if exists(/sbin/bsdlabel)
222DISKLABEL?=		bsdlabel
223.else
224DISKLABEL?=		disklabel
225.endif
226
227ZIPNSPLIT=		gzip --no-name -9 -c | split -b 1423k -
228
229# Things that need to be compiled without crypto support in releases
230.if !defined(FIXCRYPTO) && !make(release) && !make(rerelease)
231FIXCRYPTO!=	cd ${.CURDIR}/../secure; ${MAKE} -V SPROGS
232.endif
233
234# Things which may get you into trouble if you change them
235MTREEFILES=		${.CURDIR}/../etc/mtree
236_R?=			/R
237RD=			${_R}/stage
238RND=			${RD}/release.doc
239FD=			${_R}/ftp
240CD=			${_R}/cdrom
241.if ${TARGET} != "pc98"
242CD_BOOT=		${CD}/bootonly
243.endif
244CD_DISC1=		${CD}/disc1
245CD_DISC2=		${CD}/disc2
246_MK?=			${CHROOTDIR}/mk
247
248# Where the bootstrap ports (see DOCPORTS) get installed.
249LOCALDIR=		/usr/local/bin
250
251.if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel"
252DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
253.else
254DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
255.endif
256
257CRUNCH_TARGETS=	boot
258.if ${TARGET_ARCH} == "i386"
259CRUNCH_TARGETS+=fixit
260.if ${TARGET} == "pc98"
261CRUNCH_TARGETS+=fixit-small
262.endif
263.endif
264
265EXTRAS= ftp.1
266.if !defined(NOCDROM)
267EXTRAS+= cdrom.1
268.if defined(MAKE_ISOS)
269EXTRAS+= iso.1
270.endif
271.if ${TARGET} == "i386" && defined(EMUL_BOOT)
272BOOTABLE="-eb"
273.elif ${TARGET} == "pc98"
274BOOTABLE=
275.else
276BOOTABLE="-b"
277.endif
278.endif
279
280.if !defined(NODOC)
281DOCREL= doc.1 doc.2
282.endif
283
284.if !make(release) && !make(rerelease)
285BINMAKE!=	cd ${.CURDIR}/..; ${MAKE} -V BINMAKE
286WMAKEENV!=	cd ${.CURDIR}/..; \
287		${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV
288WMAKE=		${WMAKEENV} ${BINMAKE}
289.endif
290
291CVS_SRCARGS=	-P
292.if defined(RELEASETAG)
293CVS_SRCARGS+=	-r ${RELEASETAG}
294.endif
295
296CVS_DOCARGS=	-P
297.if defined(DOCRELEASETAG)
298CVS_DOCARGS+=	-r ${DOCRELEASETAG}
299.endif
300
301CVS_PORTSARGS=	-P
302.if defined(PORTSRELEASETAG)
303CVS_PORTSARGS+=	-r ${PORTSRELEASETAG}
304.endif
305
306WORLDDIR?=	${.CURDIR}/..
307
308release rerelease:
309.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
310	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
311.endif
312.if defined(NOPORTSATALL) && !defined(NODOC)
313	@echo "Ports are required for building the docs.  Either set NODOC or"
314	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
315	@exit 1
316.endif
317.if make(release)
318.if exists(${CHROOTDIR})
319# The first command will fail on a handful of files that have their schg
320# flags set.  But it greatly speeds up the next two commands.
321	# NB: clear any vestigal devfs mount, just in case
322	-umount ${CHROOTDIR}/dev > /dev/null 2>&1
323	-rm -rf ${CHROOTDIR} 2>/dev/null
324	-chflags -R noschg ${CHROOTDIR}/.
325	-rm -rf ${CHROOTDIR}
326.endif
327	mkdir -p ${CHROOTDIR}
328	@echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
329	cd ${WORLDDIR} && ${NATIVEMAKE} -DNOGAMES -DNOHTML -DNOINFO -DNOMAN \
330	    -DNOPROFILE installworld DESTDIR=${CHROOTDIR}
331	cd ${WORLDDIR}/etc && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
332	if [ -f /etc/resolv.conf ]; then \
333		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
334	fi
335.if defined(EXTLOCALDIR)
336	rm -rf ${CHROOTDIR}/usr/local
337	cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local
338.endif
339	rm -rf ${CHROOTDIR}/usr/src
340.if defined(EXTSRCDIR)
341	cd ${CHROOTDIR}/usr && \
342	    cp -R -H ${EXTSRCDIR} src
343.else
344	cd ${CHROOTDIR}/usr && \
345	    ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
346	    co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
347.endif
348.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
349.for p in ${LOCAL_PATCHES}
350.if exists(${p})
351	patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p}
352.endif
353.endfor
354.endif
355.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
356	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \
357	    RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
358.endif
359	rm -rf ${CHROOTDIR}/usr/ports
360.if !defined(NOPORTSATALL)
361	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
362	    co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
363.endif
364.if !defined(NODOC)
365	rm -rf ${CHROOTDIR}/usr/doc
366.if defined(EXTDOCDIR)
367	cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
368.else
369	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
370	    co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
371.endif
372	if [ -d ${RELEASEDISTFILES}/ ]; then \
373		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
374	else \
375		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
376	fi
377.if !defined(NO_PREFETCHDISTFILES)
378	@cd ${.CURDIR} && ${MAKE} fetch-distfiles
379.endif
380.endif
381.endif
382.if make(rerelease)
383.if !defined(RELEASENOUPDATE)
384.if !defined(RELEASETAG)
385	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
386	    update ${CVSCMDARGS} -P -d -A
387.else
388	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
389	    update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
390.endif
391	rm -f ${CHROOTDIR}/tmp/.world_done 
392.if !defined(NOPORTS)
393	cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
394	    update ${CVSCMDARGS} -P -d
395.endif
396.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
397	for i in ${MINIMALDOCPORTS}; do \
398	    ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
399		update ${CVSCMDARGS} -P -d ) ; \
400	done
401.endif
402.if !defined(NODOC)
403	cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
404	    update ${CVSCMDARGS} -P -d
405.endif
406.endif
407.endif
408	# Add version information to those things that need it.
409	if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
410		cd ${CHROOTDIR}/usr/src/sys/conf && \
411		mv newvers.sh foo && \
412		sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
413		rm foo; \
414	fi
415	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
416	echo "#!/bin/sh"			> ${_MK}
417	echo "set -ex"				>> ${_MK}
418	echo "trap 'umount /dev || true' 0"	>> ${_MK}
419	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${_MK}
420.for var in \
421	AUTO_KEYBOARD_DETECT \
422	BOOT_CONFIG \
423	BUILDNAME \
424	CD_EXTRA_BITS \
425	DISTRIBUTIONS \
426	DOC_LANG \
427	DOMINIMALDOCPORTS \
428	EXTRA_SRC \
429	FIXCRYPTO \
430	FTP_PASSIVE_MODE \
431	FTP_PROXY \
432	HTTP_PROXY \
433	KERNELS \
434	KERNEL_FLAGS \
435	MAKE_ISOS \
436	NOCDROM \
437	NODOC \
438	NOPORTS \
439	NOSHARED \
440	NOSRC \
441	NO_CPU_CFLAGS \
442	NO_CPU_COPTFLAGS \
443	NO_FLOPPIES \
444	NO_SENDMAIL \
445	RELEASETAG \
446	RELNOTES_LANG \
447	TARGET \
448	TARGET_ARCH \
449	WORLD_FLAGS
450.if defined(${var})
451	echo "export ${var}=\"${${var}}\""	>> ${_MK}
452.endif
453.endfor
454	# Don't remove this, or the build will fall over!
455	echo "export RELEASEDIR=${_R}"		>> ${_MK}
456	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${_MK}
457	echo "export MANBUILDCAT=YES"		>> ${_MK}
458	# NB: these may fail if the host is running w/o devfs
459	echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK}
460	echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true"	>> ${_MK}
461	echo "/etc/rc.d/ldconfig start"		>> ${_MK}
462	echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK}
463	echo "	cd /usr/src"			>> ${_MK}
464	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${_MK}
465	echo "	touch /tmp/.world_done"		>> ${_MK}
466	echo "fi"				>> ${_MK}
467	echo "if [ ! -f /tmp/.skip_ports ]; then" >> ${_MK}
468	echo "	echo \">>> make readmes started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
469	echo "	cd /usr/ports"			>> ${_MK}
470	echo "	make ${PORTREADMES_FLAGS} readmes" >> ${_MK}
471	echo "	touch /tmp/.skip_ports"		>> ${_MK}
472	echo "	echo \">>> make readmes finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
473	echo "fi"				>> ${_MK}
474	echo "cd /usr/src/release"		>> ${_MK}
475	echo "make obj"				>> ${_MK}
476	echo "make \$${_RELTARGET}"		>> ${_MK}
477	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
478	chmod 755 ${_MK}
479.if defined(NOPORTS) || defined(NOPORTREADMES)
480	touch ${CHROOTDIR}/tmp/.skip_ports
481.endif
482	# Ensure md.ko is loaded if md(4) is not statically compiled into 
483	# the kernel
484	-mdconfig 2>/dev/null
485	env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}`
486
487clean:
488	rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-9] release.10 \
489	    ${EXTRAS}
490
491fetch-distfiles:
492	@for i in ${DOCPORTS}; do \
493		cd ${CHROOTDIR}/usr/ports/$$i && \
494			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
495			WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
496			checksum-recursive ; \
497	done
498
499# Clean out ${_R} and make the directory structure.
500release.1:
501	mkdir -p ${_R}
502	-rm -rf ${_R}/* 2> /dev/null
503	-chflags -R noschg ${_R}/.
504	rm -rf ${_R}/*
505	mkdir ${RD}
506.if !defined(NO_FLOPPIES)
507	mkdir ${RD}/floppies
508.endif
509	mkdir ${RD}/trees
510	mkdir ${RD}/kernels
511	for i in ${DISTRIBUTIONS} special; do \
512		mkdir ${RD}/trees/$$i && \
513		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
514		    -p ${RD}/trees/$$i > /dev/null && \
515		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
516		    -p ${RD}/trees/$$i/usr > /dev/null && \
517		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
518		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
519		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
520		    -p ${RD}/trees/$$i/var > /dev/null ; \
521	done
522	touch ${.TARGET}
523
524# Install the system into the various distributions.
525release.2:
526	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
527	cd ${.CURDIR}/.. && ${CROSSMAKE} distributeworld DISTDIR=${RD}/trees
528	touch ${.TARGET}
529
530# Build and install non-crypto versions of some tools.
531release.3:
532	# Handle some grief caused by the munition braindeadness.
533	cd ${.CURDIR}/..; \
534	${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DNOCRYPT \
535	    SUBDIR_OVERRIDE="${FIXCRYPTO}" \
536	    buildworld distributeworld DISTDIR=${RD}/trees
537	-chflags -R noschg ${RD}/trees
538	touch ${.TARGET}
539
540# Make and install the generic kernel(s).
541release.4:
542.for kernel in ${KERNELS}
543	cd ${.CURDIR}/..; \
544	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
545	    KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
546	    DESTDIR=${RD}/trees/base
547.endfor
548	# Install a standard boot kernel+modules.
549	cd ${.CURDIR}/..; \
550	${CROSSMAKE} ${KERNEL_FLAGS} \
551	    kernel \
552	    DESTDIR=${RD}/trees/base; \
553	cd ${.CURDIR}/..; \
554	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
555	    reinstallkernel -DINSTALL_DEBUG \
556	    DESTDIR=${RD}/trees/base
557	touch ${.TARGET}
558
559# Make and install the three crunched binaries which live on the floppies.
560# You are not supposed to like this :-)
561release.5:
562	rm -rf ${RD}/crunch
563	mkdir -p ${RD}/crunch
564.for j in ${CRUNCH_TARGETS}
565.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
566	rm -rf ${j}_crunch
567	mkdir ${j}_crunch
568	cd ${j}_crunch; ${WMAKEENV} crunchgen -o \
569	    ${.CURDIR}/${TARGET}/${j}_crunch.conf
570	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
571	cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools
572	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk \
573	    CFLAGS="-Os -pipe" -DNO_CPU_CFLAGS all
574	${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
575	mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
576.endif
577.endfor
578	touch ${.TARGET}
579
580#
581# --==## Fix up the distributions. ##==--
582#
583release.6:
584	# Create any "synthetic dists" now.
585	@for i in ${DISTRIBUTIONS}; do \
586		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
587			echo -n "Running $$i dist creation script... "; \
588			env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
589			echo "Done."; \
590		fi \
591	done \
592
593	# Remove all the directories we don't need.
594	-cd ${RD}/trees && \
595		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
596	touch ${.TARGET}
597
598#
599# --==## Package up the tarballs from assembled trees ##==--
600#
601release.7:
602	rm -rf ${RD}/dists
603	mkdir -p ${RD}/dists
604	@for i in ${DISTRIBUTIONS} ; \
605	do \
606		if [ -d ${RD}/trees/$${i} ] ; then \
607			cd ${.CURDIR} && $(MAKE) doTARBALL \
608				SD=${RD}/trees/$${i} \
609				TN=$$i TD=$$i ARG="." && \
610			echo "$${i} distribution is finished."; \
611		fi ; \
612	done
613.if !defined(NOPORTS)
614	# XXX: Inline stripped version of doTARBALL
615	@rm -rf ${RD}/dists/ports/ports*
616	@mkdir -p ${RD}/dists/ports
617	@echo rolling ports/ports tarball
618	@tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
619	  ${RD}/dists/ports/ports.tgz -C /usr ports
620	@cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
621	@(cd ${RD}/dists/ports; \
622	  rm -f CHECKSUM.MD5; \
623	  md5 * > CHECKSUM.MD5)
624	@echo "ports distribution is finished."
625.endif
626	touch ${.TARGET}
627
628
629#
630# --==## Make source dists ##==--
631#
632release.8:
633.if !defined(NOSRC)
634	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
635		TD=src TN=sbase ARG="[A-Z]*"
636	@for i in `cd /usr/src && echo [a-z]*` ; do \
637		if [ -d /usr/src/$$i ] ; then \
638			cd ${.CURDIR} && $(MAKE) doTARBALL \
639				TN=`echo s$$i | tr -d '.' | \
640				    sed -e 's/usr/u/' \
641					-e 's/kerberos5/krb5/'` \
642				SD=/usr/src TD=src ARG="$$i" ; \
643		fi ; \
644	done
645.if defined(EXTRA_SRC)
646	@set ${EXTRA_SRC} && \
647	while [ $$# -ge 2 ] ; do \
648		if [ -d /usr/src/$$1 ] ; then \
649			cd ${.CURDIR} && $(MAKE) doTARBALL \
650				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
651		fi && shift && shift ; \
652	done
653.endif
654	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
655		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
656		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
657		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
658		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
659		md5 * > CHECKSUM.MD5 ) ; fi
660	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
661	@echo "src distribution is finished."
662.endif
663	touch ${.TARGET}
664
665# Complete the bootfd
666#
667# Now, just to get this picture down once and for all:
668#
669# +------------------------------------------------------------------------+
670# |boot.flp                                                                |
671# +-----+-----+------------------------------------------------------------+
672# |boot1|boot2|floppy filesystem "bootfd"                                  |
673# +-----+-----+-+----------------------+---------------------------------+-+
674#               |kernel.gz             |mfsroot.gz                       |
675#               +----------------------+---------------------------------+
676#
677
678release.9:
679.if exists(${.CURDIR}/../sys/boot/${TARGET}/loader)
680	cd ${.CURDIR}/../sys/boot/${TARGET}/loader; \
681	${WMAKE} clean cleandepend; \
682	${WMAKE} -DNOMAN -DNOFORTH all; \
683	${WMAKE} -DNOMAN -DNOFORTH install DESTDIR=${RD}/trees/special
684.endif
685	cp ${RD}/trees/base/etc/disktab /etc
686	rm -rf ${RD}/mfsfd
687	mkdir ${RD}/mfsfd
688	cd ${RD}/mfsfd && \
689		mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help
690	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
691		DIR=${RD}/mfsfd/stand ZIP=false
692	( cd ${RD}/mfsfd && \
693	  for dir in bin sbin ; do \
694		ln -sf /stand $$dir; \
695	  done )
696	cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
697.if ${TARGET} == "pc98"
698	cp ${.CURDIR}/../etc/defaults/pccard.conf \
699	    ${RD}/mfsfd/etc/defaults/pccard.conf
700.endif
701	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
702	( for F in defaults/rc.conf netconfig protocols ; do \
703		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
704		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
705	  done )
706	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
707	    ${RD}/trees/base/etc/services | \
708	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
709	    > ${RD}/mfsfd/stand/etc/services
710	grep 'operator' ${RD}/trees/base/etc/group \
711	    > ${RD}/mfsfd/stand/etc/group
712	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
713	ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group
714	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
715	cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
716.if !defined(NODOC)
717	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
718	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
719	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
720	done
721	@for i in ${DIST_DOCS_ARCH_DEP}; do \
722	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
723	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
724	done
725	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT \
726	    ${RD}/mfsfd/stand/help/INSTALL.TXT
727	@mv ${RD}/mfsfd/stand/help/EARLY-ADOPTER.TXT \
728	    ${RD}/mfsfd/stand/help/EARLY.TXT
729.endif
730	-test -f ${.CURDIR}/install.cfg \
731	    && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
732	@mkdir -p ${RD}/mfsfd/boot
733.if ${TARGET_ARCH} != "ia64"
734	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
735.endif
736.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
737	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
738.endif
739	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
740		tar xf - -C ${RD}/mfsfd/stand
741.if defined(SMALLBOOTSIZE)
742	@mkdir -p ${RD}/mfsroot-small
743.if exists(${.CURDIR}/${TARGET}/drivers-small.conf)
744	@mkdir -p ${RD}/mfsfd/modules
745	@awk -f  ${.CURDIR}/scripts/driver-copy2.awk 2 \
746	    ${.CURDIR}/${TARGET}/drivers-small.conf \
747	    ${RD}/trees/base/boot/kernel ${RD}/mfsfd/modules
748.endif
749	sh -e ${DOFS_SH} ${RD}/mfsroot-small/mfsroot ${RD} ${MNT} \
750	    ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
751	@gzip -9nv ${RD}/mfsroot-small/mfsroot
752	@rm -rf ${RD}/mfsfd/modules
753.endif
754.if exists(${.CURDIR}/${TARGET}/drivers.conf)
755	@mkdir -p ${RD}/mfsfd/modules
756	@awk -f  ${.CURDIR}/scripts/driver-copy2.awk 2 \
757	    ${.CURDIR}/${TARGET}/drivers.conf \
758	    ${RD}/trees/base/boot/kernel ${RD}/mfsfd/modules
759.endif
760	@mkdir -p ${RD}/mfsroot
761	sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
762	    ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
763	@gzip -9nv ${RD}/mfsroot/mfsroot
764	touch ${.TARGET}
765
766release.10:
767.if !defined(NO_FLOPPIES)
768.if exists(${.CURDIR}/${TARGET}/drivers.conf)
769	@echo "Making the drivers floppy."
770	@rm -rf ${RD}/driversfd
771	@mkdir ${RD}/driversfd
772	@awk -f  ${.CURDIR}/scripts/driver-copy2.awk 3 \
773	    ${.CURDIR}/${TARGET}/drivers.conf \
774	    ${RD}/trees/base/boot/kernel ${RD}/driversfd
775	-@rmdir ${RD}/driversfd
776	if [ -d ${RD}/driversfd ]; then \
777	    sh -e ${DOFS_SH} ${RD}/floppies/drivers.flp ${RD} ${MNT} \
778	        ${DRIVERSIZE} ${RD}/driversfd ${DRIVERINODE} ${DRIVERLABEL}; \
779	    cd ${RD}/driversfd && awk -f  ${.CURDIR}/scripts/driver-desc.awk \
780		*.dsc >> ${RD}/floppies/DRIVERS.TXT; \
781	fi
782.endif
783.if defined(BOOTSIZE)
784	@echo "Making the regular boot floppy."
785	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
786.endif
787.if defined(SMALLBOOTSIZE)
788	@echo "Making the small boot floppy."
789	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
790.endif
791.if defined(BIGBOOTSIZE)
792	@echo "Making the big boot floppy."
793	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
794.endif
795.if defined(FIXITSIZE) || defined(SMALLFIXITSIZE)
796	@echo "Making fixit floppy."
797	@rm -rf ${RD}/fixitfd
798	@mkdir ${RD}/fixitfd
799	@cd ${RD}/fixitfd && \
800	    mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
801	    usr/share/misc
802	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
803	    ${RD}/fixitfd/etc
804	@sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
805	    > ${RD}/fixitfd/etc/protocols
806	@sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
807	    > ${RD}/fixitfd/usr/share/misc/scsi_modes
808	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
809	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
810	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
811	@chmod 555 ${RD}/fixitfd/stand/tar
812.if defined(SMALLFIXITSIZE)
813	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
814	    DIR=${RD}/fixitfd/stand ZIP=false
815	@sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \
816	    ${SMALLFIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${SMALLFIXITLABEL}
817	@rm -rf ${RD}/fixitfd/stand
818	@mkdir ${RD}/fixitfd/stand
819.endif
820.if defined(FIXITSIZE)
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	    ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
825.endif
826.endif
827# Do our last minute floppies directory setup in a convenient place.
828.if !defined(NODOC)
829	@cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \
830	    ${RD}/floppies/README.TXT
831	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
832.else
833	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
834.endif
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(NO_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(NO_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.if ${TARGET} == "i386" && defined(EMUL_BOOT) && !defined(NO_FLOPPIES)
931	# In case bootable ISO with floppy emulation is desired.
932.if defined(CD_BOOT)
933	@mkdir -p ${CD_BOOT}/floppies
934	@cp ${CD_DISC1}/floppies/boot.flp ${CD_BOOT}/floppies
935.endif
936	@mkdir -p ${CD_DISC2}/floppies
937	@cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
938.endif
939.endif
940	touch ${.TARGET}
941
942iso.1:
943.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
944	@echo "Creating ISO images..."
945.if defined(CD_BOOT)
946	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
947	    fbsd_bootonly \
948	    ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT}
949.endif
950	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
951	    fbsd_miniinst \
952	    ${CD}/${BUILDNAME}-${TARGET}-miniinst.iso ${CD_DISC1}
953	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
954	    fbsd_livefs \
955	    ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2}
956.if defined(CD_EXTRA_BITS)
957	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
958	    fbsd_boot \
959	    ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
960	    ${CD_EXTRA_BITS} \
961	    && false
962.endif
963	@(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5)
964	touch ${.TARGET}
965.else
966	@echo "Do not know how to create an ISO for ${TARGET_ARCH}."
967.endif
968
969#
970# --==## Documentation Project files such as the Handbook and FAQ ##==--
971#
972doc.1:
973	@echo "Making docs..."
974	@for i in ${DOCPORTS}; do \
975	    cd /usr/ports/$$i && \
976	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
977		make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
978		WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
979	done
980	@cd /usr/doc && make all install 'FORMATS=html html-split txt' \
981	    INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc
982	touch ${.TARGET}
983
984#
985# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
986#
987doc.2:
988	@echo "Making release documentation..."
989	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \
990	    INSTALL_COMPRESSED='' DOCDIR=${RND}
991	touch ${.TARGET}
992
993# Various "subroutine" and other supporting targets.
994
995# RD=
996# SD=
997# TD=
998# ARG=
999doTARBALL:
1000.if !defined(SD)
1001	@echo "SD undefined in doTARBALL" && exit 1
1002.endif
1003.if !defined(TD)
1004	@echo "TD undefined in doTARBALL" && exit 1
1005.endif
1006.if !defined(ARG)
1007	@echo "ARG undefined in doTARBALL" && exit 1
1008.endif
1009	@rm -rf ${RD}/dists/${TD}/${TN}*
1010	@mkdir -p ${RD}/dists/${TD}
1011	@( cd ${SD} && \
1012		tn=`echo ${TN} | tr 'A-Z' 'a-z' | cut -c1-8` && \
1013		echo rolling ${TD}/$$tn tarball &&\
1014		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
1015		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
1016		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
1017		    > ${RD}/dists/${TD}/$$tn.inf && \
1018		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
1019			cp -p ${.CURDIR}/scripts/$${TD}-install.sh \
1020			    ${RD}/dists/${TD}/install.sh; \
1021		fi && \
1022		if [ "${SD}" != "/usr/src" ]; then \
1023			mtree -c -i -p ${SD}/${ARG} \
1024			  -k gname,md5digest,mode,nlink,uname,size,link,type \
1025			  > ${RD}/dists/${TD}/$$tn.mtree ; \
1026		else \
1027			true; \
1028		fi; \
1029		( cd ${RD}/dists/${TD}; \
1030		rm -f CHECKSUM.MD5; \
1031		md5 * > CHECKSUM.MD5 ) \
1032	)
1033
1034doRELEASE: release.1 release.2 release.3 ${DOCREL} release.4 release.5 \
1035    release.6 release.7 release.8 release.9 release.10 ${EXTRAS}
1036	@echo "Release done"
1037
1038floppies:
1039	@rm -f release.5 release.9 release.10
1040	@cd ${.CURDIR} && ${MAKE} release.5 release.9 release.10
1041	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
1042
1043installCRUNCH:
1044.if !defined(CRUNCH)
1045	@echo "CRUNCH undefined in installCRUNCH" && exit 1
1046.endif
1047.if !defined(DIR)
1048	@echo "DIR undefined in installCRUNCH" && exit 1
1049.endif
1050.if !defined(ZIP)
1051	@echo "ZIP undefined in installCRUNCH" && exit 1
1052.endif
1053	@if ${ZIP} ; then \
1054		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1055	else \
1056		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1057	fi
1058	@chmod 555 ${DIR}/${CRUNCH}_crunch
1059	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1060		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1061			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1062		done \
1063	else \
1064		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1065			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1066		done \
1067	fi
1068
1069#
1070# --==## Put a filesystem into a BOOTMFS kernel ##==--
1071#
1072doMFSKERN:
1073	@echo "Running ${.TARGET} for ${FSIMAGE}"
1074	@rm -f ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
1075	@cd ${.CURDIR}/../sys/${TARGET}/conf; \
1076	if [ -r ${.CURDIR}/${TARGET}/dokern.sh ]; then \
1077	    sh ${.CURDIR}/${TARGET}/dokern.sh ${FDSIZE}; \
1078	else \
1079	    sed -e 's/ident.*GENERIC/ident		BOOTMFS/g'; \
1080	fi < GENERIC > BOOTMFS; \
1081	[ -r GENERIC.hints ] && cp GENERIC.hints BOOTMFS.hints
1082.if defined(FDSIZE) && ${FDSIZE} == "SMALL" && \
1083    exists(${.CURDIR}/${TARGET}/drivers-small.conf)
1084	@awk -f ${.CURDIR}/scripts/driver-remove.awk \
1085	    ${.CURDIR}/${TARGET}/drivers-small.conf \
1086	    ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1087.elif exists(${.CURDIR}/${TARGET}/drivers.conf)
1088	@awk -f ${.CURDIR}/scripts/driver-remove.awk \
1089	    ${.CURDIR}/${TARGET}/drivers.conf \
1090	    ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1091.endif
1092	cd ${.CURDIR}/..; \
1093	KERNEL_KO=BOOTMFS KODIR= \
1094	    ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES -DNO_KERNELCLEAN \
1095	    KERNCONF=BOOTMFS COPTFLAGS="-Os -pipe" -DNO_CPU_COPTFLAGS \
1096	    buildkernel reinstallkernel \
1097	    DESTDIR=${RD}/kernels
1098	[ -r ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ] && \
1099	    cp ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ${RD}/kernels
1100	@rm -rf ${RD}/image.${FSIMAGE}
1101	@mkdir ${RD}/image.${FSIMAGE}
1102	@cd ${RD}/kernels && \
1103	    (chflags noschg BOOTMFS || true) && \
1104	    ${WMAKEENV} strip -R .comment BOOTMFS && \
1105	    cp BOOTMFS BOOTMFS.${FSIMAGE} && \
1106	    [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
1107	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
1108	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
1109	@mkdir -p ${RD}/image.${FSIMAGE}/boot
1110.if ${TARGET} == "i386"
1111	@${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \
1112	    ${RD}/image.${FSIMAGE}/boot/loader ${RD}/trees/special/boot/loader
1113.else
1114	@cp ${RD}/trees/special/boot/loader ${RD}/image.${FSIMAGE}/boot
1115.endif
1116	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
1117	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
1118	      ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
1119	      ${RD}/image.${FSIMAGE}/boot/device.hints && \
1120	  echo "include /boot/device.hints" \
1121	      > ${RD}/image.${FSIMAGE}/boot/loader.rc
1122	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1123.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
1124	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1125	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1126	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1127.endif
1128	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1129	@echo "set hint.acpi.0.disabled=1" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1130	@if [ -r ${RD}/floppies/drivers.flp ]; then \
1131		echo "set driver_floppy=YES" >> ${RD}/image.${FSIMAGE}/boot/loader.rc; \
1132	fi
1133	@echo "set module_path=\"/modules;/dist\"" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1134	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1135	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1136.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
1137	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
1138.endif
1139	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
1140	@rm -f ${RD}/floppies/${FSIMAGE}.flp
1141.if defined(FDSIZE) && ${FDSIZE} == "BIG"
1142	@cp ${RD}/mfsroot/mfsroot.gz ${RD}/image.${FSIMAGE}
1143	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp ${RD} ${MNT} \
1144	    ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} ${BOOTINODE} ${BIGBOOTLABEL}
1145.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
1146	sh -e ${DOFS_SH} ${RD}/floppies/mfsroot-small.flp ${RD} ${MNT} \
1147	    ${SMALLBOOTSIZE} ${RD}/mfsroot-small/mfsroot.gz ${BOOTINODE} \
1148	    ${SMALLBOOTLABEL}
1149	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp ${RD} ${MNT} \
1150	    ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} ${BOOTINODE} \
1151	    ${SMALLBOOTLABEL}
1152.else
1153	sh -e ${DOFS_SH} ${RD}/floppies/mfsroot.flp ${RD} ${MNT} \
1154	    ${BOOTSIZE} ${RD}/mfsroot/mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
1155	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp ${RD} ${MNT} \
1156	    ${BOOTSIZE} ${RD}/image.${FSIMAGE} ${BOOTINODE} ${BOOTLABEL}
1157.endif
1158	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1159
1160.include <bsd.obj.mk>
1161