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