Makefile revision 135694
1# $FreeBSD: head/release/Makefile 135694 2004-09-24 02:10:06Z kensmith $
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.8' 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=6.0-CURRENT
22#
23# Automatic SNAP versioning:
24DATE != date +%Y%m%d
25BASE = 6.0
26BUILDNAME?=${BASE}-${DATE}-SNAP
27#
28#CHROOTDIR=/junk/release
29# If this is a -stable snapshot, then set
30#RELEASETAG=RELENG_4
31#
32# To 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# When retrieving ports using the pkg_add -r method, set your proxies to these.
105# src/release/${arch}/mkisoimages.sh can use these.
106#HTTP_PROXY?=	www.example.com
107#FTP_PROXY?=	ftp.example.com
108
109# When creating ISO images, point ${CD_EXTRA_BITS} to a directory containing
110# extra packages or other files.  It will be appended to the disk 1 ISO.
111#CD_EXTRA_BITS=	/path/to/pkg
112
113# Extra source tarballs; each argument is a pair of source dir and
114# distribution name.  The dist name should not exceed 7 characters
115# (another "s" for "source" will be prepended).
116#EXTRA_SRC=	games/fortune fortune
117
118# Modify this definition if you want the release notes 
119# and other release documentation in a language other than English.
120RELNOTES_LANG?=	en_US.ISO8859-1
121
122# As an alternative to installing the entire ports collection (which
123# can take a huge amount of time, in particular on slower disks),
124# setting ${MINIMALDOCPORTS} allows to install and build just those
125# ports that are really required for getting the docs up & running.
126.if defined(NOPORTS) && !defined(NODOC)
127DOMINIMALDOCPORTS=	YES
128.include "Makefile.inc.docports"
129RELEASEPORTSMODULE=	${MINIMALDOCPORTS}
130.endif
131
132# Make changing names of disc1/disc2 CD's possible.
133DISC1_LABEL?=	fbsd_miniinst
134DISC1_NAME?=	miniinst
135DISC2_LABEL?=	fbsd_livefs
136DISC2_NAME?=	disc2
137
138# Helper variable
139.if defined(NOPORTS)
140.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
141NOPORTSATALL=	YES
142.endif
143.endif
144
145#
146# Doing 'make index' in /usr/ports requires Perl.
147MAKEINDEXPORTS=	lang/perl5.8
148# By default, documentation (Handbook, FAQ, etc.) is built for all
149# the languages.  To speed up building, set the DOC_LANG to just
150# the languages you need.  (The language for the release notes is
151# controlled by the RELNOTES_LANG variable above.)
152#DOC_LANG=	en_US.ISO8859-1
153DOCPORTS=	textproc/docproj
154# Set this to wherever the distfiles required by release procedures.
155.if defined(DOCDISTFILES)
156# Respect DOCDISTFILES which is used before.
157RELEASEDISTFILES?=	${DOCDISTFILES}
158.else
159RELEASEDISTFILES?=	${.CURDIR}/../../ports/distfiles
160.endif
161# Set this to 1 if you want -P to be used for automatic keyboard detection
162# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
163AUTO_KEYBOARD_DETECT?= 0
164
165.if !defined(NODOC)
166DIST_DOCS_ARCH_INDEP=	readme errata
167DIST_DOCS_ARCH_DEP=	installation relnotes hardware
168.endif
169
170# Things which without too much trouble can be considered variables
171# BASE_DISTS are special in that they get full /etc installation sets.
172#
173OTHER_DISTS?=	catpages manpages games proflibs dict info doc
174BASE_DISTS?=	base
175DISTRIBUTIONS?=	${BASE_DISTS} ${OTHER_DISTS}
176
177# mountpoint for filesystems.
178MNT=			/mnt
179
180# Various floppy image parameters.
181#
182
183.undef MAKE_FLOPPIES
184.if ${TARGET_ARCH} == "i386"
185MAKE_FLOPPIES=		true
186.if ${TARGET} == "pc98"
187SMALLFLOPPYSIZE=	1200
188SMALLFLOPPYSPLITSIZE=	1152
189SMALLFLOPPYLABEL=	fd1200
190SPLIT_MFSROOT=
191.endif
192FLOPPYSIZE=		1440
193FLOPPYSPLITSIZE=	1392
194FLOPPYINODE=		40000
195FLOPPYLABEL=		fd1440
196BOOTINODE=		80000
197MFSSIZE=		4320
198MFSINODE=		8000
199MFSLABEL=		minimum3
200.elif ${TARGET_ARCH} == "alpha"
201MAKE_FLOPPIES=		true
202FLOPPYSIZE=		1440
203FLOPPYSPLITSIZE=	1392
204FLOPPYINODE=		40000
205FLOPPYLABEL=		fd1440
206BOOTINODE=		80000
207MFSSIZE=		4320
208MFSINODE=		8000
209MFSLABEL=		auto
210SPLIT_MFSROOT=
211.elif ${TARGET_ARCH} == "sparc64"
212DISKLABEL=		sunlabel
213MFSSIZE=		4096
214MFSINODE=		8192
215MFSLABEL=		auto
216MINIROOT=
217.elif ${TARGET_ARCH} == "ia64"
218MFSSIZE=		8192
219MFSINODE=		8192
220MFSLABEL=		auto
221.elif ${TARGET_ARCH} == "amd64"
222MFSSIZE=		4096
223MFSINODE=		8192
224MFSLABEL=		auto
225.elif ${TARGET_ARCH} == "powerpc"
226DISKLABEL=		""
227MFSSIZE=		4096
228MFSINODE=		8192
229MFSLABEL=		auto
230.endif
231.if defined(NO_FLOPPIES)
232.undef MAKE_FLOPPIES
233.endif
234
235.if exists(/sbin/bsdlabel)
236DISKLABEL?=		bsdlabel
237.else
238DISKLABEL?=		disklabel
239.endif
240
241ZIPNSPLIT=		gzip --no-name -9 -c | split -b 1392k -
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
250.if ${TARGET} != "pc98"
251CD_BOOT=		${CD}/bootonly
252.endif
253CD_DISC1=		${CD}/disc1
254CD_DISC2=		${CD}/disc2
255_MK?=			${CHROOTDIR}/mk
256
257# Where the bootstrap ports (see DOCPORTS) get installed.
258LOCALDIR=		/usr/local/bin
259
260.if ${TARGET} != ${MACHINE} && ${DISKLABEL} == "bsdlabel"
261DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ${TARGET}
262.else
263DOFS_SH=	${.CURDIR}/scripts/doFS.sh ${DISKLABEL} ""
264.endif
265
266CRUNCH_TARGETS=	boot
267.if ${TARGET_ARCH} == "i386"
268CRUNCH_TARGETS+=fixit
269.if ${TARGET} == "pc98"
270CRUNCH_TARGETS+=fixit-small
271.endif
272.endif
273
274.if defined(MAKE_FLOPPIES)
275EXTRAS= floppies.1
276.if ${TARGET_ARCH} == "i386"
277EXTRAS+= floppies.2
278.endif
279EXTRAS+= floppies.3
280.endif
281EXTRAS+= ftp.1
282.if !defined(NOCDROM)
283EXTRAS+= cdrom.1
284.if defined(MAKE_ISOS)
285EXTRAS+= iso.1
286.endif
287.if ${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 defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
332.for p in ${LOCAL_PATCHES}
333.if !exists(${p})
334	@echo "The patch file ${p} does not exist!"
335	@exit 1
336.endif
337.endfor
338.endif
339.if defined(LOCAL_SCRIPT) && !exists(${LOCAL_SCRIPT})
340	@echo "The local script ${LOCAL_SCRIPT} does not exist!"
341	@exit 1
342.endif
343.if make(release)
344.if exists(${CHROOTDIR})
345# The first command will fail on a handful of files that have their schg
346# flags set.  But it greatly speeds up the next two commands.
347	# NB: clear any vestigial devfs mount, just in case
348	-umount ${CHROOTDIR}/dev > /dev/null 2>&1
349	-rm -rf ${CHROOTDIR} 2>/dev/null
350	-chflags -R noschg ${CHROOTDIR}/.
351	-rm -rf ${CHROOTDIR}
352.endif
353	mkdir -p ${CHROOTDIR}
354	@echo ">>> make release for ${TARGET} started on `LC_ALL=C TZ=GMT date`"
355	cd ${WORLDDIR} && ${NATIVEMAKE} -DNOGAMES -DNOHTML -DNOINFO -DNOMAN \
356	    -DNOPROFILE installworld DESTDIR=${CHROOTDIR}
357	cd ${WORLDDIR}/etc && ${NATIVEMAKE} distribution DESTDIR=${CHROOTDIR}
358	if [ -f /etc/resolv.conf ]; then \
359		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
360	fi
361.if defined(EXTLOCALDIR)
362	rm -rf ${CHROOTDIR}/usr/local
363	cd ${CHROOTDIR}/usr && cp -R -H ${EXTLOCALDIR} local
364.endif
365	rm -rf ${CHROOTDIR}/usr/src
366.if defined(EXTSRCDIR)
367	cd ${CHROOTDIR}/usr && \
368	    cp -R -H ${EXTSRCDIR} src
369.else
370	cd ${CHROOTDIR}/usr && \
371	    ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
372	    co ${CVSCMDARGS} ${CVS_SRCARGS} ${RELEASESRCMODULE}
373.endif
374.if defined(LOCAL_PATCHES) && !empty(LOCAL_PATCHES)
375.for p in ${LOCAL_PATCHES}
376	patch -d ${CHROOTDIR}/usr/${RELEASESRCMODULE} ${PATCH_FLAGS} < ${p}
377.endfor
378.endif
379.if defined(LOCAL_SCRIPT)
380	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} \
381	    RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
382.endif
383	rm -rf ${CHROOTDIR}/usr/ports
384.if !defined(NOPORTSATALL)
385	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
386	    co ${CVSCMDARGS} ${CVS_PORTSARGS} ${RELEASEPORTSMODULE}
387.endif
388.if !defined(NODOC)
389	rm -rf ${CHROOTDIR}/usr/doc
390.if defined(EXTDOCDIR)
391	cd ${CHROOTDIR}/usr && cp -R -H ${EXTDOCDIR} doc
392.else
393	cd ${CHROOTDIR}/usr && ${CVSPREFIX} cvs -R ${CVSARGS} -d ${CVSROOT} \
394	    co ${CVSCMDARGS} ${CVS_DOCARGS} ${RELEASEDOCMODULE}
395.endif
396	if [ -d ${RELEASEDISTFILES}/ ]; then \
397		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
398	else \
399		mkdir -p ${CHROOTDIR}/usr/ports/distfiles; \
400	fi
401.if !defined(NO_PREFETCHDISTFILES)
402	@cd ${.CURDIR} && ${MAKE} fetch-distfiles
403.endif
404.endif
405.endif
406.if make(rerelease)
407.if !defined(RELEASENOUPDATE)
408.if !defined(RELEASETAG)
409	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
410	    update ${CVSCMDARGS} -P -d -A
411.else
412	cd ${CHROOTDIR}/usr/src && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
413	    update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
414.endif
415	rm -f ${CHROOTDIR}/tmp/.world_done 
416.if !defined(NOPORTS)
417	cd ${CHROOTDIR}/usr/ports && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
418	    update ${CVSCMDARGS} -P -d
419	rm -f ${CHROOTDIR}/tmp/.skip_ports_index \
420	    ${CHROOTDIR}/tmp/.skip_ports_readmes
421.endif
422.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
423	for i in ${MINIMALDOCPORTS}; do \
424	    ( cd ${CHROOTDIR}/usr/$$i && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
425		update ${CVSCMDARGS} -P -d ) ; \
426	done
427.endif
428.if !defined(NODOC)
429	cd ${CHROOTDIR}/usr/doc && ${CVSPREFIX} cvs -R ${CVSARGS} -q \
430	    update ${CVSCMDARGS} -P -d
431.endif
432.endif
433.endif
434	# Add version information to those things that need it.
435	if [ ! -f ${CHROOTDIR}/tmp/.world_done ]; then \
436		cd ${CHROOTDIR}/usr/src/sys/conf && \
437		mv newvers.sh foo && \
438		sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && \
439		rm foo; \
440	fi
441	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
442	echo "#!/bin/sh"			> ${_MK}
443	echo "set -ex"				>> ${_MK}
444	echo "trap 'umount /dev || true' 0"	>> ${_MK}
445	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${_MK}
446.for var in \
447	AUTO_KEYBOARD_DETECT \
448	BUILDNAME \
449	CD_EXTRA_BITS \
450	DISC1_LABEL \
451	DISC1_NAME \
452	DISC2_LABEL \
453	DISC2_NAME \
454	DISTRIBUTIONS \
455	DOC_LANG \
456	DOMINIMALDOCPORTS \
457	EXTRA_SRC \
458	FTP_PASSIVE_MODE \
459	FTP_PROXY \
460	HTTP_PROXY \
461	KERNELS \
462	KERNEL_FLAGS \
463	MAKE_FLOPPIES \
464	MAKE_ISOS \
465	NOCDROM \
466	NODOC \
467	NOPORTS \
468	NOSHARED \
469	NOSRC \
470	NO_CPU_CFLAGS \
471	NO_CPU_COPTFLAGS \
472	NO_FLOPPIES \
473	NO_SENDMAIL \
474	RELEASETAG \
475	RELNOTES_LANG \
476	TARGET \
477	TARGET_ARCH \
478	WORLD_FLAGS
479.if defined(${var})
480	echo "export ${var}=\"${${var}}\""	>> ${_MK}
481.endif
482.endfor
483	# Don't remove this, or the build will fall over!
484	echo "export RELEASEDIR=${_R}"		>> ${_MK}
485	echo "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:${LOCALDIR}"	>> ${_MK}
486	echo "export MANBUILDCAT=YES"		>> ${_MK}
487	# NB: these may fail if the host is running w/o devfs
488	echo "umount /dev >/dev/null 2>&1 || true" >> ${_MK}
489	echo "mount -t devfs devfs /dev >/dev/null 2>&1 || true"	>> ${_MK}
490	echo "if [ -x /etc/rc.d/ldconfig ]; then" >> ${_MK}
491	echo "	/etc/rc.d/ldconfig start"	>> ${_MK}
492	echo "else"				>> ${_MK}
493	echo "	ldconfig /lib /usr/lib /usr/local/lib || true" >> ${_MK}
494	echo "fi"				>> ${_MK}
495	echo "if [ ! -f /tmp/.world_done ]; then" >> ${_MK}
496	echo "	cd /usr/src"			>> ${_MK}
497	echo "	${CROSSMAKE} ${WORLD_FLAGS} -DNOCLEAN buildworld && \\" >> ${_MK}
498	echo "	touch /tmp/.world_done || exit 1" >> ${_MK}
499	echo "fi"				>> ${_MK}
500	echo "if [ ! -f /tmp/.skip_ports_index ]; then" >> ${_MK}
501	echo "	echo \">>> make index started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
502	echo "	for i in ${MAKEINDEXPORTS}"	>> ${_MK}
503	echo "	do"			>> ${_MK}
504	echo "		cd /usr/ports/\$${i}"	>> ${_MK}
505	echo "		env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \\" >> ${_MK}
506	echo "		make all install clean BATCH=yes FORCE_PKG_REGISTER=yes" >> ${_MK}
507	echo "	done"				>> ${_MK}
508	echo "	cd /usr/ports"			>> ${_MK}
509	echo "	rm -f INDEX*"			>> ${_MK}
510	echo "	make index -DINDEX_PRISTINE"	>> ${_MK}
511	echo "	rm -f INDEX.tmp"		>> ${_MK}
512	echo "	touch /tmp/.skip_ports_index"	>> ${_MK}
513	echo "	echo \">>> make index finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
514	echo "fi"				>> ${_MK}
515	echo "if [ ! -f /tmp/.skip_ports_readmes ]; then" >> ${_MK}
516	echo "	echo \">>> make readmes started on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
517	echo "	cd /usr/ports"			>> ${_MK}
518	echo "	make ${PORTREADMES_FLAGS} readmes" >> ${_MK}
519	echo "	touch /tmp/.skip_ports_readmes"	>> ${_MK}
520	echo "	echo \">>> make readmes finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
521	echo "fi"				>> ${_MK}
522	echo "cd /usr/src/release"		>> ${_MK}
523	echo "make obj"				>> ${_MK}
524	echo "make \$${_RELTARGET}"		>> ${_MK}
525	echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK}
526	chmod 755 ${_MK}
527.if defined(NOPORTS)
528	touch ${CHROOTDIR}/tmp/.skip_ports_index
529.endif
530.if defined(NOPORTS) || defined(NOPORTREADMES)
531	touch ${CHROOTDIR}/tmp/.skip_ports_readmes
532.endif
533	# Ensure md.ko is loaded if md(4) is not statically compiled into 
534	# the kernel
535	-mdconfig 2>/dev/null
536	env -i /usr/sbin/chroot `dirname ${_MK}` /`basename ${_MK}`
537
538clean:
539	rm -rf ${CRUNCH_TARGETS:S/$/_crunch/} release.[0-8] ${EXTRAS}
540
541fetch-distfiles:
542	@for i in ${MAKEINDEXPORTS}; do \
543		cd ${CHROOTDIR}/usr/ports/$$i && \
544			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
545			checksum-recursive ; \
546	done
547	@for i in ${DOCPORTS}; do \
548		cd ${CHROOTDIR}/usr/ports/$$i && \
549			make PORTSDIR=${CHROOTDIR}/usr/ports BATCH=yes \
550			WITHOUT_X11=yes JADETEX=no WITHOUT_PYTHON=yes \
551			checksum-recursive ; \
552	done
553
554# Clean out ${_R} and make the directory structure.
555release.1:
556	mkdir -p ${_R}
557	-rm -rf ${_R}/* 2> /dev/null
558	-chflags -R noschg ${_R}/.
559	rm -rf ${_R}/*
560	mkdir ${RD}
561.if defined(MAKE_FLOPPIES)
562	mkdir ${RD}/floppies
563.endif
564	mkdir ${RD}/trees
565	mkdir ${RD}/kernels
566	for i in ${DISTRIBUTIONS}; do \
567		mkdir ${RD}/trees/$$i && \
568		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
569		    -p ${RD}/trees/$$i > /dev/null && \
570		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
571		    -p ${RD}/trees/$$i/usr > /dev/null && \
572		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
573		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
574		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
575		    -p ${RD}/trees/$$i/var > /dev/null ; \
576	done
577	touch ${.TARGET}
578
579# Install the system into the various distributions.
580release.2:
581	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/base
582	cd ${.CURDIR}/.. && ${CROSSMAKE} distributeworld DISTDIR=${RD}/trees
583	touch ${.TARGET}
584
585# Make and install the generic kernel(s).
586release.3:
587.for kernel in ${KERNELS}
588	cd ${.CURDIR}/..; \
589	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
590	    KERNCONF=${kernel} INSTKERNNAME=${kernel} kernel \
591	    DESTDIR=${RD}/trees/base
592.endfor
593	# Install a standard boot kernel+modules.
594	cd ${.CURDIR}/..; \
595	${CROSSMAKE} ${KERNEL_FLAGS} \
596	    kernel \
597	    DESTDIR=${RD}/trees/base; \
598	cd ${.CURDIR}/..; \
599	${CROSSMAKE} ${KERNEL_FLAGS} -DNO_MODULES \
600	    reinstallkernel -DINSTALL_DEBUG \
601	    DESTDIR=${RD}/trees/base
602	touch ${.TARGET}
603
604# Make and install the three crunched binaries which live on the floppies.
605# You are not supposed to like this :-)
606release.4:
607	rm -rf ${RD}/crunch
608	mkdir -p ${RD}/crunch
609.for j in ${CRUNCH_TARGETS}
610.if exists(${.CURDIR}/${TARGET}/${j}_crunch.conf)
611	rm -rf ${j}_crunch
612	mkdir ${j}_crunch
613	cd ${j}_crunch; ${WMAKEENV} crunchgen -o \
614	    ${.CURDIR}/${TARGET}/${j}_crunch.conf
615	cd ${j}_crunch; ${WMAKE} -f ${j}_crunch.mk subclean
616	cd ${.CURDIR}/..; ${BINMAKE} -f Makefile.inc1 _build-tools
617	cd ${j}_crunch; CFLAGS="-Os -pipe" ${WMAKE} -f ${j}_crunch.mk \
618	    -DNO_CPU_CFLAGS all
619	${WMAKEENV} strip -R .comment ${j}_crunch/${j}_crunch
620	mv ${j}_crunch/${j}_crunch ${RD}/crunch/${j}
621.endif
622.endfor
623	touch ${.TARGET}
624
625#
626# --==## Fix up the distributions. ##==--
627#
628release.5:
629	# Create any "synthetic dists" now.
630	@for i in ${DISTRIBUTIONS}; do \
631		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
632			echo -n "Running $$i dist creation script... "; \
633			env RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
634			echo "Done."; \
635		fi \
636	done \
637
638	# Remove all the directories we don't need.
639	-cd ${RD}/trees && \
640		find ${OTHER_DISTS} -depth -type d -print | xargs rmdir
641	touch ${.TARGET}
642
643#
644# --==## Package up the tarballs from assembled trees ##==--
645#
646release.6:
647	rm -rf ${RD}/dists
648	mkdir -p ${RD}/dists
649	@for i in ${DISTRIBUTIONS} ; \
650	do \
651		if [ -d ${RD}/trees/$${i} ] ; then \
652			cd ${.CURDIR} && $(MAKE) doTARBALL \
653				SD=${RD}/trees/$${i} \
654				TN=$$i TD=$$i ARG="." && \
655			echo "$${i} distribution is finished."; \
656		fi ; \
657	done
658.if !defined(NOPORTS)
659	# XXX: Inline stripped version of doTARBALL
660	@rm -rf ${RD}/dists/ports/ports*
661	@mkdir -p ${RD}/dists/ports
662	@echo rolling ports/ports tarball
663	@tar --exclude CVS --exclude 'ports/distfiles/*' \
664	  --exclude README.html -czf ${RD}/dists/ports/ports.tgz -C /usr ports
665	@cp ${.CURDIR}/scripts/ports-install.sh ${RD}/dists/ports/install.sh
666	@(cd ${RD}/dists/ports; \
667	  rm -f CHECKSUM.MD5; \
668	  md5 * > CHECKSUM.MD5)
669	@echo "ports distribution is finished."
670.endif
671	touch ${.TARGET}
672
673
674#
675# --==## Make source dists ##==--
676#
677release.7:
678.if !defined(NOSRC)
679	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
680		TD=src TN=sbase ARG="[A-Z]*"
681	@for i in `cd /usr/src && echo [a-z]*` ; do \
682		if [ -d /usr/src/$$i ] ; then \
683			cd ${.CURDIR} && $(MAKE) doTARBALL \
684				TN=`echo s$$i | tr -d '.' | \
685				    sed -e 's/usr/u/' \
686					-e 's/kerberos5/krb5/'` \
687				SD=/usr/src TD=src ARG="$$i" ; \
688		fi ; \
689	done
690.if defined(EXTRA_SRC)
691	@set ${EXTRA_SRC} && \
692	while [ $$# -ge 2 ] ; do \
693		if [ -d /usr/src/$$1 ] ; then \
694			cd ${.CURDIR} && $(MAKE) doTARBALL \
695				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
696		fi && shift && shift ; \
697	done
698.endif
699	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
700	@echo "src distribution is finished."
701.endif
702	touch ${.TARGET}
703
704# Build the memory root filesystem.
705release.8:
706	cp ${RD}/trees/base/etc/disktab /etc
707	rm -rf ${RD}/mfsfd
708	mkdir ${RD}/mfsfd
709	cd ${RD}/mfsfd && \
710		mkdir -p etc/defaults dev mnt stand/etc/defaults stand/help
711	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
712		DIR=${RD}/mfsfd/stand ZIP=false
713	( cd ${RD}/mfsfd && \
714	  for dir in bin sbin ; do \
715		ln -sf /stand $$dir; \
716	  done )
717	cp ${RD}/trees/base/sbin/dhclient-script ${RD}/mfsfd/stand
718.if ${TARGET} == "pc98"
719	cp ${.CURDIR}/../etc/defaults/pccard.conf \
720	    ${RD}/mfsfd/etc/defaults/pccard.conf
721.endif
722	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
723	( for F in defaults/rc.conf netconfig protocols ; do \
724		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
725		${RD}/trees/base/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
726	  done )
727	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
728	    ${RD}/trees/base/etc/services | \
729	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
730	    > ${RD}/mfsfd/stand/etc/services
731	grep 'operator' ${RD}/trees/base/etc/group \
732	    > ${RD}/mfsfd/stand/etc/group
733	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
734	ln ${RD}/mfsfd/stand/etc/group ${RD}/mfsfd/etc/group
735	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
736	cp ${RD}/trees/base/COPYRIGHT ${RD}/mfsfd/stand/help/COPYRIGHT.hlp
737.if !defined(NODOC)
738	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
739	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
740	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
741	done
742	@for i in ${DIST_DOCS_ARCH_DEP}; do \
743	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
744	      ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
745	done
746	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT \
747	    ${RD}/mfsfd/stand/help/INSTALL.TXT
748.endif
749	-test -f ${.CURDIR}/install.cfg \
750	    && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
751	@mkdir -p ${RD}/mfsfd/boot
752.if ${TARGET_ARCH} != "ia64" && ${TARGET_ARCH} != "powerpc"
753	@cp ${RD}/trees/base/boot/boot* ${RD}/mfsfd/boot
754.endif
755.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
756	@cp ${RD}/trees/base/boot/mbr ${RD}/mfsfd/boot
757.endif
758	@tar --exclude CVS -cf - -C ${.CURDIR}/../usr.sbin/sysinstall help | \
759		tar xf - -C ${RD}/mfsfd/stand
760	@mkdir -p ${RD}/mfsroot
761	sh -e ${DOFS_SH} ${RD}/mfsroot/mfsroot ${RD} ${MNT} \
762	    ${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
763	@gzip -9fnv ${RD}/mfsroot/mfsroot
764	touch ${.TARGET}
765
766KERNFLOPPYSET=		${RD}/floppyset/kern/kernel.gz
767.if defined(SMALLFLOPPYSIZE)
768SMALLKERNFLOPPYSET=	${RD}/floppyset/kern-small/kernel.gz
769.endif
770.if defined(SPLIT_MFSROOT)
771MFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot/mfsroot.gz
772.if defined(SMALLFLOPPYSIZE)
773SMALLMFSROOTFLOPPYSET=	${RD}/floppyset/mfsroot-small/mfsroot.gz
774.endif
775.endif
776
777# Build boot and install floppies.
778floppies.1:
779	@gzip -9nc ${RD}/trees/base/boot/kernel/kernel > ${RD}/kernels/kernel.gz
780	@echo "Making the kernel boot floppies..."
781	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern \
782	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz
783.if defined(SMALLFLOPPYSIZE)
784	@echo "Making the small kernel boot floppies..."
785	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=kern-small \
786	    FLOPPYDESC="Kernel" SPLITFILE=${RD}/kernels/kernel.gz \
787	    FDSIZE="SMALL"
788.endif
789.if defined(SPLIT_MFSROOT)
790	@echo "Making the mfsroot boot floppies..."
791	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot \
792	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz
793.if defined(SMALLFLOPPYSIZE)
794	@echo "Making the small mfsroot boot floppies..."
795	@cd ${.CURDIR} && ${MAKE} makeFloppySet FLOPPYBASE=mfsroot-small \
796	    FLOPPYDESC="Memory Filesystem" SPLITFILE=${RD}/mfsroot/mfsroot.gz \
797	    FDSIZE="SMALL"
798.endif
799	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
800	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
801	    MFSROOTFILE="${MFSROOTFLOPPYSET}.split ${MFSROOTFLOPPYSET}.boot"
802.if defined(SMALLFLOPPYSIZE)
803	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
804	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
805	    MFSROOTFILE="${SMALLMFSROOTFLOPPYSET}.split ${SMALLMFSROOTFLOPPYSET}.boot" \
806	    FDSIZE="SMALL"
807.endif
808.else	# !SPLIT_MFSROOT
809	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot" \
810	    KERNFILE="${KERNFLOPPYSET}.split ${KERNFLOPPYSET}.boot" \
811	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz
812.if defined(SMALLFLOPPYSIZE)
813	@cd ${.CURDIR} && ${MAKE} buildBootFloppy FSIMAGE="boot-small" \
814	    KERNFILE="${SMALLKERNFLOPPYSET}.split ${SMALLKERNFLOPPYSET}.boot" \
815	    MFSROOTFILE=${RD}/mfsroot/mfsroot.gz \
816	    FDSIZE="SMALL"
817.endif
818.endif	# SPLIT_MFSROOT
819	touch ${.TARGET}
820
821# Build fixit floppy.
822floppies.2:
823	@echo "Making fixit floppy."
824	@rm -rf ${RD}/fixitfd
825	@mkdir ${RD}/fixitfd
826	@cd ${RD}/fixitfd && \
827	    mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
828	    usr/share/misc
829	@cp ${RD}/trees/base/etc/spwd.db ${RD}/trees/base/etc/group \
830	    ${RD}/fixitfd/etc
831	@sed -e 's/#.*//' ${RD}/trees/base/etc/protocols \
832	    > ${RD}/fixitfd/etc/protocols
833	@sed -e 's/#.*//' ${RD}/trees/base/usr/share/misc/scsi_modes \
834	    > ${RD}/fixitfd/usr/share/misc/scsi_modes
835	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
836	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
837	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
838	@chmod 555 ${RD}/fixitfd/stand/tar
839.if defined(SMALLFLOPPYSIZE)
840	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit-small \
841	    DIR=${RD}/fixitfd/stand ZIP=false
842	@sh -e ${DOFS_SH} ${RD}/floppies/fixit-small.flp ${RD} ${MNT} \
843	    ${SMALLFLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${SMALLFLOPPYLABEL}
844	@rm -rf ${RD}/fixitfd/stand
845	@mkdir ${RD}/fixitfd/stand
846.endif
847	@cd ${.CURDIR} && ${MAKE} installCRUNCH CRUNCH=fixit \
848	    DIR=${RD}/fixitfd/stand ZIP=false
849	@sh -e ${DOFS_SH} ${RD}/floppies/fixit.flp ${RD} ${MNT} \
850	    ${FLOPPYSIZE} ${RD}/fixitfd ${FLOPPYINODE} ${FLOPPYLABEL}
851	touch ${.TARGET}
852
853# Do our last minute floppies directory setup
854floppies.3:
855.if !defined(NODOC)
856	@cp ${RND}/${RELNOTES_LANG}/installation/${TARGET}/article.txt \
857	    ${RD}/floppies/README.TXT
858	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
859.else
860	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
861.endif
862	touch ${.TARGET}
863
864#
865# --==## Setup a suitable ftp-area ##==--
866#
867ftp.1:
868	@echo "Setting up FTP distribution area"
869	@mkdir -p ${FD}
870	-@ln -s . ${FD}/${BUILDNAME}
871.if defined(MAKE_FLOPPIES)
872	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
873.endif
874	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
875.if !defined(NODOC)
876	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
877		cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
878		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
879		cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
880		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
881	done
882	@for i in ${DIST_DOCS_ARCH_DEP}; do \
883		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
884		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
885		cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
886		    ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
887	done
888	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${FD}
889	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
890	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
891.endif
892	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
893	touch ${.TARGET}
894
895#
896# --==## Setup a suitable cdrom-area ##==--
897#
898cdrom.1:
899	@echo "Setting up CDROM distribution area"
900	@mkdir -p ${CD_BOOT} ${CD_DISC1} ${CD_DISC2}
901	-@ln -s . ${CD_DISC1}/${BUILDNAME}
902.if defined(MAKE_FLOPPIES)
903	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
904.endif
905	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
906	@for i in ${DISTRIBUTIONS} ; \
907	do \
908		if [ -d ${RD}/trees/$${i} ] ; then \
909			chflags -R noschg ${RD}/trees/$${i} || true ; \
910			( cd ${RD}/trees/$${i} && \
911			    find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
912		fi \
913	done
914	@rm -f ${CD_DISC2}/.profile
915	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
916	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
917	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
918.if !defined(NOPORTS)
919	@tar --exclude CVS --exclude 'ports/distfiles/*' -czf - \
920	  -C /usr ports | (cd ${CD_DISC2}/usr; tar -xpBf -)
921.endif
922.if !defined(NODOC)
923	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
924	  cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \
925	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
926	  cp ${RND}/${RELNOTES_LANG}/$$i/article.html \
927	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
928	done
929	@for i in ${DIST_DOCS_ARCH_DEP}; do \
930	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \
931	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
932	  cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \
933	      ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
934	done
935	@cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
936	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
937	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
938.endif
939.if ${TARGET} != "pc98"
940	@echo "Setting up boot area"
941	@rm -f ${CD_DISC2}/boot/loader.conf
942	@cp ${RD}/mfsroot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
943	@echo 'mfsroot_load="YES"' > ${CD_DISC2}/boot/loader.conf
944	@echo 'mfsroot_type="mfs_root"' >> ${CD_DISC2}/boot/loader.conf
945	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC2}/boot/loader.conf
946.if exists(${HINTSFILE})
947	# Break the link to device.hints so we can modify it
948	@cp -f ${HINTSFILE} ${CD_DISC2}/boot/device.hints
949.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
950	@echo 'hint.atkbd.0.flags="0x1"' >> ${CD_DISC2}/boot/device.hints
951.endif
952.endif
953.if defined(CD_BOOT)
954	@cp -Rp ${CD_DISC2}/boot ${CD_BOOT}
955.if defined(MINIROOT)
956	@mkdir -p ${FD}/miniroot
957	@sh -e ${DOFS_SH} ${FD}/miniroot/miniroot.ufs \
958	    ${RD} ${MNT} 0 ${CD_BOOT} 8192 auto
959	@gzip -9v ${FD}/miniroot/miniroot.ufs
960.endif
961.endif
962	@cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
963.endif
964	touch ${.TARGET}
965
966iso.1:
967.if exists(${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh)
968	@echo "Creating ISO images..."
969.if defined(CD_BOOT)
970	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
971	    fbsd_bootonly \
972	    ${CD}/${BUILDNAME}-${TARGET}-bootonly.iso ${CD_BOOT}
973.endif
974	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
975	    ${DISC1_LABEL} \
976	    ${CD}/${BUILDNAME}-${TARGET}-${DISC1_NAME}.iso ${CD_DISC1}
977	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
978	    ${DISC2_LABEL} \
979	    ${CD}/${BUILDNAME}-${TARGET}-${DISC2_NAME}.iso ${CD_DISC2}
980.if defined(CD_EXTRA_BITS)
981	@sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \
982	    fbsd_boot \
983	    ${CD}/${BUILDNAME}-${TARGET}-disc1.iso ${CD_DISC1} \
984	    ${CD_EXTRA_BITS} \
985	    && false
986.endif
987	@(cd ${CD} && md5 *.iso > ${BUILDNAME}-${TARGET}-iso.CHECKSUM.MD5)
988	touch ${.TARGET}
989.else
990	@echo "Do not know how to create an ISO for ${TARGET_ARCH}."
991.endif
992
993#
994# --==## Documentation Project files such as the Handbook and FAQ ##==--
995#
996doc.1:
997	@echo "Making docs..."
998	@for i in ${DOCPORTS}; do \
999	    cd /usr/ports/$$i && \
1000	    env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \
1001		make all install clean BATCH=yes WITHOUT_X11=yes JADETEX=no \
1002		WITHOUT_PYTHON=yes FORCE_PKG_REGISTER=yes; \
1003	done
1004	@cd /usr/doc && make all install 'FORMATS=html html-split txt' \
1005	    INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/base/usr/share/doc \
1006	    URLS_ABSOLUTE=YES	
1007	touch ${.TARGET}
1008
1009#
1010# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
1011#
1012doc.2:
1013	@echo "Making release documentation..."
1014	@cd ${.CURDIR}/doc && make all install clean 'FORMATS=html txt' \
1015	    INSTALL_COMPRESSED='' DOCDIR=${RND}
1016	touch ${.TARGET}
1017
1018# Various "subroutine" and other supporting targets.
1019
1020# RD=
1021# SD=
1022# TD=
1023# ARG=
1024doTARBALL:
1025.if !defined(SD)
1026	@echo "SD undefined in doTARBALL" && exit 1
1027.endif
1028.if !defined(TD)
1029	@echo "TD undefined in doTARBALL" && exit 1
1030.endif
1031.if !defined(ARG)
1032	@echo "ARG undefined in doTARBALL" && exit 1
1033.endif
1034	@rm -rf ${RD}/dists/${TD}/${TN}*
1035	@mkdir -p ${RD}/dists/${TD}
1036	@( cd ${SD} && \
1037		tn=`echo ${TN} | tr 'A-Z' 'a-z' | cut -c1-8` && \
1038		echo rolling ${TD}/$$tn tarball &&\
1039		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
1040		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
1041		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn \
1042		    > ${RD}/dists/${TD}/$$tn.inf && \
1043		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
1044			cp -p ${.CURDIR}/scripts/$${TD}-install.sh \
1045			    ${RD}/dists/${TD}/install.sh; \
1046		fi && \
1047		if [ "${SD}" != "/usr/src" ]; then \
1048			mtree -c -i -p ${SD}/${ARG} \
1049			  -k gname,md5digest,mode,nlink,uname,size,link,type \
1050			  > ${RD}/dists/${TD}/$$tn.mtree ; \
1051		else \
1052			true; \
1053		fi; \
1054		( cd ${RD}/dists/${TD}; \
1055		rm -f CHECKSUM.MD5; \
1056		md5 * > CHECKSUM.MD5 ) \
1057	)
1058
1059doRELEASE: release.1 release.2 ${DOCREL} release.3 release.4 \
1060    release.5 release.6 release.7 release.8 ${EXTRAS}
1061	@echo "Release done"
1062
1063floppies:
1064	@rm -f release.4 release.8 floppies.[123]
1065	@cd ${.CURDIR} && ${MAKE} release.4 release.8 floppies.1 floppies.2 \
1066	    floppies.3
1067	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
1068
1069installCRUNCH:
1070.if !defined(CRUNCH)
1071	@echo "CRUNCH undefined in installCRUNCH" && exit 1
1072.endif
1073.if !defined(DIR)
1074	@echo "DIR undefined in installCRUNCH" && exit 1
1075.endif
1076.if !defined(ZIP)
1077	@echo "ZIP undefined in installCRUNCH" && exit 1
1078.endif
1079	@if ${ZIP} ; then \
1080		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
1081	else \
1082		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
1083	fi
1084	@chmod 555 ${DIR}/${CRUNCH}_crunch
1085	@if [ -f ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf ] ; then \
1086		for i in `crunchgen -l ${.CURDIR}/${TARGET}/${CRUNCH}_crunch.conf` ; do \
1087			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1088		done \
1089	else \
1090		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
1091			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
1092		done \
1093	fi
1094
1095#
1096# --==## Build a floppy set for a splitfs file ##==--
1097#
1098# FLOPPYBASE - basename of floppy image files
1099# FLOPPYDESC - description of floppy set
1100# SPLITFILE - filename of the file to split
1101# FDSIZE - if specified and "small", small floppy is created
1102
1103.if make(makeFloppySet)
1104SPLITDIR=	${RD}/floppyset/${FLOPPYBASE}
1105.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1106FLPSPLITSIZE=	${SMALLFLOPPYSPLITSIZE}
1107FLPSIZE=	${SMALLFLOPPYSIZE}
1108FLPLABEL=	${SMALLFLOPPYLABEL}
1109.else
1110FLPSPLITSIZE=	${FLOPPYSPLITSIZE}
1111FLPSIZE=	${FLOPPYSIZE}
1112FLPLABEL=	${FLOPPYLABEL}
1113.endif
1114.endif
1115
1116makeFloppySet:
1117.if !defined(FLOPPYBASE)
1118	@echo "FLOPPYBASE undefined in ${.TARGET}" && exit 1
1119.endif
1120.if !defined(FLOPPYDESC)
1121	@echo "FLOPPYDESC undefined in ${.TARGET}" && exit 1
1122.endif
1123.if !defined(SPLITFILE)
1124	@echo "SPLITFILE undefined in ${.TARGET}" && exit 1
1125.endif
1126	sh ${.CURDIR}/scripts/split-file.sh ${SPLITFILE} \
1127	    ${RD}/floppyset/${FLOPPYBASE} ${FLPSPLITSIZE} "${FLOPPYDESC}"
1128	( splitfile=${SPLITDIR}/`basename ${SPLITFILE}`.split ; \
1129	lines=`cat $${splitfile} | wc -l`; \
1130	lines=$$(($$lines - 1)) ; \
1131	for line in `jot $$lines`; do \
1132		file=`head -n $$(($${line} + 1)) $${splitfile} | tail -1 | cut -f 1 -d ' '` ; \
1133		sh -e ${DOFS_SH} ${RD}/floppies/${FLOPPYBASE}$${line}.flp \
1134		${RD} ${MNT} ${FLPSIZE} ${SPLITDIR}/$${file} \
1135		${BOOTINODE} ${FLPLABEL}; \
1136	done )
1137
1138#
1139# --==## Build a boot floppy ##==--
1140#
1141# FSIMAGE - base floppy image name
1142# FDSIZE - if specified and "small", small floppy is created
1143# KERNFILE - path to kernel split file
1144# MFSROOTFILE - path to mfsroot split file
1145
1146.if make(buildBootFloppy)
1147IMAGEDIR=	${RD}/image.${FSIMAGE}
1148BOOTDIR=	${RD}/trees/base/boot
1149HINTSFILE=	${BOOTDIR}/device.hints
1150ACPI_KO=	${BOOTDIR}/kernel/acpi.ko
1151IMAGEFILE=	${RD}/floppies/${FSIMAGE}.flp
1152.if defined(FDSIZE) && ${FDSIZE} == "SMALL"
1153FLPSIZE=	${SMALLFLOPPYSIZE}
1154FLPLABEL=	${SMALLFLOPPYLABEL}
1155.else
1156FLPSIZE=	${FLOPPYSIZE}
1157FLPLABEL=	${FLOPPYLABEL}
1158.endif
1159.endif
1160
1161buildBootFloppy:
1162.if !defined(FSIMAGE)
1163	@echo "FSIMAGE undefined in ${.TARGET}" && exit 1
1164.endif
1165.if !defined(KERNFILE)
1166	@echo "KERNFILE undefined in ${.TARGET}" && exit 1
1167.endif
1168.if !defined(MFSROOTFILE)
1169	@echo "MFSROOTFILE undefined in ${.TARGET}" && exit 1
1170.endif
1171	@echo "Running ${.TARGET} for ${FSIMAGE}"
1172	@rm -rf ${IMAGEDIR}
1173	@mkdir ${IMAGEDIR}
1174	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
1175	@mkdir -p ${IMAGEDIR}/boot
1176.if ${TARGET} == "i386"
1177	@${WMAKEENV} kgzip -v -l ${RD}/trees/base/usr/lib/kgzldr.o -o \
1178	    ${IMAGEDIR}/boot/loader ${BOOTDIR}/loader
1179.else
1180	@cp ${BOOTDIR}/loader ${IMAGEDIR}/boot
1181.endif
1182	@cp -Rp ${BOOTDIR}/*.4th ${BOOTDIR}/defaults ${BOOTDIR}/loader.help \
1183	    ${BOOTDIR}/loader.rc ${IMAGEDIR}/boot
1184.if exists(${HINTSFILE})
1185	@cp ${HINTSFILE} ${IMAGEDIR}/boot/device.hints
1186.if ${TARGET} == "i386" || ${TARGET_ARCH} == "amd64"
1187	@echo 'hint.atkbd.0.flags="0x1"' >> ${IMAGEDIR}/boot/device.hints
1188.endif
1189	@gzip -9n ${IMAGEDIR}/boot/device.hints
1190.endif
1191	@gzip -9n ${IMAGEDIR}/boot/*.4th ${IMAGEDIR}/boot/loader.help \
1192	    ${IMAGEDIR}/boot/defaults/loader.conf
1193	@echo 'bootfile="/kernel"' > ${IMAGEDIR}/boot/loader.conf
1194.if exists(${ACPI_KO})
1195	@gzip -9nc ${ACPI_KO} > ${IMAGEDIR}/acpi.ko.gz
1196	@echo 'acpi_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
1197	@echo 'acpi_name="/acpi.ko"' >> ${IMAGEDIR}/boot/loader.conf
1198	@echo 'acpi_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1199.endif
1200	@echo 'mfsroot_load="YES"' >> ${IMAGEDIR}/boot/loader.conf
1201	@echo 'mfsroot_type="mfs_root"' >> ${IMAGEDIR}/boot/loader.conf
1202	@echo 'mfsroot_name="/mfsroot"' >> ${IMAGEDIR}/boot/loader.conf
1203.if !exists(${ACPI_KO})
1204	@echo 'mfsroot_before="read -p \"Insert boot floppy and press Enter\""' >> ${IMAGEDIR}/boot/loader.conf
1205.endif
1206.if ${TARGET_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
1207	@echo "-P" >> ${IMAGEDIR}/boot.config
1208.endif
1209	@rm -f ${IMAGEFILE}
1210	@cp ${KERNFILE} ${MFSROOTFILE} ${IMAGEDIR}
1211	sh -e ${DOFS_SH} ${IMAGEFILE} ${RD} ${MNT} ${FLPSIZE} ${IMAGEDIR} \
1212	    ${BOOTINODE} ${FLPLABEL}
1213	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1214
1215.include <bsd.obj.mk>
1216