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