Makefile revision 117915
1# $FreeBSD: head/release/Makefile 117915 2003-07-23 06:00:56Z ru $
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.1-RELEASE
22#
23# Automatic SNAP versioning:
24DATE != date +%Y%m%d
25BASE = 5.1
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
68CROSSENV=	TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
69CROSSMAKE=	${MAKE} ${CROSSENV}
70NATIVEMAKE=	${MAKE} TARGET_ARCH=${MACHINE_ARCH} TARGET=${MACHINE}
71
72# If you are using a local CVS repository with components stored in 
73# non-standard modules, override these on the make commandline or
74# in the environment.
75RELEASESRCMODULE?=	src
76RELEASEDOCMODULE?=	doc
77RELEASEPORTSMODULE?=	ports
78
79# Uncomment this to disable the doc.1 target.  Docs normally require
80# the ports tree, so NOPORTS can be set together with NODOC in order
81# to have neither ports or docs.  If only NOPORTS is set to YES, but
82# docs are still desired, the DOMINIMALDOCPORTS logic below will only
83# install the ports that are minimally required for the docs.  This is
84# intended as a compromise, less disk space is required than for using
85# the entire ports collection (and much less time due to the huge number
86# of directories it would create), but still quite a bit as well as some
87# CPU cycles (some of the programs are C++, and things like ghostscript
88# belong to the required ports nevertheless).
89#
90# Setting this also disables building of release note documentation
91# (RELNOTESng).
92#NODOC=  YES
93#NOPORTS=  YES
94
95# Modify this definition if you want the release notes 
96# and other release documentation in a language other than English.
97RELNOTES_LANG?=	en_US.ISO8859-1
98
99# As an alternative to installing the entire ports collection (which
100# can take a huge amount of time, in particular on slower disks),
101# setting ${MINIMALDOCPORTS} allows to install and build just those
102# ports that are really required for getting the docs up & running.
103.if defined(NOPORTS) && !defined(NODOC)
104DOMINIMALDOCPORTS=	YES
105.include "Makefile.inc.docports"
106RELEASEPORTSMODULE=	${MINIMALDOCPORTS}
107.endif
108
109# Helper variable
110.if defined(NOPORTS)
111.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
112NOPORTSATALL=	YES
113.endif
114.endif
115
116# By default, documentation (Handbook, FAQ, etc.) is built for all
117# the languages.  To speed up building, set the DOC_LANG to just
118# the languages you need.  (The language for the release notes is
119# controlled by the RELNOTES_LANG variable above.)
120#DOC_LANG=	en_US.ISO8859-1
121DOCPORTS=	textproc/docproj
122# Set this to wherever the distfiles required by release procedures.
123.if defined(DOCDISTFILES)
124# Respect DOCDISTFILES which is used before.
125RELEASEDISTFILES?=	${DOCDISTFILES}
126.else
127RELEASEDISTFILES?=	${.CURDIR}/../../ports/distfiles
128.endif
129# Set this to 1 if you want -P to be used for automatic keyboard detection
130# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
131AUTO_KEYBOARD_DETECT?= 0
132
133.if !defined(NODOC)
134DIST_DOCS_ARCH_INDEP=	readme errata early-adopter
135DIST_DOCS_ARCH_DEP=	installation relnotes hardware
136.endif
137
138# Things which without too much trouble can be considered variables
139# BASE_DISTS are special in that they get full /etc installation sets.
140#
141.if ${TARGET_ARCH} == "i386"
142COMPAT_DISTS?=	compat1x compat20 compat21 compat22 compat3x compat4x
143.elif ${TARGET_ARCH} != "ia64"
144COMPAT_DISTS?=	compat4x
145.endif
146OTHER_DISTS?=	catpages manpages games proflibs dict info doc
147CRYPTO_DISTS?=	crypto
148BASE_DISTS?=	base
149DISTRIBUTIONS?=	${BASE_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
150
151# mountpoint for filesystems.
152MNT=			/mnt
153
154# Various floppy image parameters.
155#
156
157.if ${TARGET_ARCH} == "i386"
158.if ${TARGET} == "pc98"
159SMALLBOOTSIZE=		1200
160BOOTSIZE=		1440
161SMALLFIXITSIZE=		1200
162FIXITSIZE=		1440
163MFSSIZE=		4320
164BOOTINODE=		80000
165FIXITINODE=		40000
166MFSINODE=		8000
167SMALLBOOTLABEL=		fd1200
168BOOTLABEL=		fd1440
169SMALLFIXITLABEL=	fd1200
170FIXITLABEL=		fd1440
171MFSLABEL=		minimum3
172.else
173DRIVERSIZE=		1440
174BOOTSIZE=		1440
175FIXITSIZE=		1440
176MFSSIZE=		4320
177BIGBOOTSIZE=		2880
178DRIVERINODE=		40000
179BOOTINODE=		80000
180FIXITINODE=		40000
181MFSINODE=		8000
182DRIVERLABEL=		fd1440
183BOOTLABEL=		fd1440
184FIXITLABEL=		fd1440
185MFSLABEL=		minimum3
186BIGBOOTLABEL=		minimum2
187.endif
188.elif ${TARGET_ARCH} == "alpha"
189DRIVERSIZE=		1440
190BOOTSIZE=		1440
191FIXITSIZE=		2880
192MFSSIZE=		4320
193BIGBOOTSIZE=		2880
194DRIVERINODE=		40000
195BOOTINODE=		80000
196FIXITINODE=		40000
197MFSINODE=		8000
198DRIVERLABEL=		fd1440
199BOOTLABEL=		fd1440
200FIXITLABEL=		minimum2
201MFSLABEL=		auto
202BIGBOOTLABEL=		minimum2
203.elif ${TARGET_ARCH} == "sparc64"
204DISKLABEL=		sunlabel
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.elif ${TARGET_ARCH} == "amd64"
219MFSSIZE=		4096
220MFSINODE=		8192
221MFSLABEL=		auto
222.endif
223
224.if exists(/sbin/bsdlabel)
225DISKLABEL?=		bsdlabel
226.else
227DISKLABEL?=		disklabel
228.endif
229
230ZIPNSPLIT=		gzip --no-name -9 -c | split -b 1423k -
231
232# Things that need to be compiled without crypto support in releases
233.if !defined(FIXCRYPTO)
234FIXCRYPTO!=	cd ${.CURDIR}/../kerberos5; ${MAKE} -V KPROGS
235FIXCRYPTO+=	bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/tcpdump/tcpdump \
236		lib/libfetch usr.bin/fetch
237.if !defined(NO_SENDMAIL)
238FIXCRYPTO+=	usr.sbin/sendmail
239.endif
240.endif
241
242
243# Things which may get you into trouble if you change them
244MTREEFILES=		${.CURDIR}/../etc/mtree
245_R?=			/R
246RD=			${_R}/stage
247RND=			${RD}/release.doc
248FD=			${_R}/ftp
249CD=			${_R}/cdrom
250CD_DISC1=		${CD}/disc1
251CD_DISC2=		${CD}/disc2
252
253# Where the bootstrap ports (see DOCPORTS) get installed.
254LOCALDIR=		/usr/local/bin
255
256.if exists(${.CURDIR}/${TARGET_ARCH}/doFS.sh)
257DOFS_SH=	${.CURDIR}/${TARGET_ARCH}/doFS.sh
258.elif ${TARGET} != ${MACHINE}
259DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
260.else
261DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
262.endif
263
264.if ${TARGET_ARCH} == "sparc64"
265CRUNCH_TARGETS= boot
266FIXIT_TARGET=
267.elif ${TARGET_ARCH} == "ia64"
268CRUNCH_TARGETS= boot
269FIXIT_TARGET=
270.elif ${TARGET} == "pc98"
271CRUNCH_TARGETS=	boot fixit fixit-small
272.elif ${TARGET_ARCH} == "amd64"
273CRUNCH_TARGETS= boot
274FIXIT_TARGET=
275.endif
276
277CRUNCH_TARGETS?=boot fixit
278
279.if !defined(FIXIT_TARGET)
280FIXIT_TARGET= release.10
281.endif
282
283EXTRAS= ftp.1
284.if !defined(NOCDROM)
285EXTRAS+= cdrom.1
286.if defined(MAKE_ISOS)
287EXTRAS+= iso.1
288.endif
289.if ${TARGET} != "pc98"
290BOOTABLE="-b"
291.endif
292.endif
293
294.if !defined(NODOC)
295DOCREL= doc.1 doc.2
296.endif
297
298BINMAKE!=	cd ${.CURDIR}/..; ${MAKE} -V BINMAKE
299WMAKEENV!=	cd ${.CURDIR}/..; \
300		${BINMAKE} ${CROSSENV} -f Makefile.inc1 -V WMAKEENV
301WMAKE=		${WMAKEENV} ${BINMAKE}
302
303CVS_SRCARGS=	-P
304.if defined(RELEASETAG)
305CVS_SRCARGS+=	-r ${RELEASETAG}
306.endif
307
308CVS_DOCARGS=	-P
309.if defined(DOCRELEASETAG)
310CVS_DOCARGS+=	-r ${DOCRELEASETAG}
311.endif
312
313CVS_PORTSARGS=	-P
314.if defined(PORTSRELEASETAG)
315CVS_PORTSARGS+=	-r ${PORTSRELEASETAG}
316.endif
317
318release rerelease:
319.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
320	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
321.endif
322.if defined(NOPORTSATALL) && !defined(NODOC)
323	@echo "Ports are required for building the docs.  Either set NODOC or"
324	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
325	@exit 1
326.endif
327.if make(release)
328.if exists(${CHROOTDIR})
329# The first command will fail on a handful of files that have their schg
330# flags set.  But it greatly speeds up the next two commands.
331	# NB: clear any vestigal devfs mount, just in case
332	-umount ${CHROOTDIR}/dev > /dev/null 2>&1
333	-rm -rf ${CHROOTDIR} 2>/dev/null
334	-chflags -R noschg ${CHROOTDIR}/.
335	-rm -rf ${CHROOTDIR}
336.endif
337	mkdir -p ${CHROOTDIR}
338	@echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
339	cd ${.CURDIR}/.. && ${NATIVEMAKE} -DNOGAMES -DNOHTML -DNOINFO -DNOMAN \
340	    -DNOPROFILE installworld DESTDIR=${CHROOTDIR}
341	cd ${.CURDIR}/../etc && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
342	if [ -f /etc/resolv.conf ]; then \
343		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
344	fi
345.if defined(EXTLOCALDIR)
346	rm -rf ${CHROOTDIR}/usr/local
347	cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local
348.endif
349	rm -rf ${CHROOTDIR}/usr/src
350.if defined(EXTSRCDIR)
351	cd ${CHROOTDIR}/usr && \
352		cp -R -H ${EXTSRCDIR} src
353.else
354	cd ${CHROOTDIR}/usr && \
355		${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
356.endif
357.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
358	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
359.endif
360.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
361	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
362.endif
363	rm -rf ${CHROOTDIR}/usr/ports
364.if !defined(NOPORTSATALL)
365	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
366.endif
367.if !defined(NODOC)
368	rm -rf ${CHROOTDIR}/usr/doc
369.if defined(EXTDOCDIR)
370	cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
371.else
372	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
373.endif
374	if [ -d ${RELEASEDISTFILES}/ ]; then \
375		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
376	else \
377		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
378	fi
379.if !defined(NO_PREFETCHDISTFILES)
380	@cd ${.CURDIR} && ${MAKE} fetch-distfiles
381.endif
382.endif
383.endif
384.if make(rerelease)
385.if !defined(RELEASENOUPDATE)
386.if !defined(RELEASETAG)
387	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d -A
388.else
389	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
390.endif
391	rm -f ${CHROOTDIR}/tmp/.world_done 
392.if !defined(NOPORTS)
393	cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d
394.endif
395.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
396	for i in ${MINIMALDOCPORTS}; do \
397		( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d ) ; \
398	done
399.endif
400.if !defined(NODOC)
401	cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q update ${CVSCMDARGS} -P -d
402.endif
403.endif
404.endif
405	# Add version information to those things that need it.
406	if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
407		cd ${CHROOTDIR}/usr/src/sys/conf && \
408		mv newvers.sh foo && \
409		sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
410		rm foo; \
411	fi
412	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
413	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
414	echo "set -ex"				>> ${CHROOTDIR}/mk
415	echo "trap 'umount /dev || true' 0"	>> ${CHROOTDIR}/mk
416	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${CHROOTDIR}/mk
417.for var in \
418	AUTO_KEYBOARD_DETECT \
419	BOOT_CONFIG \
420	BUILDNAME \
421	CD_EXTRA_BITS \
422	DISTRIBUTIONS \
423	DOC_LANG \
424	DOMINIMALDOCPORTS \
425	EXTRA_SRC \
426	FIXCRYPTO \
427	FTP_PASSIVE_MODE \
428	FTP_PROXY \
429	HTTP_PROXY \
430	KERNELS \
431	KERNEL_FLAGS \
432	MAKE_ISOS \
433	NOCDROM \
434	NODOC \
435	NOPORTS \
436	NOSHARED \
437	NOSRC \
438	NO_CPU_CFLAGS \
439	NO_CPU_COPTFLAGS \
440	NO_FLOPPIES \
441	NO_SENDMAIL \
442	RELEASETAG \
443	RELNOTES_LANG \
444	TARGET \
445	TARGET_ARCH \
446	WORLD_FLAGS
447.if defined(${var})
448	echo "export ${var}=\"${${var}}\""	>> ${CHROOTDIR}/mk
449.endif
450.endfor
451	# Don't remove this, or the build will fall over!
452	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
453	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${CHROOTDIR}/mk
454	echo "export MANBUILDCAT=YES"		>> ${CHROOTDIR}/mk
455	# NB: these may fail if the host is running w/o devfs
456	echo "umount /dev >/dev/null 2>&1 || true" >> ${CHROOTDIR}/mk
457	echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true" \
458						>> ${CHROOTDIR}/mk
459	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
460	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
461	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${CHROOTDIR}/mk
462	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
463	echo "fi"				>> ${CHROOTDIR}/mk
464	echo "if [ ! -f /tmp/.skip_ports ]; then" >> ${CHROOTDIR}/mk
465	echo "	echo \">>> make readmes started on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
466	echo "	cd /usr/ports"			>> ${CHROOTDIR}/mk
467	echo "	make ${PORTREADMES_FLAGS} readmes" >> ${CHROOTDIR}/mk
468	echo "	touch /tmp/.skip_ports"		>> ${CHROOTDIR}/mk
469	echo "	echo \">>> make readmes finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
470	echo "fi"				>> ${CHROOTDIR}/mk
471	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
472	echo "make obj"				>> ${CHROOTDIR}/mk
473	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
474	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
475	chmod 755 ${CHROOTDIR}/mk
476.if defined(NOPORTS) || defined(NOPORTREADMES)
477	touch ${CHROOTDIR}/tmp/.skip_ports
478.endif
479	# Ensure md.ko is loaded if md(4) is not statically compiled into the kernel
480	-mdconfig 2>/dev/null
481	env -i /usr/sbin/chroot ${CHROOTDIR} /mk
482
483clean:
484	rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-9] ${FIXIT_TARGET} \
485	    ${EXTRAS}
486
487fetch-distfiles:
488	@for i in ${DOCPORTS}; do \
489		cd ${CHROOTDIR}/usr/ports/$$i && \
490			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
491			WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
492			checksum-recursive ; \
493	done
494
495# Clean out ${_R} and make the directory structure.
496release.1:
497	mkdir -p ${_R}
498	-rm -rf ${_R}/* 2> /dev/null
499	-chflags -R noschg ${_R}/.
500	rm -rf ${_R}/*
501	mkdir ${RD}
502	mkdir ${RD}/floppies
503	mkdir ${RD}/trees
504	mkdir ${RD}/kernels
505	for i in ${DISTRIBUTIONS} ; do \
506		mkdir ${RD}/trees/$$i && \
507		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
508		    -p ${RD}/trees/$$i > /dev/null && \
509		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
510		    -p ${RD}/trees/$$i/usr > /dev/null && \
511		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
512		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
513		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
514		    -p ${RD}/trees/$$i/var > /dev/null ; \
515	done
516	touch release.1
517
518# Install the system into the various distributions.
519release.2:
520	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
521	cd ${.CURDIR}/.. && ${CROSSMAKE} distributeworld DISTDIR=${RD}/trees
522	touch release.2
523
524# Build and install crypto distributions.
525release.3:
526	# Handle some grief caused by the munition braindeadness.
527	cd ${.CURDIR}/..; \
528	${CROSSMAKE} ${WORLD_FLAGS} -DNO_MAKEDB_RUN -DNOCRYPT \
529	    SUBDIR_OVERRIDE="${FIXCRYPTO}" \
530	    buildworld distributeworld DISTDIR=${RD}/trees
531	-chflags -R noschg ${RD}/trees
532	touch release.3
533
534# Make and install the generic kernel(s).
535release.4:
536.for kernel in ${KERNELS}
537	cd ${.CURDIR}/..; \
538	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
539	    KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
540	    DESTDIR=${RD}/trees/base
541.endfor
542	# Install a standard boot kernel+modules.
543	cd ${.CURDIR}/..; \
544	${CROSSMAKE} ${KERNEL_FLAGS} \
545	    kernel \
546	    DESTDIR=${RD}/trees/base; \
547	cd ${.CURDIR}/..; \
548	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
549	    reinstallkernel -DINSTALL_DEBUG \
550	    DESTDIR=${RD}/trees/base
551	touch release.4
552
553# Make and install the three crunched binaries which live on the floppies.
554# You are not supposed to like this :-)
555release.5:
556	rm -rf ${RD}/crunch
557	mkdir -p ${RD}/crunch
558.for j in ${CRUNCH_TARGETS}
559	rm -rf ${j}_crunch
560	mkdir ${j}_crunch
561.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
562	cd ${j}_crunch; ${WMAKEENV} crunchgen -o ${.CURDIR}/${TARGET}/${j}_crunch.conf
563.else
564	cd ${j}_crunch; ${WMAKEENV} crunchgen -o ${.CURDIR}/${j}_crunch.conf
565.endif
566	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
567	cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _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" || ${TARGET_ARCH} == "amd64"
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	# In case bootable ISO with floppy emulation is desired.
893	@mkdir -p ${CD_DISC2}/floppies
894	@cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
895.endif
896.if !defined(NOPORTS)
897	@mkdir -p ${CD_DISC1}/ports && \
898	  tar --exclude CVS --exclude 'ports/distfiles/*' -czf \
899	  ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
900	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
901	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
902.endif
903	touch cdrom.1
904
905iso.1:
906.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
907	@echo "Creating ISO images..."
908	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
909	    fbsd_miniinst \
910	    ${CD}/${BUILDNAME}-${TARGET}-miniinst.iso ${CD_DISC1}
911	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
912	    fbsd_livefs \
913	    ${CD}/${BUILDNAME}-${TARGET}-disc2.iso ${CD_DISC2}
914.if defined(CD_EXTRA_BITS)
915	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \
916	    ${BOOTABLE} fbsd_boot \
917	    ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
918	    ${CD_EXTRA_BITS} \
919	    && false
920.endif
921	touch iso.1
922.else
923	@echo "Do not know how to create an ISO for ${TARGET_ARCH}."
924.endif
925
926#
927# --==## Documentation Project files such as the Handbook and FAQ ##==--
928#
929doc.1:
930	@echo "Making docs..."
931	@for i in ${DOCPORTS}; do \
932	    cd /usr/ports/$$i && \
933	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
934		make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
935		WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
936	done
937	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc
938	touch doc.1
939
940#
941# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
942#
943doc.2:
944	@echo "Making release documentation..."
945	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' INSTALL_COMPRESSED='' DOCDIR=${RND}
946	touch doc.2
947
948# Various "subroutine" and other supporting targets.
949
950# RD=
951# SD=
952# TD=
953# ARG=
954doTARBALL:
955.if !defined(SD)
956	@echo "SD undefined in doTARBALL" && exit 1
957.endif
958.if !defined(TD)
959	@echo "TD undefined in doTARBALL" && exit 1
960.endif
961.if !defined(ARG)
962	@echo "ARG undefined in doTARBALL" && exit 1
963.endif
964	@rm -rf ${RD}/dists/${TD}/${TN}*
965	@mkdir -p ${RD}/dists/${TD}
966	@( cd ${SD} && \
967		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
968		echo rolling ${TD}/$$tn tarball &&\
969		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
970		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
971		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
972		   ${RD}/dists/${TD}/$$tn.inf && \
973		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
974		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
975		fi && \
976		if [ "${SD}" != "/usr/src" ]; then \
977			mtree -c -i -p ${SD}/${ARG} \
978			  -k gname,md5digest,mode,nlink,uname,size,link,type \
979			  > ${RD}/dists/${TD}/$$tn.mtree ; \
980		else \
981			true; \
982		fi; \
983		(cd ${RD}/dists/${TD}; \
984		   rm -f CHECKSUM.MD5; \
985		   md5 * > CHECKSUM.MD5) \
986	)
987
988.if target(release.9.${TARGET_ARCH})
989RELEASE9=release.9.${TARGET_ARCH}
990.else
991RELEASE9=release.9 
992.endif
993
994doRELEASE:  release.1 release.2 release.3 ${DOCREL} release.4 release.5 \
995		release.6 release.7 release.8 ${RELEASE9} ${FIXIT_TARGET}
996	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
997	@echo "Release done"
998
999floppies:
1000	@cd ${.CURDIR} && ${MAKE} boot.flp
1001	@cd ${.CURDIR} && ${MAKE} fixit.flp
1002	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
1003
1004boot.flp:
1005	@rm -f release.5 release.9
1006	@cd ${.CURDIR} && ${MAKE} release.5 release.9 CRUNCH_TARGETS=boot
1007
1008fixit.flp:
1009	@rm -f release.5 release.10
1010	@cd ${.CURDIR} && ${MAKE} release.5 release.10 CRUNCH_TARGETS=fixit
1011
1012installCRUNCH:
1013.if !defined(CRUNCH)
1014	@echo "CRUNCH undefined in installCRUNCH" && exit 1
1015.endif
1016.if !defined(DIR)
1017	@echo "DIR undefined in installCRUNCH" && exit 1
1018.endif
1019.if !defined(ZIP)
1020	@echo "ZIP undefined in installCRUNCH" && exit 1
1021.endif
1022	@if ${ZIP} ; then \
1023		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1024	else \
1025		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1026	fi
1027	@chmod 555 ${DIR}/${CRUNCH}_crunch
1028	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1029		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1030			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1031		done \
1032	else \
1033		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1034			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1035		done \
1036	fi
1037
1038#
1039# --==## Put a filesystem into a BOOTMFS kernel ##==--
1040#
1041doMFSKERN:
1042	@echo "Running ${.TARGET} for ${FSIMAGE}"
1043	@rm -f ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
1044	@cd ${.CURDIR}/../sys/${TARGET}/conf && \
1045	    sh ${.CURDIR}/${TARGET}/dokern.sh ${FDSIZE} < GENERIC > BOOTMFS && \
1046	    [ -r GENERIC.hints ] && cp GENERIC.hints BOOTMFS.hints
1047.if defined(FDSIZE) && ${FDSIZE} == "SMALL" && \
1048    exists(${.CURDIR}/${TARGET}/drivers-small.conf)
1049	@awk -f ${.CURDIR}/scripts/driver-remove.awk \
1050		${.CURDIR}/${TARGET}/drivers-small.conf \
1051		${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1052.elif exists(${.CURDIR}/${TARGET}/drivers.conf)
1053	@awk -f ${.CURDIR}/scripts/driver-remove.awk \
1054		${.CURDIR}/${TARGET}/drivers.conf \
1055		${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS
1056.endif
1057	cd ${.CURDIR}/..; \
1058	KERNEL_KO=BOOTMFS KODIR= \
1059	    ${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES -DNO_KERNELCLEAN \
1060	    KERNCONF=BOOTMFS COPTFLAGS="-Os -pipe" -DNO_CPU_COPTFLAGS \
1061	    buildkernel reinstallkernel \
1062	    DESTDIR=${RD}/kernels
1063	[ -r ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ] && \
1064	cp ${.CURDIR}/../sys/${TARGET}/conf/BOOTMFS.hints ${RD}/kernels
1065	@rm -rf ${RD}/image.${FSIMAGE}
1066	@mkdir ${RD}/image.${FSIMAGE}
1067	@cd ${RD}/kernels && \
1068	  (chflags noschg BOOTMFS || true) && \
1069	  ${WMAKEENV} strip -R .comment BOOTMFS && \
1070	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
1071	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
1072	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
1073	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
1074	@mkdir -p ${RD}/image.${FSIMAGE}/boot
1075.if ${TARGET} == "i386"
1076	@${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o \
1077	    -o ${RD}/image.${FSIMAGE}/boot/loader ${RD}/trees/base/boot/loader
1078.elif ${TARGET_ARCH} == "ia64"
1079	@cp ${RD}/trees/base/boot/loader.efi ${RD}/image.${FSIMAGE}/boot
1080.else
1081	@cp ${RD}/trees/base/boot/loader ${RD}/image.${FSIMAGE}/boot
1082.endif
1083	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
1084	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
1085	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
1086	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
1087	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
1088	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1089.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
1090	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1091	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1092	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1093.endif
1094	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1095.if ${TARGET_ARCH} != "ia64"
1096	@echo "set hint.acpi.0.disabled=1" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1097.endif
1098	@if [ -r ${RD}/floppies/drivers.flp ]; then \
1099	    echo "set driver_floppy=YES" >> ${RD}/image.${FSIMAGE}/boot/loader.rc; \
1100	fi
1101	@echo "set module_path=\"/modules;/dist\"" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1102	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1103	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
1104.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
1105	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
1106.endif
1107	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
1108	@rm -f ${RD}/floppies/${FSIMAGE}.flp
1109.if defined(FDSIZE) && ${FDSIZE} == "BIG"
1110	@cp mfsroot.gz ${RD}/image.${FSIMAGE}
1111	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1112		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
1113		${BOOTINODE} ${BIGBOOTLABEL}
1114.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
1115	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1116		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
1117		${BOOTINODE} ${SMALLBOOTLABEL}
1118.else
1119	sh -e ${DOFS_SH} ${RD}/floppies/${FSIMAGE}.flp \
1120		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
1121		${BOOTINODE} ${BOOTLABEL}
1122.endif
1123	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1124
1125.include <bsd.obj.mk>
1126