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