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