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