xref: /freebsd/release/Makefile (revision 4091481652fcca6cbaaf63af10619cd410f2f5e7)
1# $FreeBSD$
2#
3# make release CHROOTDIR=/some/dir BUILDNAME=somename 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 compiled into your kernel
13# or available as a kld(4)-style kernel module,
14# otherwise the target 'release.8' and possibly others will fail.
15#
16# Set these, release builder!
17#
18# Fixed version:
19#BUILDNAME=5.0-RELEASE
20#
21# Automatic SNAP versioning:
22DATE != date +%Y%m%d
23BASE = 5.0
24BUILDNAME?=${BASE}-${DATE}-SNAP
25#
26#CHROOTDIR=/junk/release
27# If this is a -stable snapshot, then set
28#RELEASETAG=RELENG_4
29#
30# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
31# are building an official release.  Otherwise, we are building for
32# a branch.
33.if defined(RELEASETAG)
34ISRELEASE!=	expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
35.if ${ISRELEASE} != 0
36# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
37AUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
38DOCRELEASETAG?=		${AUXRELEASETAG}
39PORTSRELEASETAG?=	${AUXRELEASETAG}
40.endif
41.endif
42
43KERNCONF=GENERIC
44
45# If you want to pass flags to the world build such as -j X, use
46# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
47# builds via KERNEL_FLAGS.
48#WORLD_FLAGS=-j4
49#KERNEL_FLAGS=-j4
50
51# If you are using a local CVS repository with components stored in
52# non-standard modules, override these on the make commandline or
53# in the environment.
54RELEASESRCMODULE?=	src
55RELEASEDOCMODULE?=	doc
56RELEASEPORTSMODULE?=	ports
57
58# Unless set elsewhere, indicate the object format we'll be using.
59OBJFORMAT?=		elf
60
61# Uncomment this to disable the doc.1 target.  Docs normally require
62# the ports tree, so NOPORTS can be set together with NODOC in order
63# to have neither ports or docs.  If only NOPORTS is set to YES, but
64# docs are still desired, the DOMINIMALDOCPORTS logic below will only
65# install the ports that are minimally required for the docs.  This is
66# intended as a compromise, less disk space is required than for using
67# the entire ports collection (und much less time due to the huge number
68# of directories it would create), but still quite a bit as well as some
69# CPU cycles (some of the programs are C++, and things like ghostscript
70# belong to the required ports nevertheless).
71#
72# Setting this also disables building of release note documentation
73# (RELNOTESng).
74#NODOC=  YES
75#NOPORTS=  YES
76
77# Uncomment and modify this definition if you want the release notes
78# and other release documentation in a language other than English.
79#RELNOTES_LANG=	en_US.ISO8859-1
80
81# As an alternative to installing the entire ports collection (which
82# can take a huge amount of time, in particular on slower disks),
83# setting ${MINIMALDOCPORTS} allows to install and build just those
84# ports that are really required for getting the docs up & running.
85.if defined(NOPORTS) && !defined(NODOC)
86DOMINIMALDOCPORTS=	YES
87.include "Makefile.inc.docports"
88.endif
89
90# Helper variable
91.if defined(NOPORTS)
92.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
93NOPORTSATALL=	YES
94.endif
95.endif
96
97# Set ALLLANG=no if you want the documentation (e.g. Handbook, FAQ) to be
98# in English only.  The language for the release notes is controlled
99# by the RELNOTES_LANG variable above.
100ALLLANG?=	yes
101DOCPORTS=	textproc/docproj
102# Set this to wherever the distfiles required by ${DOCPORTS} live.
103DOCDISTFILES?=	${.CURDIR}/../../ports/distfiles
104# Set this to 1 if you want -P to be used for automatic keyboard detection
105# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
106AUTO_KEYBOARD_DETECT?= 0
107
108.if !defined(NODOC)
109DIST_DOCS_ARCH_INDEP=	readme errata
110DIST_DOCS_ARCH_DEP=	installation relnotes hardware
111.endif
112
113# Things which without too much trouble can be considered variables
114# BIN_DISTS are special in that they get full /etc installation sets.
115#
116.if ${MACHINE_ARCH} == "i386"
117COMPAT_DISTS?=	compat1x compat20 compat21 compat22 compat3x compat4x
118.else
119COMPAT_DISTS?=	compat4x
120.endif
121OTHER_DISTS?=	manpages catpages games proflibs dict info doc
122CRYPTO_DISTS?=	crypto krb4 krb5
123BIN_DISTS?=	bin
124DISTRIBUTIONS?=	${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
125KERNELS?=	GENERIC
126
127BOOT1=	etc/defaults/rc.conf
128
129# mountpoint for filesystems.
130MNT=			/mnt
131
132# Various floppy image parameters.
133#
134
135.if ${MACHINE_ARCH} == "i386"
136.if ${MACHINE} == "pc98"
137SMALLBOOTSIZE=		1200
138BOOTSIZE=		1440
139FIXITSIZE=		1440
140MFSSIZE=		2880
141BOOTINODE=		80000
142FIXITINODE=		4000
143MFSINODE=		8000
144SMALLBOOTLABEL=		fd1200
145BOOTLABEL=		fd1440
146FIXITLABEL=		fd1440
147MFSLABEL=		minimum2
148.else
149BOOTSIZE=		1440
150FIXITSIZE=		1440
151MFSSIZE=		4320
152BIGBOOTSIZE=		2880
153BOOTINODE=		80000
154FIXITINODE=		4000
155MFSINODE=		8000
156BOOTLABEL=		fd1440
157FIXITLABEL=		fd1440
158MFSLABEL=		minimum3
159BIGBOOTLABEL=		minimum2
160.endif
161.elif ${MACHINE_ARCH} == "alpha"
162BOOTSIZE=		1440
163FIXITSIZE=		2880
164MFSSIZE=		2880
165BIGBOOTSIZE=		2880
166BOOTINODE=		80000
167FIXITINODE=		4000
168MFSINODE=		8000
169BOOTLABEL=		fd1440
170FIXITLABEL=		minimum2
171MFSLABEL=		minimum2
172BIGBOOTLABEL=		minimum2
173.endif
174
175ZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
176
177# Things that need to be compiled without crypto support in releases
178.if !defined(FIXCRYPTO)
179FIXCRYPTO=	bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/tcpdump/tcpdump
180.if !defined(NO_SENDMAIL)
181FIXCRYPTO+=	usr.sbin/sendmail
182.endif
183.endif
184
185
186# Things which may get you into trouble if you change them
187MTREEFILES=		${.CURDIR}/../etc/mtree
188_R?=			/R
189RD=			${_R}/stage
190FD=			${_R}/ftp
191CD=			${_R}/cdrom
192CD_DISC1=		${CD}/disc1
193CD_DISC2=		${CD}/disc2
194
195# Where the bootstrap ports (see DOCPORTS) get installed.
196LOCALDIR=		/usr/local/bin
197
198# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
199# environment, rather than the target environment.  This is specifically
200# intended for kernel-dependent utilities that are used during the build.
201#
202# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
203# ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
204BOOTSTRAPDIR=	/bootstrap
205#
206# The mount subsystem has been changed between 2.2 and 3.0 by the
207# Lite2 import.
208BOOTSTRAPUTILS=	/sbin/mount /sbin/umount
209#
210# 3.0 cpio tries to reference lchown(2) which is not available in 2.2
211BOOTSTRAPUTILS+= /usr/bin/cpio
212
213.if !defined(CRUNCH_TARGETS)
214CRUNCH_TARGETS=	boot fixit
215.endif
216
217EXTRAS= cdrom.1 ftp.1
218.if defined(MAKE_ISOS)
219EXTRAS+= iso.1
220.endif
221
222.if !defined(NODOC)
223DOCREL= doc.1 doc.2
224.endif
225
226.if !defined(NOPORTREADMES)
227MAKEREADMES=	make readmes PORTSDIR=${CHROOTDIR}/usr/ports
228.else
229MAKEREADMES=	true
230.endif
231
232rerelease release:
233.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
234	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
235.endif
236.if defined(NOPORTSATALL) && !defined(NODOC)
237	@echo "Ports are required for building the docs.  Either set NODOC or"
238	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
239	@exit 1
240.endif
241.if make(release)
242.if exists(${CHROOTDIR})
243# The first command will fail on a handful of files that have their schg
244# flags set.  But it greatly speeds up the next two commands.
245	-rm -rf ${CHROOTDIR} 2>/dev/null
246	-chflags -R noschg ${CHROOTDIR}/.
247	-rm -rf ${CHROOTDIR}
248.endif
249	mkdir -p ${CHROOTDIR}
250	@echo ">>> make release started on `LC_ALL=C TZ=GMT date`"
251	cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
252	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
253	if [ -f /etc/resolv.conf ]; then \
254		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
255	fi
256	cd ${.CURDIR}/.. && ${MAKE} installworld DESTDIR=${CHROOTDIR} NOMAN=1
257	mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
258	for i in ${BOOTSTRAPUTILS} ; do \
259		cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
260	done
261.if !defined(RELEASETAG)
262	cd ${CHROOTDIR}/usr && rm -rf src && \
263		cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
264.else
265	cd ${CHROOTDIR}/usr && rm -rf src && \
266		cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
267.endif
268.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
269	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
270.endif
271.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
272	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
273.endif
274.if !defined(NOPORTS)
275.if defined(PORTSRELEASETAG)
276	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
277.else
278	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
279.endif
280.elif defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
281.if defined(PORTSRELEASETAG)
282	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
283.else
284	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${MINIMALDOCPORTS}
285.endif
286.endif
287.if !defined(NODOC)
288.if defined(DOCRELEASETAG)
289	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
290.else
291	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
292.endif
293	if [ -d ${DOCDISTFILES}/ ]; then \
294		cp -rp ${DOCDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
295	fi
296.endif
297.endif
298.if make(rerelease)
299.if !defined(RELEASENOUPDATE)
300.if !defined(RELEASETAG)
301	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d
302.else
303	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
304.endif
305.if !defined(NOPORTS)
306	cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
307.endif
308.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
309	for i in ${MINIMALDOCPORTS}; do \
310		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q update -P -d ) ; \
311	done
312.endif
313.if !defined(NODOC)
314	cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
315.endif
316.endif
317.endif
318	# Add version information to those things that need it.
319	( cd ${CHROOTDIR}/usr/src/sys/conf && \
320	  mv newvers.sh foo && \
321	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
322	echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
323	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
324	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
325	echo "set -ex"				>> ${CHROOTDIR}/mk
326	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${CHROOTDIR}/mk
327	echo "export CFLAGS='-O -pipe'"	>> ${CHROOTDIR}/mk
328	echo "export WITHOUT_X11=YES"		>> ${CHROOTDIR}/mk
329	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
330	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
331	echo "export OBJFORMAT=${OBJFORMAT}"	>> ${CHROOTDIR}/mk
332.if defined(RELEASETAG)
333	echo "export RELEASETAG=\"${RELEASETAG}\""	>> ${CHROOTDIR}/mk
334.endif
335.if defined(NOPORTS)
336	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
337.endif
338.if defined(MAKE_ISOS)
339	echo "export MAKE_ISOS=${MAKE_ISOS}"	>> ${CHROOTDIR}/mk
340.endif
341.if defined(DOMINIMALDOCPORTS)
342	echo "export DOMINIMALDOCPORTS=${DOMINIMALDOCPORTS}" >> ${CHROOTDIR}/mk
343.endif
344.if defined(NODOC)
345	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
346.endif
347.if defined(ALLLANG) && ${ALLLANG} != "NO" && ${ALLLANG} != "no"
348	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
349.else
350	echo "export DOC_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
351.endif
352.if defined(NOSRC)
353	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
354.endif
355.if defined(RELNOTES_LANG)
356	echo "export RELNOTES_LANG=${RELNOTES_LANG}"	>> ${CHROOTDIR}/mk
357.else
358	echo "export RELNOTES_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
359.endif
360.if defined(NOSHARED)
361	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
362.endif
363.if defined(BOOT_CONFIG)
364	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
365.endif
366.if defined(KERNEL_FLAGS)
367	echo "export KERNEL_FLAGS=\"${KERNEL_FLAGS}\"" >> ${CHROOTDIR}/mk
368.endif
369	# Don't remove this, or the build will fall over!
370	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
371	echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
372	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
373	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
374.if make(release)
375	echo "	(cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
376	echo "	make ${WORLD_FLAGS} world && \\"	>> ${CHROOTDIR}/mk
377.endif
378.if make(rerelease)
379	echo "	make ${WORLD_FLAGS} all install && \\" >> ${CHROOTDIR}/mk
380.endif
381	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
382	echo "fi"				>> ${CHROOTDIR}/mk
383	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
384	echo "make obj"				>> ${CHROOTDIR}/mk
385	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
386	echo "echo \">>> make ${.TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
387	chmod 755 ${CHROOTDIR}/mk
388	chroot ${CHROOTDIR} /mk
389
390clean:
391	rm -rf boot_crunch release.[0-9]
392
393# Clean out ${_R} and make the directory structure.
394release.1:
395	mkdir -p ${_R}
396	-rm -rf ${_R}/* 2> /dev/null
397	-chflags -R noschg ${_R}/.
398	rm -rf ${_R}/*
399	mkdir ${RD}
400	mkdir ${RD}/floppies
401	mkdir ${RD}/trees
402	mkdir ${RD}/dists
403	mkdir ${RD}/kernels
404	for i in ${DISTRIBUTIONS} ; do \
405		mkdir ${RD}/trees/$$i && \
406		mkdir ${RD}/dists/$$i && \
407		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
408		    -p ${RD}/trees/$$i > /dev/null && \
409		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
410		    -p ${RD}/trees/$$i/usr > /dev/null && \
411		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
412		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
413		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
414		    -p ${RD}/trees/$$i/var > /dev/null ; \
415	done
416	touch release.1
417
418# Install the system into the various distributions.
419release.2:
420	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
421	cd ${.CURDIR}/.. && make distribworld DISTDIR=${RD}/trees
422.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
423	cd ${.CURDIR}/../kerberosIV && ( \
424		make bootstrap &&\
425		make obj all help-distribute DISTDIR=${RD}/trees &&\
426		make kprog \
427	)
428.endif
429.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
430	cd ${.CURDIR}/../kerberos5 && ( \
431		make bootstrap &&\
432		make obj all help-distribute DISTDIR=${RD}/trees &&\
433		make kprog \
434	)
435.endif
436	-chflags -R noschg ${RD}/trees
437	touch release.2
438
439# Make and install the generic kernel(s).
440release.3:
441.for kernel in ${KERNELS}
442	-chflags -R noschg ${RD}/kernels/${kernel}
443	rm -rf ${RD}/kernels/${kernel}
444	rm -rf ${.CURDIR}/../sys/${MACHINE}/compile/${kernel}
445	cd ${.CURDIR} && ${MAKE} doSTDKERNEL KERNEL=${kernel} KODIR=/${kernel}
446	rm -rf ${.CURDIR}/../sys/${MACHINE}/compile/${kernel}
447	-mkdir ${RD}/trees/bin/boot/${kernel}
448	cp -p ${RD}/kernels/${kernel}/kernel ${RD}/trees/bin/boot/${kernel}
449.endfor
450	# Install a standard boot kernel+modules
451	mkdir -p ${RD}/trees/bin/boot/kernel
452	cp -Rp ${RD}/kernels/GENERIC/* ${RD}/trees/bin/boot/kernel
453	touch release.3
454
455# Make and install the three crunched binaries which live on the floppies.
456# You are not supposed to like this :-)
457release.4:
458	@mkdir -p /stand
459	rm -rf ${RD}/crunch
460	mkdir -p ${RD}/crunch
461	for j in ${CRUNCH_TARGETS} ; do \
462		rm -rf $${j}_crunch && \
463		mkdir $${j}_crunch && \
464		( cd $${j}_crunch && \
465		  ( ( [ -f ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ] && \
466		    crunchgen ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ) || \
467		    ( crunchgen ${.CURDIR}/$${j}_crunch.conf ) ) && \
468		  ${MAKE} -f $${j}_crunch.mk subclean all ) && \
469		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
470		true || { rm -rf $${j}_crunch ; false ; } ; \
471	done
472	touch release.4
473
474#
475# --==## Fix up the distributions. ##==--
476#
477release.5:
478	# Handle some grief caused by the munition braindeadness.
479	for i in ${FIXCRYPTO}; do \
480		( cd ${.CURDIR}/../$$i; \
481		  make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
482	done
483
484	# Create any "synthetic dists" now.
485	@for i in ${DISTRIBUTIONS}; do \
486		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
487			echo -n "Running $$i dist creation script... "; \
488			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
489			echo "Done."; \
490		fi \
491	done \
492
493	# Remove all the directories we don't need.
494	-cd ${RD}/trees && \
495		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
496	touch release.5
497
498#
499# --==## Package up the tarballs from assembled trees ##==--
500#
501release.6:
502	rm -rf ${RD}/dists
503	mkdir -p ${RD}/dists
504	@for i in ${DISTRIBUTIONS} ; \
505	do \
506		if [ -d ${RD}/trees/$${i} ] ; then \
507			cd ${.CURDIR} && $(MAKE) doTARBALL \
508				SD=${RD}/trees/$${i} \
509				TN=$$i TD=$$i ARG="." && \
510			echo "$${i} distribution is finished."; \
511		fi ; \
512	done
513	# More munition braindeadness.
514	( cd ${RD}/dists && \
515		if [ -f krb4/krb4.aa ] ; then \
516			mv krb4/krb4.* crypto && \
517			cat krb4/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
518			rm -r krb4; \
519		fi )
520	( cd ${RD}/dists && \
521		if [ -f krb5/krb5.aa ] ; then \
522			mv krb5/krb5.* crypto && \
523			cat krb5/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
524			rm -r krb5; \
525		fi )
526	touch release.6
527
528
529#
530# --==## Make source dists ##==--
531#
532release.7:
533.if !defined(NOSRC)
534	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
535		TD=src TN=sbase ARG="[A-Z]*"
536	@for i in `cd /usr/src && echo [a-z]*` ; do \
537		if [ -d /usr/src/$$i ] ; then \
538			cd ${.CURDIR} && $(MAKE) doTARBALL \
539				TN=`echo s$$i | tr -d '.' | \
540				    sed -e 's/usr/u/' \
541					-e 's/kerberosIV/krb4/' \
542					-e 's/kerberos5/krb5/'` \
543				SD=/usr/src TD=src ARG="$$i" ; \
544		fi ; \
545	done
546.if defined(EXTRA_SRC)
547	@set ${EXTRA_SRC} && \
548	while [ $$# -ge 2 ] ; do \
549		if [ -d /usr/src/$$1 ] ; then \
550			cd ${.CURDIR} && $(MAKE) doTARBALL \
551				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
552		fi && shift && shift ; \
553	done
554.endif
555	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
556		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
557		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
558		if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
559		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
560		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
561		md5 * > CHECKSUM.MD5 ) ; fi
562	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
563	@echo "src distribution is finished."
564.endif
565	touch release.7
566
567# Complete the bootfd
568#
569# Now, just to get this picture down once and for all:
570#
571# +------------------------------------------------------------------------+
572# |boot.flp                                                                |
573# +-----+-----+------------------------------------------------------------+
574# |boot1|boot2|floppy filesystem "bootfd"                                  |
575# +-----+-----+-+--------------------------------------------------------+-+
576#               |kernel                                                  |
577#               +------------+-----------------------------------------+-+
578#                            |mfs filesystem "mfsfd"                   |
579#                            +-----------------------------------------+
580#
581
582release.8: write_mfs_in_kernel
583	rm -rf ${RD}/mfsfd
584	mkdir ${RD}/mfsfd
585	cd ${RD}/mfsfd && \
586		mkdir -p etc/defaults dev mnt stand/help
587	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
588		DIR=${RD}/mfsfd/stand ZIP=false
589	( cd ${RD}/trees/bin/dev && \
590		ls console tty bpf0 ttyd0 ttyv0 ttyv1 ttyv2 ttyv3 null zero card0 card1 card2 card3 usb usb0 uhid0 ums0 ulpt0 ugen0 kbd0 kmem mem | \
591	cpio -dump ${RD}/mfsfd/dev )
592	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
593	( cd ${RD}/mfsfd && \
594	  for dir in bin sbin ; do \
595		ln -sf /stand $$dir; \
596	  done )
597	cp /sbin/dhclient-script ${RD}/mfsfd/stand
598	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
599	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
600	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
601	( for F in netconfig protocols ; do \
602		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
603		${RD}/trees/bin/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
604	  done )
605	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
606	    ${.CURDIR}/../etc/services | \
607	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
608	    > ${RD}/mfsfd/stand/etc/services
609	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
610	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
611	gzip -9c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
612.if !defined(NODOC)
613	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
614	  gzip -9c ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
615	done
616	@for i in ${DIST_DOCS_ARCH_DEP}; do \
617	  gzip -9c ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
618	done
619	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT.gz ${RD}/mfsfd/stand/help/INSTALL.TXT.gz
620.endif
621	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
622	@mkdir -p ${RD}/mfsfd/boot
623	@cp /boot/boot* ${RD}/mfsfd/boot
624	@cp /boot/loader.help ${RD}/mfsfd/boot
625	@cd ${.CURDIR} && ${MAKE} createBOOTMFS
626.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
627	@cd ${.CURDIR} && ${MAKE} doMODULES KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
628.endif
629	@echo "Making the regular boot floppy."
630	@tar --exclude CVS -cf - -C /usr/src/usr.sbin/sysinstall help | \
631		tar xf - -C ${RD}/mfsfd/stand
632	@echo "Compressing doc files..."
633	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
634.if ${MACHINE_ARCH} == "alpha"
635	rm -rf ${RD}/mfsfd/stand/help/*
636.endif
637.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
638	@mkdir -p ${RD}/mfsfd/stand/modules
639	@perl ${.CURDIR}/scripts/driver-copy2.pl \
640		${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
641		${RD}/kernels ${RD}/mfsfd/stand/modules
642.endif
643	sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
644		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
645	@gzip -9vc mfsroot > mfsroot.gz
646.if ${MACHINE} == "pc98"
647	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
648		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
649		${BOOTINODE} ${SMALLBOOTLABEL}
650	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
651	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
652.else
653	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
654		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
655	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
656	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
657.endif
658	@rm mfsroot mfsroot.gz mfsroot.size
659	@echo "Regular and MFS boot floppies made."
660	touch release.8
661
662#
663# --==## Create a fixit floppy ##==--
664#
665release.9:
666	@echo "Making fixit floppy."
667	@rm -rf ${RD}/fixitfd
668	@mkdir ${RD}/fixitfd
669	@cd ${RD}/fixitfd && \
670		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
671		usr/share/misc
672	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
673		DIR=${RD}/fixitfd/stand ZIP=false
674	@( cd ${RD}/fixitfd/dev && \
675		cp ${RD}/trees/bin/dev/MAKEDEV MAKEDEV && \
676		chmod 755 MAKEDEV && \
677		sh MAKEDEV fixit )
678	@cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
679		${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
680	@cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
681		${RD}/fixitfd/usr/share/misc
682	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
683	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
684	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
685	@chmod 555 ${RD}/fixitfd/stand/tar
686	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
687		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
688# Do our last minute floppies directory setup in a convenient place.
689.if !defined(NODOC)
690	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/installation/${MACHINE_ARCH}/article.txt \
691		${RD}/floppies/README.TXT
692	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
693.else
694	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
695.endif
696	touch release.9
697
698#
699# --==## Setup a suitable ftp-area ##==--
700#
701ftp.1:
702	@echo "Setting up FTP distribution area"
703	@mkdir -p ${FD}
704	-@ln -s . ${FD}/${BUILDNAME}
705	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
706	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
707.if !defined(NODOC)
708	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
709	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
710	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
711	done
712	@for i in ${DIST_DOCS_ARCH_DEP}; do \
713	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
714	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
715	done
716	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/readme/docbook.css ${FD}
717	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
718	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
719.endif
720	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
721.if !defined(NOPORTS)
722	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
723.endif
724	touch ftp.1
725
726#
727# --==## Setup a suitable cdrom-area ##==--
728#
729cdrom.1:
730	@echo "Setting up CDROM distribution area"
731	@mkdir -p ${CD_DISC1} ${CD_DISC2}
732	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
733	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
734.if ${MACHINE} != "pc98"
735	@ln -f ${RD}/kernels/MFSKERNEL.boot ${CD_DISC1}/kernel
736.endif
737	@for i in ${DISTRIBUTIONS} ; \
738	do \
739		if [ -d ${RD}/trees/$${i} ] ; then \
740			chflags -R noschg ${RD}/trees/$${i} || true ; \
741			( cd ${RD}/trees/$${i} && \
742			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
743		fi \
744	done
745	@rm -f ${CD_DISC2}/.profile
746	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
747	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
748	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
749.if !defined(NODOC)
750	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
751	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
752	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
753	done
754	@for i in ${DIST_DOCS_ARCH_DEP}; do \
755	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
756	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
757	done
758	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
759	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
760	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
761.endif
762.if ${MACHINE_ARCH} == "alpha"
763	@echo "Setting up Alpha CD disc1 for booting"
764	@cp -Rp ${RD}/image.boot/boot ${CD_DISC1}
765	@ln -f ${CD_DISC2}/boot/cdboot ${CD_DISC1}/boot
766	@ln -f ${CD_DISC1}/boot/loader.rc ${CD_DISC2}/boot
767	@ln -f ${CD_DISC1}/kernel ${CD_DISC2}/kernel
768.elif ${MACHINE} == "i386"
769	@mkdir -p ${CD_DISC2}/floppies
770	@cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
771.endif
772.if !defined(NOPORTS)
773	@-rm -rf /usr/ports/distfiles/*
774	@mkdir -p ${CD_DISC1}/ports && \
775	  tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
776	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
777	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
778.endif
779	touch cdrom.1
780
781iso.1:
782	@if [ -r ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ]; then \
783		echo "Creating ISO images..."; \
784		sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh -b fbsd_miniinst \
785		  ${CD}/miniinst.iso ${CD_DISC1}; \
786		sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh -b fbsd_livefs \
787		  ${CD}/disc2.iso ${CD_DISC2}; \
788		if [ "x${CD_EXTRA_BITS}" != "x" ]; then \
789			sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh -b fbsd_boot \
790			  ${CD}/disc1.iso ${CD_DISC1} ${CD_EXTRA_BITS}; \
791			    && false; \
792		fi \
793	else \
794		echo "Do not know how to create an ISO for ${MACHINE_ARCH}."; \
795	fi
796	touch iso.1
797
798#
799# --==## Documentation Project files such as the Handbook and FAQ ##==--
800#
801doc.1:
802	@echo "Making docs..."
803	@for i in ${DOCPORTS}; do \
804	  cd /usr/ports/$$i && make all install clean BATCH=yes JADETEX=no FORCE_PKG_REGISTER=yes; \
805	done
806	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc
807	touch doc.1
808
809#
810# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
811#
812doc.2:
813	@echo "Making release documentation..."
814	@cd ${.CURDIR}/doc && make all 'FORMATS=html txt'
815	touch doc.2
816
817# Various "subroutine" and other supporting targets.
818
819# RD=
820# SD=
821# TD=
822# ARG=
823doTARBALL:
824.if !defined(SD)
825	@echo "SD undefined in doTARBALL" && exit 1
826.endif
827.if !defined(TD)
828	@echo "TD undefined in doTARBALL" && exit 1
829.endif
830.if !defined(ARG)
831	@echo "ARG undefined in doTARBALL" && exit 1
832.endif
833	@rm -rf ${RD}/dists/${TD}/${TN}*
834	@mkdir -p ${RD}/dists/${TD}
835	@( cd ${SD} && \
836		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
837		echo rolling ${TD}/$$tn tarball &&\
838		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
839		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
840		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
841		   ${RD}/dists/${TD}/$$tn.inf && \
842		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
843		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
844		fi && \
845		if [ "${SD}" != "/usr/src" ]; then \
846			mtree -c -i -p ${SD}/${ARG} \
847			  -k gname,md5digest,mode,nlink,uname,size,link,type \
848			  > ${RD}/dists/${TD}/$$tn.mtree ; \
849		else \
850			true; \
851		fi; \
852		(cd ${RD}/dists/${TD}; \
853		   rm -f CHECKSUM.MD5; \
854		   md5 * > CHECKSUM.MD5) \
855	)
856
857doRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
858		release.6 release.7 release.8 release.9
859	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
860	@echo "Release done"
861
862floppies:
863	@cd ${.CURDIR} && ${MAKE} boot.flp
864	@cd ${.CURDIR} && ${MAKE} fixit.flp
865	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
866
867boot.flp:
868	@rm -f release.4 release.8
869	@cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
870
871fixit.flp:
872	@rm -f release.4 release.9
873	@cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
874
875write_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
876	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
877
878installCRUNCH:
879.if !defined(CRUNCH)
880	@echo "CRUNCH undefined in installCRUNCH" && exit 1
881.endif
882.if !defined(DIR)
883	@echo "DIR undefined in installCRUNCH" && exit 1
884.endif
885.if !defined(ZIP)
886	@echo "ZIP undefined in installCRUNCH" && exit 1
887.endif
888	@if ${ZIP} ; then \
889		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
890	else \
891		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
892	fi
893	@chmod 555 ${DIR}/${CRUNCH}_crunch
894	@if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \
895		for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \
896			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
897		done \
898	else \
899		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
900			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
901		done \
902	fi
903
904#
905# --==## BOOTMFS config file ##==--
906#
907
908createBOOTMFS:
909	@cd ${.CURDIR}/../sys/${MACHINE}/conf && \
910	  sh ${.CURDIR}/${MACHINE_ARCH}/dokern.sh ${FDSIZE} < ${KERNCONF} > BOOTMFS && \
911	  [ -r ${KERNCONF}.hints ] && cp ${KERNCONF}.hints BOOTMFS.hints
912.if 0 && ${MACHINE_ARCH} == "i386"
913	@echo "options  INTRO_USERCONFIG" >> \
914	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
915.endif
916.if defined(FDSIZE) && ${FDSIZE} == "BIG"
917	@echo "options MD_ROOT_SIZE=`cat mfsroot.size`" >> \
918	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
919.endif
920.if exists(${.CURDIR}/${MACHINE_ARCH}/drivers.conf)
921	@perl ${.CURDIR}/scripts/driver-remove.pl \
922		${.CURDIR}/${MACHINE_ARCH}/drivers.conf \
923		${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
924.endif
925
926#
927# --==## Compile a kernel by name ${KERNEL} ##==--
928#
929# We don't erase the sys/${MACHINE}/compile/${KERNEL} directory, since somebody
930# may want to reuse it (release.8 presently)
931#
932doKERNEL:
933	@rm -f ${RD}/kernels/${KERNEL}
934	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
935	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
936			make kernel-depend && \
937			make ${KERNEL_FLAGS} ${KERNEL_KO} && \
938			make kernel-reinstall DESTDIR=${RD}/kernels && \
939			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
940			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
941
942doMODULES:
943	@rm -f ${RD}/kernels/*.ko
944	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
945	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
946			make kernel-depend && \
947			make ${KERNEL_FLAGS} modules && \
948			make modules-reinstall DESTDIR=${RD}/kernels && \
949
950doSTDKERNEL:
951	@rm -f ${RD}/kernels/${KERNEL}
952	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
953	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
954			make depend && \
955			make ${KERNEL_FLAGS} KERNEL=${KERNEL} && \
956			make KERNEL=${KERNEL} DESTDIR=${RD}/kernels install && \
957			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
958			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
959	@-cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
960			make KERNEL=${KERNEL} DESTDIR=${RD}/kernels \
961				kernel-reinstall.debug
962
963#
964# --==## Put a filesystem into a BOOTMFS kernel ##==--
965#
966doMFSKERN:
967	@echo "Running doMFSKERN for ${FSIMAGE}"
968	@rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
969	@cd ${.CURDIR} && ${MAKE} createBOOTMFS
970	@cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
971	@rm -rf ${RD}/image.${FSIMAGE}
972	@mkdir  ${RD}/image.${FSIMAGE}
973	@cd ${RD}/kernels && \
974	  (chflags noschg BOOTMFS || true) && \
975	  strip BOOTMFS && \
976	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
977	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
978	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
979	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
980	@mkdir -p ${RD}/image.${FSIMAGE}/boot
981	@cp /boot/loader ${RD}/image.${FSIMAGE}/boot
982	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
983	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
984	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
985	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
986	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
987	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
988.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
989	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
990	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
991	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
992	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
993.endif
994	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
995	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
996.if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
997	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
998.endif
999.if defined(FDSIZE) && ${FDSIZE} == "BIG"
1000	@echo "Writing MFS image into kernel for ${FSIMAGE} floppy"
1001	@./write_mfs_in_kernel ${RD}/image.${FSIMAGE}/kernel mfsroot
1002	@cp ${RD}/image.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
1003.endif
1004	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
1005	@rm -f ${RD}/floppies/${FSIMAGE}.flp
1006.if defined(FDSIZE) && ${FDSIZE} == "BIG"
1007	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1008		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
1009		${BOOTINODE} ${BIGBOOTLABEL}
1010.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
1011	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1012		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
1013		${BOOTINODE} ${SMALLBOOTLABEL}
1014.else
1015	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1016		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
1017		${BOOTINODE} ${BOOTLABEL}
1018.endif
1019	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1020
1021.include <bsd.prog.mk>
1022