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