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