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