Makefile revision 101391
1# $FreeBSD: head/release/Makefile 101391 2002-08-05 16:46:14Z ru $
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.
197K4PROGS!=	cd ${.CURDIR}/../kerberosIV; ${MAKE} -V KPROGS
198K5PROGS!=	cd ${.CURDIR}/../kerberos5; ${MAKE} -V KPROGS
199
200# Things that need to be compiled without crypto support in releases
201.if !defined(FIXCRYPTO)
202FIXCRYPTO=	bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/tcpdump/tcpdump 
203.if !defined(NO_SENDMAIL)
204FIXCRYPTO+=	usr.sbin/sendmail
205.endif
206.endif
207
208
209# Things which may get you into trouble if you change them
210MTREEFILES=		${.CURDIR}/../etc/mtree
211_R?=			/R
212RD=			${_R}/stage
213RND=			${RD}/release.doc
214FD=			${_R}/ftp
215CD=			${_R}/cdrom
216CD_DISC1=		${CD}/disc1
217CD_DISC2=		${CD}/disc2
218
219# Where the bootstrap ports (see DOCPORTS) get installed.
220LOCALDIR=		/usr/local/bin
221
222.if !defined(CRUNCH_TARGETS)
223CRUNCH_TARGETS=	boot fixit
224.endif
225
226EXTRAS= cdrom.1 ftp.1
227.if defined(MAKE_ISOS)
228EXTRAS+= iso.1
229.if ${TARGET} != "pc98"
230BOOTABLE="-b"
231.endif
232.endif
233
234.if !defined(NODOC)
235DOCREL= doc.1 doc.2
236.endif
237
238.if !defined(NOPORTREADMES)
239MAKEREADMES=	make readmes PORTSDIR=${CHROOTDIR}/usr/ports
240.else
241MAKEREADMES=	true
242.endif
243
244TMAKE!=		echo MAKEFLAGS=\"-m ${.CURDIR}/../share/mk\"; \
245		cd ${.CURDIR}/..; ${MAKE} -f Makefile.inc1 -V TMAKE
246WMAKEENV!=	echo MAKEFLAGS=\"-m ${.CURDIR}/../share/mk\"; \
247		cd ${.CURDIR}/..; ${CROSSMAKE} -f Makefile.inc1 -V WMAKEENV
248WMAKE=		${WMAKEENV} ${MAKE}
249
250rerelease release:
251.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
252	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
253.endif
254.if defined(NOPORTSATALL) && !defined(NODOC)
255	@echo "Ports are required for building the docs.  Either set NODOC or"
256	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
257	@exit 1
258.endif
259.if make(release)
260.if exists(${CHROOTDIR})
261# The first command will fail on a handful of files that have their schg
262# flags set.  But it greatly speeds up the next two commands.
263	-rm -rf ${CHROOTDIR} 2>/dev/null
264	-chflags -R noschg ${CHROOTDIR}/.
265	-rm -rf ${CHROOTDIR}
266.endif
267	mkdir -p ${CHROOTDIR}
268	@echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
269	cd ${.CURDIR}/.. && ${NATIVEMAKE} -DNOGAMES -DNOHTML -DNOINFO -DNOMAN \
270	    -DNOPROFILE installworld DESTDIR=${CHROOTDIR}
271	cd ${.CURDIR}/../etc && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
272	if [ -f /etc/resolv.conf ]; then \
273		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
274	fi
275.if !defined(RELEASETAG)
276	cd ${CHROOTDIR}/usr && rm -rf src && \
277		cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P ${RELEASESRCMODULE}
278.else
279	cd ${CHROOTDIR}/usr && rm -rf src && \
280		cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P -r ${RELEASETAG} ${RELEASESRCMODULE}
281.endif
282.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
283	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
284.endif
285.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
286	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
287.endif
288.if !defined(NOPORTS)
289.if defined(PORTSRELEASETAG)
290	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
291.else
292	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
293.endif
294.elif defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
295.if defined(PORTSRELEASETAG)
296	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
297.else
298	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P ${MINIMALDOCPORTS}
299.endif
300.endif
301.if !defined(NODOC)
302.if defined(DOCRELEASETAG)
303	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
304.else
305	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P ${RELEASEDOCMODULE}
306.endif
307	if [ -d ${RELEASEDISTFILES}/ ]; then \
308		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
309	else \
310		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
311	fi
312.if defined(PREFETCHDISTFILES)
313	@for i in ${DOCPORTS}; do \
314		cd ${CHROOTDIR}/usr/ports/$$i && \
315			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
316			WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
317			fetch-recursive ; \
318	done
319.endif
320.endif
321.endif
322.if make(rerelease)
323.if !defined(RELEASENOUPDATE)
324.if !defined(RELEASETAG)
325	cd ${CHROOTDIR}/usr/src && cvs -R -q update ${CVSCMDARGS} -P -d -A
326.else
327	cd ${CHROOTDIR}/usr/src && cvs -R -q update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
328.endif
329.if !defined(NOPORTS)
330	cd ${CHROOTDIR}/usr/ports && cvs -R -q update ${CVSCMDARGS} -P -d
331.endif
332.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
333	for i in ${MINIMALDOCPORTS}; do \
334		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q update ${CVSCMDARGS} -P -d ) ; \
335	done
336.endif
337.if !defined(NODOC)
338	cd ${CHROOTDIR}/usr/doc && cvs -R -q update ${CVSCMDARGS} -P -d
339.endif
340.endif
341.endif
342	# Add version information to those things that need it.
343	( cd ${CHROOTDIR}/usr/src/sys/conf && \
344	  mv newvers.sh foo && \
345	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
346	echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
347	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
348	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
349	echo "set -ex"				>> ${CHROOTDIR}/mk
350	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${CHROOTDIR}/mk
351	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
352	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
353	echo "export OBJFORMAT=${OBJFORMAT}"	>> ${CHROOTDIR}/mk
354.if defined(RELEASETAG)
355	echo "export RELEASETAG=\"${RELEASETAG}\""	>> ${CHROOTDIR}/mk
356.endif
357.if defined(NOPORTS)
358	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
359.endif
360.if defined(MAKE_ISOS)
361	echo "export MAKE_ISOS=${MAKE_ISOS}"	>> ${CHROOTDIR}/mk
362.endif
363.if defined(DOMINIMALDOCPORTS)
364	echo "export DOMINIMALDOCPORTS=${DOMINIMALDOCPORTS}" >> ${CHROOTDIR}/mk
365.endif
366.if defined(NODOC)
367	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
368.endif
369.if defined(ALLLANG) && ${ALLLANG} != "NO" && ${ALLLANG} != "no"
370	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
371.else
372	echo "export DOC_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
373.endif
374.if defined(NOSRC)
375	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
376.endif
377.if defined(RELNOTES_LANG)
378	echo "export RELNOTES_LANG=${RELNOTES_LANG}"	>> ${CHROOTDIR}/mk
379.else
380	echo "export RELNOTES_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
381.endif
382.if defined(NOSHARED)
383	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
384.endif
385.if defined(BOOT_CONFIG)
386	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
387.endif
388.if defined(WORLD_FLAGS)
389	echo "export WORLD_FLAGS=\"${WORLD_FLAGS}\""	>> ${CHROOTDIR}/mk
390.endif
391.if defined(KERNEL_FLAGS)
392	echo "export KERNEL_FLAGS=\"${KERNEL_FLAGS}\"" >> ${CHROOTDIR}/mk
393.endif
394.if defined(TARGET)
395	echo "export TARGET=\"${TARGET}\"" >> ${CHROOTDIR}/mk
396.endif
397.if defined(TARGET_ARCH)
398	echo "export TARGET_ARCH=\"${TARGET_ARCH}\"" >> ${CHROOTDIR}/mk
399.endif
400.if defined(EXTRA_SRC)
401	echo "export EXTRA_SRC=\"${EXTRA_SRC}\""	>> ${CHROOTDIR}/mk
402.endif
403.if defined(FIXCRYPTO)
404	echo "export FIXCRYPTO=\"${FIXCRYPTO}\""	>> ${CHROOTDIR}/mk
405.endif
406.if defined(NOKERBEROS)
407	echo "export NOKERBEROS=\"${NOKERBEROS}\""	>> ${CHROOTDIR}/mk
408.endif
409.if defined(NO_SENDMAIL)
410	echo "export NO_SENDMAIL=\"${NO_SENDMAIL}\""	>> ${CHROOTDIR}/mk
411.endif
412	# Don't remove this, or the build will fall over!
413	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
414	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${CHROOTDIR}/mk
415	echo "export MANBUILDCAT=YES"		>> ${CHROOTDIR}/mk
416	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
417	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
418	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${CHROOTDIR}/mk
419	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
420	echo "fi"				>> ${CHROOTDIR}/mk
421	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
422	echo "make obj"				>> ${CHROOTDIR}/mk
423	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
424	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
425	chmod 755 ${CHROOTDIR}/mk
426	env -i /usr/sbin/chroot ${CHROOTDIR} /mk
427
428clean:
429	rm -rf boot_crunch release.[0-9]
430
431# Clean out ${_R} and make the directory structure.
432release.1:
433	mkdir -p ${_R}
434	-rm -rf ${_R}/* 2> /dev/null
435	-chflags -R noschg ${_R}/.
436	rm -rf ${_R}/*
437	mkdir ${RD}
438	mkdir ${RD}/floppies
439	mkdir ${RD}/trees
440	mkdir ${RD}/kernels
441	for i in ${DISTRIBUTIONS} ; do \
442		mkdir ${RD}/trees/$$i && \
443		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
444		    -p ${RD}/trees/$$i > /dev/null && \
445		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
446		    -p ${RD}/trees/$$i/usr > /dev/null && \
447		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
448		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
449		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
450		    -p ${RD}/trees/$$i/var > /dev/null ; \
451	done
452	touch release.1
453
454# Install the system into the various distributions.
455release.2:
456	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
457	cd ${.CURDIR}/.. && ${CROSSMAKE} distributeworld DISTDIR=${RD}/trees
458	touch release.2
459
460# Build and install crypto, krb4 and krb5 distributions.
461release.3:
462	# Handle some grief caused by the munition braindeadness.
463	cd ${.CURDIR}/..; \
464	${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DNOCRYPT \
465	    SUBDIR_OVERRIDE="${FIXCRYPTO}" \
466	    buildworld distributeworld DISTDIR=${RD}/trees
467.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
468	cd ${.CURDIR}/..; \
469	${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS4 \
470	    SUBDIR_OVERRIDE="kerberosIV ${K4PROGS}" \
471	    buildworld distributeworld DISTDIR=${RD}/trees
472.endif
473.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
474	cd ${.CURDIR}/..; \
475	${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS5 \
476	    SUBDIR_OVERRIDE="kerberos5 ${K5PROGS}" \
477	    buildworld distributeworld DISTDIR=${RD}/trees
478	rm -f ${RD}/trees/krb5/usr/share/info/dir
479.endif
480	-chflags -R noschg ${RD}/trees
481	touch release.3
482
483# Make and install the generic kernel(s).
484release.4:
485.for kernel in ${KERNELS}
486	cd ${.CURDIR}/..; \
487	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
488	    KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
489	    DESTDIR=${RD}/trees/base
490.endfor
491	# Install a standard boot kernel+modules.
492	cd ${.CURDIR}/..; \
493	${CROSSMAKE} ${KERNEL_FLAGS} \
494	    kernel \
495	    DESTDIR=${RD}/trees/base; \
496	cd ${.CURDIR}/..; \
497	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
498	    reinstallkernel -DINSTALL_DEBUG \
499	    DESTDIR=${RD}/trees/base
500	touch release.4
501
502# Make and install the three crunched binaries which live on the floppies.
503# You are not supposed to like this :-)
504release.5:
505	rm -rf ${RD}/crunch
506	mkdir -p ${RD}/crunch
507.for j in ${CRUNCH_TARGETS}
508	rm -rf ${j}_crunch
509	mkdir ${j}_crunch
510.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
511	cd ${j}_crunch; ${WMAKEENV} crunchgen ${.CURDIR}/${TARGET}/${j}_crunch.conf
512.else
513	cd ${j}_crunch; ${WMAKEENV} crunchgen ${.CURDIR}/${j}_crunch.conf
514.endif
515	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
516	cd ${.CURDIR}/..; ${TMAKE} build-tools
517	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk all
518	mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
519.endfor
520	touch release.5
521
522#
523# --==## Fix up the distributions. ##==--
524#
525release.6:
526	# Create any "synthetic dists" now.
527	@for i in ${DISTRIBUTIONS}; do \
528		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
529			echo -n "Running $$i dist creation script... "; \
530			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
531			echo "Done."; \
532		fi \
533	done \
534
535	# Remove all the directories we don't need.
536	-cd ${RD}/trees && \
537		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
538	touch release.6
539
540#
541# --==## Package up the tarballs from assembled trees ##==--
542#
543release.7:
544	rm -rf ${RD}/dists
545	mkdir -p ${RD}/dists
546	@for i in ${DISTRIBUTIONS} ; \
547	do \
548		if [ -d ${RD}/trees/$${i} ] ; then \
549			cd ${.CURDIR} && $(MAKE) doTARBALL \
550				SD=${RD}/trees/$${i} \
551				TN=$$i TD=$$i ARG="." && \
552			echo "$${i} distribution is finished."; \
553		fi ; \
554	done
555	# More munition braindeadness.
556	( cd ${RD}/dists && \
557		if [ -f krb4/krb4.aa ] ; then \
558			mv krb4/krb4.* crypto && \
559			cat krb4/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
560			rm -r krb4; \
561		fi )
562	( cd ${RD}/dists && \
563		if [ -f krb5/krb5.aa ] ; then \
564			mv krb5/krb5.* crypto && \
565			cat krb5/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
566			rm -r krb5; \
567		fi )
568	touch release.7
569
570
571#
572# --==## Make source dists ##==--
573#
574release.8:
575.if !defined(NOSRC)
576	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
577		TD=src TN=sbase ARG="[A-Z]*"
578	@for i in `cd /usr/src && echo [a-z]*` ; do \
579		if [ -d /usr/src/$$i ] ; then \
580			cd ${.CURDIR} && $(MAKE) doTARBALL \
581				TN=`echo s$$i | tr -d '.' | \
582				    sed -e 's/usr/u/' \
583					-e 's/kerberosIV/krb4/' \
584					-e 's/kerberos5/krb5/'` \
585				SD=/usr/src TD=src ARG="$$i" ; \
586		fi ; \
587	done
588.if defined(EXTRA_SRC)
589	@set ${EXTRA_SRC} && \
590	while [ $$# -ge 2 ] ; do \
591		if [ -d /usr/src/$$1 ] ; then \
592			cd ${.CURDIR} && $(MAKE) doTARBALL \
593				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
594		fi && shift && shift ; \
595	done
596.endif
597	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
598		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
599		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
600		if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
601		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
602		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
603		md5 * > CHECKSUM.MD5 ) ; fi
604	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
605	@echo "src distribution is finished."
606.endif
607	touch release.8
608
609# Complete the bootfd
610#
611# Now, just to get this picture down once and for all:
612#
613# +------------------------------------------------------------------------+
614# |boot.flp                                                                |
615# +-----+-----+------------------------------------------------------------+
616# |boot1|boot2|floppy filesystem "bootfd"                                  |
617# +-----+-----+-+----------------------+---------------------------------+-+
618#               |kernel.gz             |mfsroot.gz                       |
619#               +----------------------+---------------------------------+
620#
621
622release.9:
623	rm -rf ${RD}/mfsfd
624	mkdir ${RD}/mfsfd
625	cd ${RD}/mfsfd && \
626		mkdir -p etc/defaults dev mnt stand/help
627	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
628		DIR=${RD}/mfsfd/stand ZIP=false
629	( cd ${RD}/trees/base/dev && \
630		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 | \
631	cpio -dump ${RD}/mfsfd/dev )
632	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
633	( cd ${RD}/mfsfd && \
634	  for dir in bin sbin ; do \
635		ln -sf /stand $$dir; \
636	  done )
637	cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
638.if ${TARGET_ARCH} == "i386"
639	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
640.endif
641	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
642	cd ${RD}/trees/base && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
643	( for F in netconfig protocols ; do \
644		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
645		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
646	  done )
647	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
648	    ${RD}/trees/base/etc/services | \
649	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
650	    > ${RD}/mfsfd/stand/etc/services
651	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
652	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
653	gzip -9c ${RD}/trees/base/COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
654.if !defined(NODOC)
655	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
656	  gzip -9c ${RND}/${RELNOTES_LANG}/$$i/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
657	done
658	@for i in ${DIST_DOCS_ARCH_DEP}; do \
659	  gzip -9c ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
660	done
661	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT.gz ${RD}/mfsfd/stand/help/INSTALL.TXT.gz
662.endif
663	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
664	@mkdir -p ${RD}/mfsfd/boot
665	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
666.if ${TARGET} == "i386"
667	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
668.endif
669	@cp ${RD}/trees/base/boot/loader.help ${RD}/mfsfd/boot
670	@echo "Making the regular boot floppy."
671	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
672		tar xf - -C ${RD}/mfsfd/stand
673	@echo "Compressing doc files..."
674	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
675.if ${TARGET_ARCH} == "alpha"
676	rm -rf ${RD}/mfsfd/stand/help/*
677.endif
678.if exists(${.CURDIR}/${TARGET}/drivers.conf)
679	@mkdir -p ${RD}/mfsfd/stand/modules
680	@awk -f  ${.CURDIR}/scripts/driver-copy2.awk \
681	    ${.CURDIR}/${TARGET}/drivers.conf \
682	    ${RD}/trees/base/boot/kernel ${RD}/mfsfd/stand/modules
683.endif
684	sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
685		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
686	@gzip -9vc mfsroot > mfsroot.gz
687.if ${TARGET} == "pc98"
688	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
689		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
690		${BOOTINODE} ${SMALLBOOTLABEL}
691	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
692	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
693.else
694	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
695		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
696	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
697	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
698.endif
699	@rm mfsroot mfsroot.gz
700	@echo "Regular and MFS boot floppies made."
701	touch release.9
702
703#
704# --==## Create a fixit floppy ##==--
705#
706release.10:
707	@echo "Making fixit floppy."
708	@rm -rf ${RD}/fixitfd
709	@mkdir ${RD}/fixitfd
710	@cd ${RD}/fixitfd && \
711		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
712		usr/share/misc
713	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
714		DIR=${RD}/fixitfd/stand ZIP=false
715	@( cd ${RD}/fixitfd/dev && \
716		cp ${RD}/trees/base/dev/MAKEDEV MAKEDEV && \
717		chmod 755 MAKEDEV)
718	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
719		${RD}/trees/base/etc/protocols ${RD}/fixitfd/etc
720	@cp ${RD}/trees/base/usr/share/misc/scsi_modes \
721		${RD}/fixitfd/usr/share/misc
722	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
723	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
724	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
725	@chmod 555 ${RD}/fixitfd/stand/tar
726	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
727		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
728# Do our last minute floppies directory setup in a convenient place.
729.if !defined(NODOC)
730	@cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \
731		${RD}/floppies/README.TXT
732	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
733.else
734	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
735.endif
736	touch release.10
737
738#
739# --==## Setup a suitable ftp-area ##==--
740#
741ftp.1:
742	@echo "Setting up FTP distribution area"
743	@mkdir -p ${FD}
744	-@ln -s . ${FD}/${BUILDNAME}
745	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
746	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
747.if !defined(NODOC)
748	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
749	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
750	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
751	done
752	@for i in ${DIST_DOCS_ARCH_DEP}; do \
753	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
754	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
755	done
756	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
757	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
758	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
759.endif
760	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
761.if !defined(NOPORTS)
762	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
763.endif
764	touch ftp.1
765
766#
767# --==## Setup a suitable cdrom-area ##==--
768#
769cdrom.1:
770	@echo "Setting up CDROM distribution area"
771	@mkdir -p ${CD_DISC1} ${CD_DISC2}
772	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
773	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
774	@for i in ${DISTRIBUTIONS} ; \
775	do \
776		if [ -d ${RD}/trees/$${i} ] ; then \
777			chflags -R noschg ${RD}/trees/$${i} || true ; \
778			( cd ${RD}/trees/$${i} && \
779			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
780		fi \
781	done
782	@rm -f ${CD_DISC2}/.profile
783	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
784	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
785	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
786.if !defined(NODOC)
787	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
788	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
789	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
790	done
791	@for i in ${DIST_DOCS_ARCH_DEP}; do \
792	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
793	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
794	done
795	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
796	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
797	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
798.endif
799.if ${TARGET} != "pc98"
800	@echo "Setting up /boot"
801	@cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
802	@ln -f ${RD}/image.boot/mfsroot.gz ${CD_DISC1}/boot/mfsroot.gz
803	@ln -f ${CD_DISC1}/boot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
804	@echo 'mfsroot_load="YES"' > ${CD_DISC1}/boot/loader.conf
805	@echo 'mfsroot_type="mfs_root"' >> ${CD_DISC1}/boot/loader.conf
806	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC1}/boot/loader.conf
807	@ln -f ${CD_DISC1}/boot/loader.conf ${CD_DISC2}/boot/loader.conf
808.endif
809.if ${TARGET} == "i386"
810	@mkdir -p ${CD_DISC2}/floppies
811	@cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
812.endif
813.if !defined(NOPORTS)
814	@mkdir -p ${CD_DISC1}/ports && \
815	  tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
816	  ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
817	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
818	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
819.endif
820	touch cdrom.1
821
822iso.1:
823	@if [ -r ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ]; then \
824		echo "Creating ISO images..."; \
825		sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
826		  fbsd_miniinst ${CD}/miniinst.iso ${CD_DISC1}; \
827		sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
828		  fbsd_livefs ${CD}/disc2.iso ${CD_DISC2}; \
829		if [ "x${CD_EXTRA_BITS}" != "x" ]; then \
830			sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
831			  fbsd_boot ${CD}/disc1.iso ${CD_DISC1} ${CD_EXTRA_BITS}; \
832			    && false; \
833		fi \
834	else \
835		echo "Do not know how to create an ISO for ${TARGET_ARCH}."; \
836	fi
837	touch iso.1
838
839#
840# --==## Documentation Project files such as the Handbook and FAQ ##==--
841#
842doc.1:
843	@echo "Making docs..."
844	@for i in ${DOCPORTS}; do \
845	    cd /usr/ports/$$i && \
846	    env -i PATH=$${PATH} make all install clean \
847		BATCH=yes WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
848		FORCE_PKG_REGISTER=yes; \
849	done
850	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc
851	touch doc.1
852
853#
854# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
855#
856doc.2:
857	@echo "Making release documentation..."
858	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' INSTALL_COMPRESSED='' DOCDIR=${RND}
859	touch doc.2
860
861# Various "subroutine" and other supporting targets.
862
863# RD=
864# SD=
865# TD=
866# ARG=
867doTARBALL:
868.if !defined(SD)
869	@echo "SD undefined in doTARBALL" && exit 1
870.endif
871.if !defined(TD)
872	@echo "TD undefined in doTARBALL" && exit 1
873.endif
874.if !defined(ARG)
875	@echo "ARG undefined in doTARBALL" && exit 1
876.endif
877	@rm -rf ${RD}/dists/${TD}/${TN}*
878	@mkdir -p ${RD}/dists/${TD}
879	@( cd ${SD} && \
880		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
881		echo rolling ${TD}/$$tn tarball &&\
882		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
883		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
884		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
885		   ${RD}/dists/${TD}/$$tn.inf && \
886		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
887		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
888		fi && \
889		if [ "${SD}" != "/usr/src" ]; then \
890			mtree -c -i -p ${SD}/${ARG} \
891			  -k gname,md5digest,mode,nlink,uname,size,link,type \
892			  > ${RD}/dists/${TD}/$$tn.mtree ; \
893		else \
894			true; \
895		fi; \
896		(cd ${RD}/dists/${TD}; \
897		   rm -f CHECKSUM.MD5; \
898		   md5 * > CHECKSUM.MD5) \
899	)
900
901doRELEASE:  release.1 release.2 release.3 ${DOCREL} release.4 release.5 \
902		release.6 release.7 release.8 release.9 release.10
903	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
904	@echo "Release done"
905
906floppies:
907	@cd ${.CURDIR} && ${MAKE} boot.flp
908	@cd ${.CURDIR} && ${MAKE} fixit.flp
909	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
910
911boot.flp:
912	@rm -f release.5 release.9
913	@cd ${.CURDIR} && ${MAKE} release.5 release.9 CRUNCH_TARGETS=boot
914
915fixit.flp:
916	@rm -f release.5 release.10
917	@cd ${.CURDIR} && ${MAKE} release.5 release.10 CRUNCH_TARGETS=fixit
918
919installCRUNCH:
920.if !defined(CRUNCH)
921	@echo "CRUNCH undefined in installCRUNCH" && exit 1
922.endif
923.if !defined(DIR)
924	@echo "DIR undefined in installCRUNCH" && exit 1
925.endif
926.if !defined(ZIP)
927	@echo "ZIP undefined in installCRUNCH" && exit 1
928.endif
929	@if ${ZIP} ; then \
930		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
931	else \
932		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
933	fi
934	@chmod 555 ${DIR}/${CRUNCH}_crunch
935	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
936		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
937			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
938		done \
939	else \
940		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
941			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
942		done \
943	fi
944
945#
946# --==## Put a filesystem into a BOOTMFS kernel ##==--
947#
948doMFSKERN:
949	@echo "Running ${.TARGET} for ${FSIMAGE}"
950	@rm -f ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
951	@cd ${.CURDIR}/../sys/${TARGET}/conf && \
952	    sh ${.CURDIR}/${TARGET_ARCH}/dokern.sh ${FDSIZE} < GENERIC > BOOTMFS && \
953	    [ -r GENERIC.hints ] && cp GENERIC.hints BOOTMFS.hints
954.if exists(${.CURDIR}/${TARGET}/drivers.conf)
955	@awk -f ${.CURDIR}/scripts/driver-remove.awk \
956		${.CURDIR}/${TARGET}/drivers.conf \
957		${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
958.endif
959	cd ${.CURDIR}/..; \
960	KERNEL_KO=BOOTMFS KODIR= \
961	    ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES -DNO_KERNELCLEAN \
962	    KERNCONF=BOOTMFS buildkernel reinstallkernel \
963	    DESTDIR=${RD}/kernels
964	[ -r ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ] && \
965	cp ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ${RD}/kernels
966	@rm -rf ${RD}/image.${FSIMAGE}
967	@mkdir ${RD}/image.${FSIMAGE}
968	@cd ${RD}/kernels && \
969	  (chflags noschg BOOTMFS || true) && \
970	  ${WMAKEENV} strip BOOTMFS && \
971	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
972	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
973	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
974	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
975	@mkdir -p ${RD}/image.${FSIMAGE}/boot
976.if ${TARGET} == "i386"
977	@kgzip -vo ${RD}/image.${FSIMAGE}/boot/loader /boot/loader
978.else
979	@cp /boot/loader ${RD}/image.${FSIMAGE}/boot
980.endif
981	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
982	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
983	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
984	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
985	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
986	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
987.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
988	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
989	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
990	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
991.endif
992	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
993	@echo "set hint.acpi.0.disable=1" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
994	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
995	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
996.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
997	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
998.endif
999	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
1000	@rm -f ${RD}/floppies/${FSIMAGE}.flp
1001.if defined(FDSIZE) && ${FDSIZE} == "BIG"
1002	@cp mfsroot.gz ${RD}/image.${FSIMAGE}
1003	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1004		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
1005		${BOOTINODE} ${BIGBOOTLABEL}
1006.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
1007	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1008		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
1009		${BOOTINODE} ${SMALLBOOTLABEL}
1010.else
1011	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1012		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
1013		${BOOTINODE} ${BOOTLABEL}
1014.endif
1015	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1016
1017.include <bsd.prog.mk>
1018