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