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