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