Makefile revision 114304
1# $FreeBSD: head/release/Makefile 114304 2003-04-30 17:54:19Z 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 recompiled with Kerberos support.
224.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
225K5PROGS!=	cd ${.CURDIR}/../kerberos5; ${MAKE} -V KPROGS
226.endif
227
228# Things that need to be compiled without crypto support in releases
229.if !defined(FIXCRYPTO)
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.if ${TARGET} != "pc98"
283BOOTABLE="-b"
284.endif
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 ${EXTLOCALDIR} local
340.endif
341	rm -rf ${CHROOTDIR}/usr/src
342.if defined(EXTSRCDIR)
343	cd ${CHROOTDIR}/usr && \
344		cp -R ${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 ${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	NOKERBEROS \
428	NOPORTS \
429	NOSHARED \
430	NOSRC \
431	NO_CPU_CFLAGS \
432	NO_CPU_COPTFLAGS \
433	NO_FLOPPIES \
434	NO_SENDMAIL \
435	RELEASETAG \
436	RELNOTES_LANG \
437	TARGET \
438	TARGET_ARCH \
439	WORLD_FLAGS
440.if defined(${var})
441	echo "export ${var}=\"${${var}}\""	>> ${CHROOTDIR}/mk
442.endif
443.endfor
444	# Don't remove this, or the build will fall over!
445	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
446	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${CHROOTDIR}/mk
447	echo "export MANBUILDCAT=YES"		>> ${CHROOTDIR}/mk
448	# NB: these may fail if the host is running w/o devfs
449	echo "umount /dev >/dev/null 2>&1 || true" >> ${CHROOTDIR}/mk
450	echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true" \
451						>> ${CHROOTDIR}/mk
452	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
453	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
454	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${CHROOTDIR}/mk
455	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
456	echo "fi"				>> ${CHROOTDIR}/mk
457.if defined(NOPORTS) || defined(NOPORTREADMES)
458	echo "if false; then"			>> ${CHROOTDIR}/mk
459.else
460	echo "if true; then"			>> ${CHROOTDIR}/mk
461.endif
462	echo "	echo \">>> make readmes started on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
463	echo "	cd /usr/ports"			>> ${CHROOTDIR}/mk
464	echo "	make ${PORTREADMES_FLAGS} readmes" >> ${CHROOTDIR}/mk
465	echo "	echo \">>> make readmes finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
466	echo "fi"				>> ${CHROOTDIR}/mk
467	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
468	echo "make obj"				>> ${CHROOTDIR}/mk
469	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
470	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
471	chmod 755 ${CHROOTDIR}/mk
472	# Ensure md.ko is loaded if md(4) is not statically compiled into the kernel
473	-mdconfig 2>/dev/null
474	env -i /usr/sbin/chroot ${CHROOTDIR} /mk
475
476clean:
477	rm -rf boot_crunch release.[0-9]
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.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
524	cd ${.CURDIR}/..; \
525	${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DMAKE_KERBEROS5 \
526	    SUBDIR_OVERRIDE="kerberos5 ${K5PROGS}" \
527	    buildworld distributeworld DISTDIR=${RD}/trees
528	rm -f ${RD}/trees/krb5/usr/share/info/dir
529.endif
530	-chflags -R noschg ${RD}/trees
531	touch release.3
532
533# Make and install the generic kernel(s).
534release.4:
535.for kernel in ${KERNELS}
536	cd ${.CURDIR}/..; \
537	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
538	    KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
539	    DESTDIR=${RD}/trees/base
540.endfor
541	# Install a standard boot kernel+modules.
542	cd ${.CURDIR}/..; \
543	${CROSSMAKE} ${KERNEL_FLAGS} \
544	    kernel \
545	    DESTDIR=${RD}/trees/base; \
546	cd ${.CURDIR}/..; \
547	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
548	    reinstallkernel -DINSTALL_DEBUG \
549	    DESTDIR=${RD}/trees/base
550	touch release.4
551
552# Make and install the three crunched binaries which live on the floppies.
553# You are not supposed to like this :-)
554release.5:
555	rm -rf ${RD}/crunch
556	mkdir -p ${RD}/crunch
557.for j in ${CRUNCH_TARGETS}
558	rm -rf ${j}_crunch
559	mkdir ${j}_crunch
560.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
561	cd ${j}_crunch; ${WMAKEENV} crunchgen -o ${.CURDIR}/${TARGET}/${j}_crunch.conf
562.else
563	cd ${j}_crunch; ${WMAKEENV} crunchgen -o ${.CURDIR}/${j}_crunch.conf
564.endif
565	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
566	cd ${.CURDIR}/..; ${MAKE} -m ${.CURDIR}/../share/mk -f Makefile.inc1 \
567	    _build-tools
568	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk \
569	    CFLAGS="-Os -pipe" -DNO_CPU_CFLAGS all
570	${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
571	mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
572.endfor
573	touch release.5
574
575#
576# --==## Fix up the distributions. ##==--
577#
578release.6:
579	# Create any "synthetic dists" now.
580	@for i in ${DISTRIBUTIONS}; do \
581		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
582			echo -n "Running $$i dist creation script... "; \
583			env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
584			echo "Done."; \
585		fi \
586	done \
587
588	# Remove all the directories we don't need.
589	-cd ${RD}/trees && \
590		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
591	touch release.6
592
593#
594# --==## Package up the tarballs from assembled trees ##==--
595#
596release.7:
597	rm -rf ${RD}/dists
598	mkdir -p ${RD}/dists
599	@for i in ${DISTRIBUTIONS} ; \
600	do \
601		if [ -d ${RD}/trees/$${i} ] ; then \
602			cd ${.CURDIR} && $(MAKE) doTARBALL \
603				SD=${RD}/trees/$${i} \
604				TN=$$i TD=$$i ARG="." && \
605			echo "$${i} distribution is finished."; \
606		fi ; \
607	done
608	touch release.7
609
610
611#
612# --==## Make source dists ##==--
613#
614release.8:
615.if !defined(NOSRC)
616	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
617		TD=src TN=sbase ARG="[A-Z]*"
618	@for i in `cd /usr/src && echo [a-z]*` ; do \
619		if [ -d /usr/src/$$i ] ; then \
620			cd ${.CURDIR} && $(MAKE) doTARBALL \
621				TN=`echo s$$i | tr -d '.' | \
622				    sed -e 's/usr/u/' \
623					-e 's/kerberos5/krb5/'` \
624				SD=/usr/src TD=src ARG="$$i" ; \
625		fi ; \
626	done
627.if defined(EXTRA_SRC)
628	@set ${EXTRA_SRC} && \
629	while [ $$# -ge 2 ] ; do \
630		if [ -d /usr/src/$$1 ] ; then \
631			cd ${.CURDIR} && $(MAKE) doTARBALL \
632				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
633		fi && shift && shift ; \
634	done
635.endif
636	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
637		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
638		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
639		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
640		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
641		md5 * > CHECKSUM.MD5 ) ; fi
642	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
643	@echo "src distribution is finished."
644.endif
645	touch release.8
646
647# Complete the bootfd
648#
649# Now, just to get this picture down once and for all:
650#
651# +------------------------------------------------------------------------+
652# |boot.flp                                                                |
653# +-----+-----+------------------------------------------------------------+
654# |boot1|boot2|floppy filesystem "bootfd"                                  |
655# +-----+-----+-+----------------------+---------------------------------+-+
656#               |kernel.gz             |mfsroot.gz                       |
657#               +----------------------+---------------------------------+
658#
659
660release.9:
661.if ${TARGET_ARCH} != "ia64" || ${TARGET_ARCH} == ${MACHINE_ARCH}
662	cp ${RD}/trees/base/etc/disktab /etc
663	rm -rf ${RD}/mfsfd
664	mkdir ${RD}/mfsfd
665	cd ${RD}/mfsfd && \
666		mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help
667	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
668		DIR=${RD}/mfsfd/stand ZIP=false
669	( cd ${RD}/mfsfd && \
670	  for dir in bin sbin ; do \
671		ln -sf /stand $$dir; \
672	  done )
673	cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
674.if ${TARGET} == "pc98"
675	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
676.endif
677	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
678	( for F in defaults/rc.conf netconfig protocols ; do \
679		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
680		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
681	  done )
682	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
683	    ${RD}/trees/base/etc/services | \
684	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
685	    > ${RD}/mfsfd/stand/etc/services
686	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
687	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
688	cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
689.if !defined(NODOC)
690	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
691	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
692	done
693	@for i in ${DIST_DOCS_ARCH_DEP}; do \
694	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
695	done
696	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT ${RD}/mfsfd/stand/help/INSTALL.TXT
697	@mv ${RD}/mfsfd/stand/help/EARLY-ADOPTER.TXT ${RD}/mfsfd/stand/help/EARLY.TXT
698.endif
699	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
700	@mkdir -p ${RD}/mfsfd/boot
701.if ${TARGET_ARCH} != "ia64"
702	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
703.endif
704.if ${TARGET} == "i386"
705	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
706.endif
707	@echo "Making the regular boot floppy."
708	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
709		tar xf - -C ${RD}/mfsfd/stand
710.if ${TARGET_ARCH} == "alpha" && !defined(NO_FLOPPIES)
711	rm -rf ${RD}/mfsfd/stand/help/*
712.endif
713.if defined(SMALLBOOTSIZE)
714.if exists(${.CURDIR}/${TARGET}/drivers-small.conf)
715	@rm -rf ${RD}/mfsfd/modules
716	@mkdir -p ${RD}/mfsfd/modules
717	@awk -f  ${.CURDIR}/scripts/driver-copy2.awk 2 \
718	    ${.CURDIR}/${TARGET}/drivers-small.conf \
719	    ${RD}/trees/base/boot/kernel ${RD}/mfsfd/modules
720.endif
721	sh -e ${DOFS_SH} mfsroot ${RD} ${MNT} \
722		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
723	@gzip -9vc mfsroot > mfsroot.gz
724	@sh -e ${DOFS_SH} ${RD}/floppies/mfsroot-small.flp \
725		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
726		${BOOTINODE} ${SMALLBOOTLABEL}
727.endif
728.if exists(${.CURDIR}/${TARGET}/drivers.conf)
729	@rm -rf ${RD}/mfsfd/modules
730	@mkdir -p ${RD}/mfsfd/modules
731	@awk -f  ${.CURDIR}/scripts/driver-copy2.awk 2 \
732	    ${.CURDIR}/${TARGET}/drivers.conf \
733	    ${RD}/trees/base/boot/kernel ${RD}/mfsfd/modules
734	@rm -rf ${RD}/driversfd
735	@mkdir ${RD}/driversfd
736	@awk -f  ${.CURDIR}/scripts/driver-copy2.awk 3 \
737	    ${.CURDIR}/${TARGET}/drivers.conf \
738	    ${RD}/trees/base/boot/kernel ${RD}/driversfd
739	-@rmdir ${RD}/driversfd
740	if [ -d ${RD}/driversfd ]; then \
741	    sh -e ${DOFS_SH} \
742		${RD}/floppies/drivers.flp ${RD} ${MNT} ${DRIVERSIZE} \
743		${RD}/driversfd ${DRIVERINODE} ${DRIVERLABEL}; \
744	    cd ${RD}/driversfd && awk -f  ${.CURDIR}/scripts/driver-desc.awk \
745		*.dsc >> ${RD}/floppies/DRIVERS.TXT; \
746	fi
747.endif
748	sh -e ${DOFS_SH} mfsroot ${RD} ${MNT} \
749		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
750	@gzip -9vc mfsroot > mfsroot.gz
751	@mkdir -p ${RD}/mfsroot
752	@cp mfsroot.gz ${RD}/mfsroot
753.if !defined(NO_FLOPPIES)
754.if defined(BOOTSIZE)
755	@sh -e ${DOFS_SH} ${RD}/floppies/mfsroot.flp \
756		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
757	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
758.endif
759.if defined(SMALLBOOTSIZE)
760	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
761.endif
762.if defined(BIGBOOTSIZE)
763	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
764.endif
765.endif
766	@rm mfsroot mfsroot.gz
767	@echo "Regular and MFS boot floppies made."
768.endif
769	touch release.9
770
771#
772# --==## Create a fixit floppy ##==--
773#
774release.10:
775.if !defined(NO_FLOPPIES)
776	@echo "Making fixit floppy."
777	@rm -rf ${RD}/fixitfd
778	@mkdir ${RD}/fixitfd
779	@cd ${RD}/fixitfd && \
780		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
781		usr/share/misc
782	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
783		${RD}/fixitfd/etc
784	@sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
785		> ${RD}/fixitfd/etc/protocols
786	@sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
787		> ${RD}/fixitfd/usr/share/misc/scsi_modes
788	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
789	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
790	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
791	@chmod 555 ${RD}/fixitfd/stand/tar
792.if defined(SMALLFIXITSIZE)
793	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
794		DIR=${RD}/fixitfd/stand ZIP=false
795	@sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp \
796		${RD} ${MNT} ${SMALLFIXITSIZE} ${RD}/fixitfd ${FIXITINODE} \
797		${SMALLFIXITLABEL}
798	@rm -rf ${RD}/fixitfd/stand
799	@mkdir ${RD}/fixitfd/stand
800.endif
801	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
802		DIR=${RD}/fixitfd/stand ZIP=false
803	@sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} \
804		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
805# Do our last minute floppies directory setup in a convenient place.
806.if !defined(NODOC)
807	@cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \
808		${RD}/floppies/README.TXT
809	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
810.else
811	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
812.endif
813.endif
814	touch release.10
815
816#
817# --==## Setup a suitable ftp-area ##==--
818#
819ftp.1:
820	@echo "Setting up FTP distribution area"
821	@mkdir -p ${FD}
822	-@ln -s . ${FD}/${BUILDNAME}
823	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
824	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
825.if !defined(NODOC)
826	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
827	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
828	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
829	done
830	@for i in ${DIST_DOCS_ARCH_DEP}; do \
831	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
832	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
833	done
834	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
835	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
836	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
837	@mv ${FD}/EARLY-ADOPTER.TXT ${FD}/EARLY.TXT
838	@mv ${FD}/EARLY-ADOPTER.HTM ${FD}/EARLY.HTM
839.endif
840	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
841.if !defined(NOPORTS)
842	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
843.endif
844	touch ftp.1
845
846#
847# --==## Setup a suitable cdrom-area ##==--
848#
849cdrom.1:
850	@echo "Setting up CDROM distribution area"
851	@mkdir -p ${CD_DISC1} ${CD_DISC2}
852	-@ln -s . ${CD_DISC1}/${BUILDNAME}
853	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
854	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
855	@for i in ${DISTRIBUTIONS} ; \
856	do \
857		if [ -d ${RD}/trees/$${i} ] ; then \
858			chflags -R noschg ${RD}/trees/$${i} || true ; \
859			( cd ${RD}/trees/$${i} && \
860			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
861		fi \
862	done
863	@rm -f ${CD_DISC2}/.profile
864	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
865	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
866	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
867.if !defined(NODOC)
868	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
869	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
870	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
871	done
872	@for i in ${DIST_DOCS_ARCH_DEP}; do \
873	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
874	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
875	done
876	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
877	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
878	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
879	@mv ${CD_DISC1}/EARLY-ADOPTER.TXT ${CD_DISC1}/EARLY.TXT
880	@mv ${CD_DISC1}/EARLY-ADOPTER.HTM ${CD_DISC1}/EARLY.HTM
881.endif
882.if ${TARGET} != "pc98"
883	@echo "Setting up /boot"
884	@rm -f ${CD_DISC2}/boot/loader.conf
885	@cp ${RD}/mfsroot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
886	@echo 'mfsroot_load="YES"' > ${CD_DISC2}/boot/loader.conf
887	@echo 'mfsroot_type="mfs_root"' >> ${CD_DISC2}/boot/loader.conf
888	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC2}/boot/loader.conf
889	@cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
890.endif
891.if ${TARGET} == "i386"
892	@mkdir -p ${CD_DISC2}/floppies
893	@cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
894.endif
895.if !defined(NOPORTS)
896	@mkdir -p ${CD_DISC1}/ports && \
897	  tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
898	  ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
899	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
900	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
901.endif
902	touch cdrom.1
903
904iso.1:
905.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
906	@echo "Creating ISO images..."
907	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
908	    fbsd_miniinst \
909	    ${CD}/${BUILDNAME}-${TARGET}-miniinst.iso ${CD_DISC1}
910	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
911	    fbsd_livefs \
912	    ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2}
913.if defined(CD_EXTRA_BITS)
914	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \
915	    ${BOOTABLE} fbsd_boot \
916	    ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
917	    ${CD_EXTRA_BITS} \
918	    && false
919.endif
920	touch iso.1
921.else
922	@echo "Do not know how to create an ISO for ${TARGET_ARCH}."
923.endif
924
925#
926# --==## Documentation Project files such as the Handbook and FAQ ##==--
927#
928doc.1:
929	@echo "Making docs..."
930	@for i in ${DOCPORTS}; do \
931	    cd /usr/ports/$$i && \
932	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
933		make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
934		WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
935	done
936	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc
937	touch doc.1
938
939#
940# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
941#
942doc.2:
943	@echo "Making release documentation..."
944	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' INSTALL_COMPRESSED='' DOCDIR=${RND}
945	touch doc.2
946
947# Various "subroutine" and other supporting targets.
948
949# RD=
950# SD=
951# TD=
952# ARG=
953doTARBALL:
954.if !defined(SD)
955	@echo "SD undefined in doTARBALL" && exit 1
956.endif
957.if !defined(TD)
958	@echo "TD undefined in doTARBALL" && exit 1
959.endif
960.if !defined(ARG)
961	@echo "ARG undefined in doTARBALL" && exit 1
962.endif
963	@rm -rf ${RD}/dists/${TD}/${TN}*
964	@mkdir -p ${RD}/dists/${TD}
965	@( cd ${SD} && \
966		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
967		echo rolling ${TD}/$$tn tarball &&\
968		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
969		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
970		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
971		   ${RD}/dists/${TD}/$$tn.inf && \
972		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
973		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
974		fi && \
975		if [ "${SD}" != "/usr/src" ]; then \
976			mtree -c -i -p ${SD}/${ARG} \
977			  -k gname,md5digest,mode,nlink,uname,size,link,type \
978			  > ${RD}/dists/${TD}/$$tn.mtree ; \
979		else \
980			true; \
981		fi; \
982		(cd ${RD}/dists/${TD}; \
983		   rm -f CHECKSUM.MD5; \
984		   md5 * > CHECKSUM.MD5) \
985	)
986
987doRELEASE:  release.1 release.2 release.3 ${DOCREL} release.4 release.5 \
988		release.6 release.7 release.8 release.9 ${FIXIT_TARGET}
989	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
990	@echo "Release done"
991
992floppies:
993	@cd ${.CURDIR} && ${MAKE} boot.flp
994	@cd ${.CURDIR} && ${MAKE} fixit.flp
995	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
996
997boot.flp:
998	@rm -f release.5 release.9
999	@cd ${.CURDIR} && ${MAKE} release.5 release.9 CRUNCH_TARGETS=boot
1000
1001fixit.flp:
1002	@rm -f release.5 release.10
1003	@cd ${.CURDIR} && ${MAKE} release.5 release.10 CRUNCH_TARGETS=fixit
1004
1005installCRUNCH:
1006.if !defined(CRUNCH)
1007	@echo "CRUNCH undefined in installCRUNCH" && exit 1
1008.endif
1009.if !defined(DIR)
1010	@echo "DIR undefined in installCRUNCH" && exit 1
1011.endif
1012.if !defined(ZIP)
1013	@echo "ZIP undefined in installCRUNCH" && exit 1
1014.endif
1015	@if ${ZIP} ; then \
1016		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1017	else \
1018		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1019	fi
1020	@chmod 555 ${DIR}/${CRUNCH}_crunch
1021	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1022		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1023			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1024		done \
1025	else \
1026		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1027			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1028		done \
1029	fi
1030
1031#
1032# --==## Put a filesystem into a BOOTMFS kernel ##==--
1033#
1034doMFSKERN:
1035	@echo "Running ${.TARGET} for ${FSIMAGE}"
1036	@rm -f ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
1037	@cd ${.CURDIR}/../sys/${TARGET}/conf && \
1038	    sh ${.CURDIR}/${TARGET}/dokern.sh ${FDSIZE} < GENERIC > BOOTMFS && \
1039	    [ -r GENERIC.hints ] && cp GENERIC.hints BOOTMFS.hints
1040.if defined(FDSIZE) && ${FDSIZE} == "SMALL" && \
1041    exists(${.CURDIR}/${TARGET}/drivers-small.conf)
1042	@awk -f ${.CURDIR}/scripts/driver-remove.awk \
1043		${.CURDIR}/${TARGET}/drivers-small.conf \
1044		${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1045.elif exists(${.CURDIR}/${TARGET}/drivers.conf)
1046	@awk -f ${.CURDIR}/scripts/driver-remove.awk \
1047		${.CURDIR}/${TARGET}/drivers.conf \
1048		${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1049.endif
1050	cd ${.CURDIR}/..; \
1051	KERNEL_KO=BOOTMFS KODIR= \
1052	    ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES -DNO_KERNELCLEAN \
1053	    KERNCONF=BOOTMFS COPTFLAGS="-Os -pipe" -DNO_CPU_COPTFLAGS \
1054	    buildkernel reinstallkernel \
1055	    DESTDIR=${RD}/kernels
1056	[ -r ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ] && \
1057	cp ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ${RD}/kernels
1058	@rm -rf ${RD}/image.${FSIMAGE}
1059	@mkdir ${RD}/image.${FSIMAGE}
1060	@cd ${RD}/kernels && \
1061	  (chflags noschg BOOTMFS || true) && \
1062	  ${WMAKEENV} strip -R .comment BOOTMFS && \
1063	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
1064	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
1065	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
1066	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
1067	@mkdir -p ${RD}/image.${FSIMAGE}/boot
1068.if ${TARGET} == "i386"
1069	@${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o \
1070	    -o ${RD}/image.${FSIMAGE}/boot/loader ${RD}/trees/base/boot/loader
1071.elif ${TARGET_ARCH} == "ia64"
1072	@cp ${RD}/trees/base/boot/loader.efi ${RD}/image.${FSIMAGE}/boot
1073.else
1074	@cp ${RD}/trees/base/boot/loader ${RD}/image.${FSIMAGE}/boot
1075.endif
1076	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
1077	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
1078	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
1079	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
1080	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
1081	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1082.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
1083	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1084	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1085	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1086.endif
1087	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1088.if ${TARGET_ARCH} != "ia64"
1089	@echo "set hint.acpi.0.disabled=1" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1090.endif
1091	@if [ -r ${RD}/floppies/drivers.flp ]; then \
1092	    echo "set driver_floppy=YES" >> ${RD}/image.${FSIMAGE}/boot/loader.rc; \
1093	fi
1094	@echo "set module_path=\"/modules;/dist\"" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1095	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1096	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1097.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
1098	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
1099.endif
1100	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
1101	@rm -f ${RD}/floppies/${FSIMAGE}.flp
1102.if defined(FDSIZE) && ${FDSIZE} == "BIG"
1103	@cp mfsroot.gz ${RD}/image.${FSIMAGE}
1104	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1105		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
1106		${BOOTINODE} ${BIGBOOTLABEL}
1107.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
1108	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1109		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
1110		${BOOTINODE} ${SMALLBOOTLABEL}
1111.else
1112	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1113		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
1114		${BOOTINODE} ${BOOTLABEL}
1115.endif
1116	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1117
1118.include <bsd.obj.mk>
1119