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