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