Makefile revision 86846
1141240Snjl# $FreeBSD: head/release/Makefile 86846 2001-11-24 05:21:53Z nyan $
2167905Snjl#
3141240Snjl# make release CHROOTDIR=/some/dir BUILDNAME=somename CVSROOT=/cvs/dir \
4141240Snjl#	[ RELEASETAG=tag ]
5141240Snjl#
6141240Snjl# Where "/some/dir" is the pathname of a directory on a some filesystem with
7141240Snjl# at least 1000MB of free space, "somename" is what you want the release to
8141240Snjl# call itself, "/cvs/dir" is where our source repo resides and, optionally,
9141240Snjl# which CVS "tag" name should be used when checking out the sources to build
10141240Snjl# the release (default is HEAD).
11141240Snjl#
12141240Snjl# Please note: the md(4) driver must be compiled into your kernel
13141240Snjl# or available as a kld(4)-style kernel module,
14141240Snjl# otherwise the target 'release.8' and possibly others will fail.
15141240Snjl#
16141240Snjl# Note:  "/some/dir" cannot reside on a filesystem mounted with
17141240Snjl# the "nodev" option, otherwise the chrooted "buildworld" will likely
18141240Snjl# fail.
19141240Snjl#
20141240Snjl# Set these, release builder!
21141240Snjl#
22141240Snjl# Fixed version:
23141240Snjl#BUILDNAME=5.0-RELEASE
24141240Snjl#
25141240Snjl# Automatic SNAP versioning:
26141240SnjlDATE != date +%Y%m%d
27141240SnjlBASE = 5.0
28141240SnjlBUILDNAME?=${BASE}-${DATE}-SNAP
29141240Snjl#
30141240Snjl#CHROOTDIR=/junk/release
31141240Snjl# If this is a -stable snapshot, then set
32141240Snjl#RELEASETAG=RELENG_4
33141240Snjl#
34141240Snjl# Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
35142603Snjl# are building an official release.  Otherwise, we are building for
36141240Snjl# a branch.
37141240Snjl.if defined(RELEASETAG)
38141240SnjlISRELEASE!=	expr "${RELEASETAG}" : '^RELENG_.*_RELEASE$$' || true
39141240Snjl.if ${ISRELEASE} != 0
40173204Snjl# Convert "RELENG_ver_RELEASE" to "RELEASE_ver" for ports and doc trees.
41141240SnjlAUXRELEASETAG!=	echo ${RELEASETAG} | sed -e 's/^RELENG_/RELEASE_/' -e 's/_RELEASE$$//'
42173204SnjlDOCRELEASETAG?=		${AUXRELEASETAG}
43141240SnjlPORTSRELEASETAG?=	${AUXRELEASETAG}
44141240Snjl.endif
45142603Snjl.endif
46141814Snjl
47167905SnjlKERNCONF=GENERIC
48141240Snjl
49141240Snjl# If you want to pass flags to the world build such as -j X, use
50141240Snjl# WORLD_FLAGS.  Similarly, you can specify make flags for kernel
51141240Snjl# builds via KERNEL_FLAGS.
52141240Snjl#WORLD_FLAGS=-j4
53141240Snjl#KERNEL_FLAGS=-j4
54141240Snjl
55141240Snjl# If you are using a local CVS repository with components stored in 
56141240Snjl# non-standard modules, override these on the make commandline or
57141240Snjl# in the environment.
58142395SnjlRELEASESRCMODULE?=	src
59141240SnjlRELEASEDOCMODULE?=	doc
60142395SnjlRELEASEPORTSMODULE?=	ports
61141240Snjl
62150847Sume# Unless set elsewhere, indicate the object format we'll be using.
63150847SumeOBJFORMAT?=		elf
64150847Sume
65150847Sume# Uncomment this to disable the doc.1 target.  Docs normally require
66150847Sume# the ports tree, so NOPORTS can be set together with NODOC in order
67150847Sume# to have neither ports or docs.  If only NOPORTS is set to YES, but
68141240Snjl# docs are still desired, the DOMINIMALDOCPORTS logic below will only
69142603Snjl# install the ports that are minimally required for the docs.  This is
70141240Snjl# intended as a compromise, less disk space is required than for using
71141923Snjl# the entire ports collection (und much less time due to the huge number
72150847Sume# of directories it would create), but still quite a bit as well as some
73141923Snjl# CPU cycles (some of the programs are C++, and things like ghostscript
74141413Snjl# belong to the required ports nevertheless).
75141945Snjl#
76141240Snjl# Setting this also disables building of release note documentation
77141240Snjl# (RELNOTESng).
78167905Snjl#NODOC=  YES
79210422Savg#NOPORTS=  YES
80141240Snjl
81141240Snjl# Uncomment and modify this definition if you want the release notes 
82141240Snjl# and other release documentation in a language other than English.
83141240Snjl#RELNOTES_LANG=	en_US.ISO8859-1
84141240Snjl
85141240Snjl# As an alternative to installing the entire ports collection (which
86141240Snjl# can take a huge amount of time, in particular on slower disks),
87141240Snjl# setting ${MINIMALDOCPORTS} allows to install and build just those
88141240Snjl# ports that are really required for getting the docs up & running.
89141240Snjl.if defined(NOPORTS) && !defined(NODOC)
90142603SnjlDOMINIMALDOCPORTS=	YES
91142603Snjl.include "Makefile.inc.docports"
92142603Snjl.endif
93142603Snjl
94142603Snjl# Helper variable
95144876Snjl.if defined(NOPORTS)
96144876Snjl.if !defined(DOMINIMALDOCPORTS) || ${DOMINIMALDOCPORTS} != "YES"
97144876SnjlNOPORTSATALL=	YES
98144876Snjl.endif
99144876Snjl.endif
100141240Snjl
101167905Snjl# Set ALLLANG=no if you want the documentation (e.g. Handbook, FAQ) to be
102141240Snjl# in English only.  The language for the release notes is controlled
103141240Snjl# by the RELNOTES_LANG variable above.
104141240SnjlALLLANG?=	yes
105141240SnjlDOCPORTS=	textproc/docproj
106141240Snjl# Set this to wherever the distfiles required by ${DOCPORTS} live.
107141240SnjlDOCDISTFILES?=	${.CURDIR}/../../ports/distfiles
108141413Snjl# Set this to 1 if you want -P to be used for automatic keyboard detection
109141240Snjl# on the boot floppy.  WARNING: Breaks on some Athlon (K7) motherboards.
110141413SnjlAUTO_KEYBOARD_DETECT?= 0
111141413Snjl
112141413Snjl.if !defined(NODOC)
113141413SnjlDIST_DOCS_ARCH_INDEP=	readme errata
114141240SnjlDIST_DOCS_ARCH_DEP=	installation relnotes hardware
115141240Snjl.endif
116142114Snjl
117141240Snjl# Things which without too much trouble can be considered variables
118141240Snjl# BIN_DISTS are special in that they get full /etc installation sets.
119141240Snjl#
120141240Snjl.if ${MACHINE_ARCH} == "i386"
121141240SnjlCOMPAT_DISTS?=	compat1x compat20 compat21 compat22 compat3x compat4x
122141240Snjl.else
123141240SnjlCOMPAT_DISTS?=	compat4x
124141240Snjl.endif
125141240SnjlOTHER_DISTS?=	manpages catpages games proflibs dict info doc
126141240SnjlCRYPTO_DISTS?=	crypto krb4 krb5
127141240SnjlBIN_DISTS?=	bin
128141240SnjlDISTRIBUTIONS?=	${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
129141240SnjlKERNELS?=	GENERIC
130141240Snjl
131141240SnjlBOOT1=	etc/defaults/rc.conf
132141240Snjl
133141240Snjl# mountpoint for filesystems.
134142590SnjlMNT=			/mnt
135144876Snjl
136142590Snjl# Various floppy image parameters.
137144876Snjl#
138227309Sed
139227309Sed.if ${MACHINE_ARCH} == "i386"
140142590Snjl.if ${MACHINE} == "pc98"
141142590SnjlSMALLBOOTSIZE=		1200
142144876SnjlBOOTSIZE=		1440
143144876SnjlFIXITSIZE=		1440
144142590SnjlMFSSIZE=		4320
145141240SnjlBOOTINODE=		80000
146141240SnjlFIXITINODE=		4000
147141240SnjlMFSINODE=		8000
148141240SnjlSMALLBOOTLABEL=		fd1200
149186154SmavBOOTLABEL=		fd1440
150141240SnjlFIXITLABEL=		fd1440
151186154SmavMFSLABEL=		minimum3
152141240Snjl.else
153141240SnjlBOOTSIZE=		1440
154144876SnjlFIXITSIZE=		1440
155141240SnjlMFSSIZE=		4320
156141240SnjlBIGBOOTSIZE=		2880
157141240SnjlBOOTINODE=		80000
158141240SnjlFIXITINODE=		4000
159141240SnjlMFSINODE=		8000
160142603SnjlBOOTLABEL=		fd1440
161141240SnjlFIXITLABEL=		fd1440
162150847SumeMFSLABEL=		minimum3
163193155SnwhitehornBIGBOOTLABEL=		minimum2
164193155Snwhitehorn.endif
165193155Snwhitehorn.elif ${MACHINE_ARCH} == "alpha"
166193155SnwhitehornBOOTSIZE=		1440
167193155SnwhitehornFIXITSIZE=		2880
168193155SnwhitehornMFSSIZE=		3200
169193155SnwhitehornBIGBOOTSIZE=		2880
170193155SnwhitehornBOOTINODE=		80000
171193155SnwhitehornFIXITINODE=		4000
172193155SnwhitehornMFSINODE=		8000
173141240SnjlBOOTLABEL=		fd1440
174141240SnjlFIXITLABEL=		minimum2
175141240SnjlMFSLABEL=		auto
176141240SnjlBIGBOOTLABEL=		minimum2
177141240Snjl.endif
178141240Snjl
179141240SnjlZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
180141240Snjl
181141240Snjl# Things that need to be compiled without crypto support in releases
182141240Snjl.if !defined(FIXCRYPTO)
183144876SnjlFIXCRYPTO=	bin/ed usr.sbin/ppp usr.sbin/pppd usr.sbin/tcpdump/tcpdump 
184144876Snjl.if !defined(NO_SENDMAIL)
185210422SavgFIXCRYPTO+=	usr.sbin/sendmail
186210422Savg.endif
187141240Snjl.endif
188141240Snjl
189141240Snjl
190141240Snjl# Things which may get you into trouble if you change them
191141240SnjlMTREEFILES=		${.CURDIR}/../etc/mtree
192141240Snjl_R?=			/R
193141240SnjlRD=			${_R}/stage
194141240SnjlFD=			${_R}/ftp
195141240SnjlCD=			${_R}/cdrom
196167905SnjlCD_DISC1=		${CD}/disc1
197167905SnjlCD_DISC2=		${CD}/disc2
198167905Snjl
199167905Snjl# Where the bootstrap ports (see DOCPORTS) get installed.
200167905SnjlLOCALDIR=		/usr/local/bin
201167905Snjl
202167905Snjl# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
203141240Snjl# environment, rather than the target environment.  This is specifically
204141240Snjl# intended for kernel-dependent utilities that are used during the build.
205141240Snjl#
206167905Snjl# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
207167905Snjl# ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
208167905SnjlBOOTSTRAPDIR=	/bootstrap
209167905Snjl#
210167905Snjl# The mount subsystem has been changed between 2.2 and 3.0 by the
211167905Snjl# Lite2 import.
212167905SnjlBOOTSTRAPUTILS=	/sbin/mount /sbin/umount
213167905Snjl#
214141240Snjl# 3.0 cpio tries to reference lchown(2) which is not available in 2.2
215141240SnjlBOOTSTRAPUTILS+= /usr/bin/cpio
216141240Snjl
217141240Snjl.if !defined(CRUNCH_TARGETS)
218150847SumeCRUNCH_TARGETS=	boot fixit
219141240Snjl.endif
220141240Snjl
221144876SnjlEXTRAS= cdrom.1 ftp.1
222141240Snjl.if defined(MAKE_ISOS)
223141240SnjlEXTRAS+= iso.1
224141240Snjl.endif
225150847Sume
226150847Sume.if !defined(NODOC)
227150847SumeDOCREL= doc.1 doc.2
228150847Sume.endif
229150847Sume
230141240Snjl.if !defined(NOPORTREADMES)
231141240SnjlMAKEREADMES=	make readmes PORTSDIR=${CHROOTDIR}/usr/ports
232144876Snjl.else
233144876SnjlMAKEREADMES=	true
234210422Savg.endif
235144876Snjl
236141240Snjlrerelease release:
237141240Snjl.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
238141240Snjl	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
239141240Snjl.endif
240141240Snjl.if defined(NOPORTSATALL) && !defined(NODOC)
241141240Snjl	@echo "Ports are required for building the docs.  Either set NODOC or"
242141240Snjl	@echo "unset NOPORTS, or set at least DOMINIMALDOCPORTS to YES!"
243141240Snjl	@exit 1
244141240Snjl.endif
245150847Sume.if make(release)
246141814Snjl.if exists(${CHROOTDIR})
247171898Snjl# The first command will fail on a handful of files that have their schg
248141240Snjl# flags set.  But it greatly speeds up the next two commands.
249141240Snjl	-rm -rf ${CHROOTDIR} 2>/dev/null
250142603Snjl	-chflags -R noschg ${CHROOTDIR}/.
251142603Snjl	-rm -rf ${CHROOTDIR}
252150847Sume.endif
253141240Snjl	mkdir -p ${CHROOTDIR}
254167905Snjl	@echo ">>> make release started on `LC_ALL=C TZ=GMT date`"
255167905Snjl	cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
256167905Snjl	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
257167905Snjl	if [ -f /etc/resolv.conf ]; then \
258167905Snjl		cp -p /etc/resolv.conf ${CHROOTDIR}/etc; \
259156228Smnag	fi
260141814Snjl	cd ${.CURDIR}/.. && ${MAKE} installworld DESTDIR=${CHROOTDIR} NOMAN=1
261150847Sume	mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
262150847Sume	for i in ${BOOTSTRAPUTILS} ; do \
263173204Snjl		cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
264141923Snjl	done
265173204Snjl.if !defined(RELEASETAG)
266173204Snjl	cd ${CHROOTDIR}/usr && rm -rf src && \
267173204Snjl		cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
268173204Snjl.else
269173204Snjl	cd ${CHROOTDIR}/usr && rm -rf src && \
270173204Snjl		cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
271173204Snjl.endif
272173204Snjl.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
273173204Snjl	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
274173204Snjl.endif
275173204Snjl.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
276173204Snjl	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
277173204Snjl.endif
278173204Snjl.if !defined(NOPORTS)
279150847Sume.if defined(PORTSRELEASETAG)
280150847Sume	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
281150847Sume.else
282150847Sume	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
283150847Sume.endif
284150847Sume.elif defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
285150847Sume.if defined(PORTSRELEASETAG)
286150847Sume	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
287150847Sume.else
288150847Sume	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${MINIMALDOCPORTS}
289150847Sume.endif
290141923Snjl.endif
291141923Snjl.if !defined(NODOC)
292141923Snjl.if defined(DOCRELEASETAG)
293141923Snjl	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
294150847Sume.else
295150847Sume	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
296144876Snjl.endif
297142603Snjl	if [ -d ${DOCDISTFILES}/ ]; then \
298142603Snjl		cp -rp ${DOCDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
299142603Snjl	fi
300150847Sume.endif
301150847Sume.endif
302150847Sume.if make(rerelease)
303150847Sume.if !defined(RELEASENOUPDATE)
304142603Snjl.if !defined(RELEASETAG)
305141923Snjl	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d
306142590Snjl.else
307148972Snjl	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
308144876Snjl.endif
309144876Snjl.if !defined(NOPORTS)
310142603Snjl	cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
311142603Snjl.endif
312142603Snjl.if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
313142590Snjl	for i in ${MINIMALDOCPORTS}; do \
314141240Snjl		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q update -P -d ) ; \
315144876Snjl	done
316144876Snjl.endif
317144876Snjl.if !defined(NODOC)
318149239Sume	cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
319144876Snjl.endif
320141240Snjl.endif
321141240Snjl.endif
322141240Snjl	# Add version information to those things that need it.
323141240Snjl	( cd ${CHROOTDIR}/usr/src/sys/conf && \
324141240Snjl	  mv newvers.sh foo && \
325141240Snjl	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh && rm foo )
326141240Snjl	echo OBJFORMAT=${OBJFORMAT} > ${CHROOTDIR}/etc/objformat
327141240Snjl	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
328141943Snjl	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
329171898Snjl	echo "set -ex"				>> ${CHROOTDIR}/mk
330141943Snjl	echo "_RELTARGET=\$${1:-doRELEASE}"	>> ${CHROOTDIR}/mk
331171898Snjl	echo "export CFLAGS='-O -pipe'"	>> ${CHROOTDIR}/mk
332171898Snjl	echo "export WITHOUT_X11=YES"		>> ${CHROOTDIR}/mk
333171898Snjl	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
334144876Snjl	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
335144876Snjl	echo "export OBJFORMAT=${OBJFORMAT}"	>> ${CHROOTDIR}/mk
336141240Snjl.if defined(RELEASETAG)
337171898Snjl	echo "export RELEASETAG=\"${RELEASETAG}\""	>> ${CHROOTDIR}/mk
338171898Snjl.endif
339171898Snjl.if defined(NOPORTS)
340141240Snjl	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
341141240Snjl.endif
342141240Snjl.if defined(MAKE_ISOS)
343141240Snjl	echo "export MAKE_ISOS=${MAKE_ISOS}"	>> ${CHROOTDIR}/mk
344141240Snjl.endif
345141413Snjl.if defined(DOMINIMALDOCPORTS)
346141413Snjl	echo "export DOMINIMALDOCPORTS=${DOMINIMALDOCPORTS}" >> ${CHROOTDIR}/mk
347141413Snjl.endif
348141413Snjl.if defined(NODOC)
349141413Snjl	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
350141413Snjl.endif
351141413Snjl.if defined(ALLLANG) && ${ALLLANG} != "NO" && ${ALLLANG} != "no"
352141943Snjl	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
353171898Snjl.else
354141943Snjl	echo "export DOC_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
355171898Snjl.endif
356171898Snjl.if defined(NOSRC)
357171898Snjl	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
358144876Snjl.endif
359144876Snjl.if defined(RELNOTES_LANG)
360141413Snjl	echo "export RELNOTES_LANG=${RELNOTES_LANG}"	>> ${CHROOTDIR}/mk
361171898Snjl.else
362171898Snjl	echo "export RELNOTES_LANG=en_US.ISO8859-1"	>> ${CHROOTDIR}/mk
363171898Snjl.endif
364141413Snjl.if defined(NOSHARED)
365141413Snjl	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
366141413Snjl.endif
367141413Snjl.if defined(BOOT_CONFIG)
368141413Snjl	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
369141240Snjl.endif
370149239Sume.if defined(KERNEL_FLAGS)
371141923Snjl	echo "export KERNEL_FLAGS=\"${KERNEL_FLAGS}\"" >> ${CHROOTDIR}/mk
372141923Snjl.endif
373150847Sume	# Don't remove this, or the build will fall over!
374141923Snjl	echo "export RELEASEDIR=${_R}"		>> ${CHROOTDIR}/mk
375141923Snjl	echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
376150847Sume	echo "if [ ! -f /tmp/.world_done ]; then" >> ${CHROOTDIR}/mk
377144876Snjl	echo "	cd /usr/src"			>> ${CHROOTDIR}/mk
378144876Snjl.if make(release)
379150847Sume	echo "	(cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
380150847Sume	echo "	make ${WORLD_FLAGS} world && \\"	>> ${CHROOTDIR}/mk
381150847Sume.endif
382150847Sume.if make(rerelease)
383150847Sume	echo "	make ${WORLD_FLAGS} all install && \\" >> ${CHROOTDIR}/mk
384150847Sume.endif
385150847Sume	echo "	touch /tmp/.world_done"		>> ${CHROOTDIR}/mk
386150847Sume	echo "fi"				>> ${CHROOTDIR}/mk
387141923Snjl	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
388141240Snjl	echo "make obj"				>> ${CHROOTDIR}/mk
389141923Snjl	echo "make \$${_RELTARGET}"		>> ${CHROOTDIR}/mk
390141240Snjl	echo "echo \">>> make ${.TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${CHROOTDIR}/mk
391150847Sume	chmod 755 ${CHROOTDIR}/mk
392150847Sume	chroot ${CHROOTDIR} /mk
393150847Sume
394150847Sumeclean:
395150847Sume	rm -rf boot_crunch release.[0-9]
396150847Sume
397150847Sume# Clean out ${_R} and make the directory structure.
398150847Sumerelease.1:
399141240Snjl	mkdir -p ${_R}
400142603Snjl	-rm -rf ${_R}/* 2> /dev/null
401167905Snjl	-chflags -R noschg ${_R}/.
402167905Snjl	rm -rf ${_R}/*
403167905Snjl	mkdir ${RD}
404167905Snjl	mkdir ${RD}/floppies
405167905Snjl	mkdir ${RD}/trees
406167905Snjl	mkdir ${RD}/dists
407142603Snjl	mkdir ${RD}/kernels
408141240Snjl	for i in ${DISTRIBUTIONS} ; do \
409167905Snjl		mkdir ${RD}/trees/$$i && \
410141240Snjl		mkdir ${RD}/dists/$$i && \
411141240Snjl		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
412141240Snjl		    -p ${RD}/trees/$$i > /dev/null && \
413141240Snjl		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
414141240Snjl		    -p ${RD}/trees/$$i/usr > /dev/null && \
415141240Snjl		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
416141240Snjl		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
417141240Snjl		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
418141240Snjl		    -p ${RD}/trees/$$i/var > /dev/null ; \
419141240Snjl	done
420141240Snjl	touch release.1
421171896Snjl
422141240Snjl# Install the system into the various distributions.
423141240Snjlrelease.2:
424141240Snjl	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
425142603Snjl	cd ${.CURDIR}/.. && make distribworld DISTDIR=${RD}/trees
426141240Snjl.if exists(${.CURDIR}/../kerberosIV) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
427141240Snjl	cd ${.CURDIR}/../kerberosIV && ( \
428141240Snjl		make bootstrap &&\
429142603Snjl		make obj all help-distribute DISTDIR=${RD}/trees &&\
430142603Snjl		make kprog \
431144876Snjl	)
432144876Snjl.endif
433141240Snjl.if exists(${.CURDIR}/../kerberos5) && exists(${.CURDIR}/../crypto) && !defined(NOKERBEROS)
434144876Snjl	cd ${.CURDIR}/../kerberos5 && ( \
435142603Snjl		make bootstrap &&\
436141240Snjl		make obj all help-distribute DISTDIR=${RD}/trees &&\
437141240Snjl		make kprog \
438141240Snjl	)
439141240Snjl.endif
440141240Snjl	-chflags -R noschg ${RD}/trees
441141240Snjl	touch release.2
442141240Snjl
443141240Snjl# Make and install the generic kernel(s).
444141240Snjlrelease.3:
445141240Snjl.for kernel in ${KERNELS}
446141240Snjl	-chflags -R noschg ${RD}/kernels/${kernel}
447142395Snjl	rm -rf ${RD}/kernels/${kernel}
448142395Snjl	rm -rf ${.CURDIR}/../sys/${MACHINE}/compile/${kernel}
449142395Snjl	cd ${.CURDIR} && ${MAKE} doSTDKERNEL KERNEL=${kernel} KODIR=/${kernel}
450142603Snjl	rm -rf ${.CURDIR}/../sys/${MACHINE}/compile/${kernel}
451142603Snjl	-mkdir ${RD}/trees/bin/boot/${kernel}
452142395Snjl	cp -p ${RD}/kernels/${kernel}/kernel ${RD}/trees/bin/boot/${kernel}
453141240Snjl.endfor
454142603Snjl	# Install a standard boot kernel+modules
455142603Snjl	mkdir -p ${RD}/trees/bin/boot/kernel
456142603Snjl	cp -Rp ${RD}/kernels/GENERIC/* ${RD}/trees/bin/boot/kernel
457142603Snjl	touch release.3
458142603Snjl
459142603Snjl# Make and install the three crunched binaries which live on the floppies.
460142603Snjl# You are not supposed to like this :-)
461142603Snjlrelease.4:
462142603Snjl	@mkdir -p /stand
463142603Snjl	rm -rf ${RD}/crunch
464142603Snjl	mkdir -p ${RD}/crunch
465142603Snjl	for j in ${CRUNCH_TARGETS} ; do \
466142603Snjl		rm -rf $${j}_crunch && \
467142603Snjl		mkdir $${j}_crunch && \
468171896Snjl		( cd $${j}_crunch && \
469171896Snjl		  ( ( [ -f ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ] && \
470141240Snjl		    crunchgen ${.CURDIR}/${MACHINE}/$${j}_crunch.conf ) || \
471178787Sjhb		    ( crunchgen ${.CURDIR}/$${j}_crunch.conf ) ) && \
472141240Snjl		  ${MAKE} -f $${j}_crunch.mk subclean all ) && \
473141240Snjl		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
474141413Snjl		true || { rm -rf $${j}_crunch ; false ; } ; \
475141240Snjl	done
476141240Snjl	touch release.4
477141240Snjl
478141240Snjl#
479141240Snjl# --==## Fix up the distributions. ##==--
480141240Snjl#
481144876Snjlrelease.5:
482144876Snjl	# Handle some grief caused by the munition braindeadness.
483141240Snjl	for i in ${FIXCRYPTO}; do \
484144876Snjl		( cd ${.CURDIR}/../$$i; \
485141240Snjl		  make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
486141240Snjl	done
487141240Snjl
488141240Snjl	# Create any "synthetic dists" now.
489141240Snjl	@for i in ${DISTRIBUTIONS}; do \
490141240Snjl		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
491141240Snjl			echo -n "Running $$i dist creation script... "; \
492141240Snjl			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
493141240Snjl			echo "Done."; \
494141240Snjl		fi \
495141240Snjl	done \
496141240Snjl
497141240Snjl	# Remove all the directories we don't need.
498141240Snjl	-cd ${RD}/trees && \
499141240Snjl		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
500144876Snjl	touch release.5
501178787Sjhb
502141240Snjl#
503141240Snjl# --==## Package up the tarballs from assembled trees ##==--
504178787Sjhb#
505141240Snjlrelease.6:
506141240Snjl	rm -rf ${RD}/dists
507142603Snjl	mkdir -p ${RD}/dists
508142603Snjl	@for i in ${DISTRIBUTIONS} ; \
509142603Snjl	do \
510142603Snjl		if [ -d ${RD}/trees/$${i} ] ; then \
511141240Snjl			cd ${.CURDIR} && $(MAKE) doTARBALL \
512141240Snjl				SD=${RD}/trees/$${i} \
513142603Snjl				TN=$$i TD=$$i ARG="." && \
514141240Snjl			echo "$${i} distribution is finished."; \
515141240Snjl		fi ; \
516141240Snjl	done
517141240Snjl	# More munition braindeadness.
518141240Snjl	( cd ${RD}/dists && \
519141413Snjl		if [ -f krb4/krb4.aa ] ; then \
520141240Snjl			mv krb4/krb4.* crypto && \
521141240Snjl			cat krb4/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
522141240Snjl			rm -r krb4; \
523141240Snjl		fi )
524141240Snjl	( cd ${RD}/dists && \
525141240Snjl		if [ -f krb5/krb5.aa ] ; then \
526141413Snjl			mv krb5/krb5.* crypto && \
527141240Snjl			cat krb5/CHECKSUM.MD5 >> crypto/CHECKSUM.MD5 && \
528141240Snjl			rm -r krb5; \
529141240Snjl		fi )
530141240Snjl	touch release.6
531141240Snjl
532141240Snjl
533141240Snjl#
534141240Snjl# --==## Make source dists ##==--
535141240Snjl#
536141240Snjlrelease.7:
537141240Snjl.if !defined(NOSRC)
538141240Snjl	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
539141240Snjl		TD=src TN=sbase ARG="[A-Z]*"
540141240Snjl	@for i in `cd /usr/src && echo [a-z]*` ; do \
541141240Snjl		if [ -d /usr/src/$$i ] ; then \
542141240Snjl			cd ${.CURDIR} && $(MAKE) doTARBALL \
543141240Snjl				TN=`echo s$$i | tr -d '.' | \
544142603Snjl				    sed -e 's/usr/u/' \
545141240Snjl					-e 's/kerberosIV/krb4/' \
546141824Snjl					-e 's/kerberos5/krb5/'` \
547141240Snjl				SD=/usr/src TD=src ARG="$$i" ; \
548141240Snjl		fi ; \
549141824Snjl	done
550141824Snjl.if defined(EXTRA_SRC)
551141824Snjl	@set ${EXTRA_SRC} && \
552141824Snjl	while [ $$# -ge 2 ] ; do \
553141824Snjl		if [ -d /usr/src/$$1 ] ; then \
554142032Snjl			cd ${.CURDIR} && $(MAKE) doTARBALL \
555144876Snjl				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
556144876Snjl		fi && shift && shift ; \
557144876Snjl	done
558144876Snjl.endif
559144876Snjl	if [ -d ${RD}/dists/crypto ] ; then ( cd ${RD}/dists/src && \
560142032Snjl		if [ -f ssecure.aa ] ; then mv ssecure.* ../crypto ; fi && \
561144876Snjl		if [ -f scrypto.aa ] ; then mv scrypto.* ../crypto ; fi && \
562141240Snjl		if [ -f skrb4.aa ] ; then mv skrb4.* ../crypto ; fi && \
563142032Snjl		if [ -f skrb5.aa ] ; then mv skrb5.* ../crypto ; fi ; \
564142032Snjl		cd ${RD}/dists/crypto; rm -f CHECKSUM.MD5; \
565141240Snjl		md5 * > CHECKSUM.MD5 ) ; fi
566141413Snjl	(cd ${RD}/dists/src; rm -f CHECKSUM.MD5; md5 * > CHECKSUM.MD5)
567141824Snjl	@echo "src distribution is finished."
568141814Snjl.endif
569141413Snjl	touch release.7
570141413Snjl
571141413Snjl# Complete the bootfd
572141413Snjl#
573144876Snjl# Now, just to get this picture down once and for all:
574141413Snjl#
575141413Snjl# +------------------------------------------------------------------------+
576141413Snjl# |boot.flp                                                                |
577141413Snjl# +-----+-----+------------------------------------------------------------+
578141413Snjl# |boot1|boot2|floppy filesystem "bootfd"                                  |
579141413Snjl# +-----+-----+-+----------------------+---------------------------------+-+
580141413Snjl#               |kernel.gz             |mfsroot.gz                       |
581141413Snjl#               +----------------------+---------------------------------+
582141413Snjl#
583141413Snjl
584141413Snjlrelease.8:
585141413Snjl	rm -rf ${RD}/mfsfd
586141240Snjl	mkdir ${RD}/mfsfd
587141240Snjl	cd ${RD}/mfsfd && \
588141240Snjl		mkdir -p etc/defaults dev mnt stand/help
589141240Snjl	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
590141945Snjl		DIR=${RD}/mfsfd/stand ZIP=false
591141945Snjl	( cd ${RD}/trees/bin/dev && \
592141945Snjl		ls console tty bpf0 ttyd0 ttyv0 ttyv1 ttyv2 ttyv3 null zero card0 card1 card2 card3 usb usb0 uhid0 ums0 ulpt0 ugen0 kbd0 kmem mem | \
593141945Snjl	cpio -dump ${RD}/mfsfd/dev )
594141240Snjl	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
595141945Snjl	( cd ${RD}/mfsfd && \
596193155Snwhitehorn	  for dir in bin sbin ; do \
597193155Snwhitehorn		ln -sf /stand $$dir; \
598193155Snwhitehorn	  done )
599193155Snwhitehorn	cp /sbin/dhclient-script ${RD}/mfsfd/stand
600193155Snwhitehorn	cp ${.CURDIR}/../etc/defaults/pccard.conf ${RD}/mfsfd/etc/defaults/pccard.conf
601193155Snwhitehorn	cp ${.CURDIR}/../etc/usbd.conf ${RD}/mfsfd/etc/usbd.conf
602193155Snwhitehorn	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
603193155Snwhitehorn	( for F in netconfig protocols ; do \
604193155Snwhitehorn		sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
605193155Snwhitehorn		${RD}/trees/bin/etc/$$F > ${RD}/mfsfd/stand/etc/$$F ; \
606193155Snwhitehorn	  done )
607141240Snjl	grep -E '^(ftp|nameserver|domain|sunrpc|cmd|nfsd)[^-\w]' \
608141945Snjl	    ${.CURDIR}/../etc/services | \
609141945Snjl	    sed -e '/^#.*$$/d' -e 's/[:space:]*#.*$$//g' \
610141945Snjl	    > ${RD}/mfsfd/stand/etc/services
611141413Snjl	ln ${RD}/mfsfd/stand/etc/services ${RD}/mfsfd/etc/services
612141240Snjl	ln ${RD}/mfsfd/stand/etc/netconfig ${RD}/mfsfd/etc/netconfig
613141240Snjl	gzip -9c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
614141240Snjl.if !defined(NODOC)
615141240Snjl	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
616141413Snjl	  gzip -9c ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
617141413Snjl	done
618141413Snjl	@for i in ${DIST_DOCS_ARCH_DEP}; do \
619141413Snjl	  gzip -9c ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt > ${RD}/mfsfd/stand/help/`echo $${i} | tr 'a-z' 'A-Z'`.TXT.gz; \
620141413Snjl	done
621141413Snjl	@mv ${RD}/mfsfd/stand/help/INSTALLATION.TXT.gz ${RD}/mfsfd/stand/help/INSTALL.TXT.gz
622141413Snjl.endif
623141413Snjl	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
624141413Snjl	@mkdir -p ${RD}/mfsfd/boot
625141413Snjl	@cp /boot/boot* ${RD}/mfsfd/boot
626141413Snjl	@cp /boot/loader.help ${RD}/mfsfd/boot
627141413Snjl	@cd ${.CURDIR} && ${MAKE} createBOOTMFS 
628141240Snjl.if exists(${.CURDIR}/${MACHINE}/drivers.conf)
629141240Snjl	@cd ${.CURDIR} && ${MAKE} doMODULES KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
630175376Snjl.endif
631175376Snjl	@echo "Making the regular boot floppy."
632175376Snjl	@tar --exclude CVS -cf - -C /usr/src/usr.sbin/sysinstall help | \
633175376Snjl		tar xf - -C ${RD}/mfsfd/stand
634175376Snjl	@echo "Compressing doc files..."
635175376Snjl	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
636175376Snjl.if ${MACHINE_ARCH} == "alpha"
637175376Snjl	rm -rf ${RD}/mfsfd/stand/help/*
638175376Snjl.endif
639175376Snjl.if exists(${.CURDIR}/${MACHINE}/drivers.conf)
640175376Snjl	@mkdir -p ${RD}/mfsfd/stand/modules
641142590Snjl	@perl ${.CURDIR}/scripts/driver-copy2.pl \
642148972Snjl		${.CURDIR}/${MACHINE}/drivers.conf \
643142590Snjl		${RD}/kernels ${RD}/mfsfd/stand/modules
644142590Snjl.endif
645142590Snjl	sh -e ${.CURDIR}/scripts/doFS.sh -s mfsroot ${RD} ${MNT} \
646142590Snjl		${MFSSIZE} ${RD}/mfsfd ${MFSINODE} ${MFSLABEL}
647141240Snjl	@gzip -9vc mfsroot > mfsroot.gz
648141240Snjl.if ${MACHINE} == "pc98"
649141240Snjl	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
650141413Snjl		${RD} ${MNT} ${SMALLBOOTSIZE} mfsroot.gz \
651141240Snjl		${BOOTINODE} ${SMALLBOOTLABEL}
652141240Snjl	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern-small FDSIZE=SMALL
653141240Snjl	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
654141240Snjl.else
655141240Snjl	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/mfsroot.flp \
656141240Snjl		${RD} ${MNT} ${BOOTSIZE} mfsroot.gz ${BOOTINODE} ${BOOTLABEL}
657141240Snjl	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=kern
658141240Snjl	@cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=boot FDSIZE=BIG
659142603Snjl.endif
660142603Snjl	@rm mfsroot mfsroot.gz
661142603Snjl	@echo "Regular and MFS boot floppies made."
662141413Snjl	touch release.8
663141413Snjl
664141413Snjl#
665141413Snjl# --==## Create a fixit floppy ##==--
666141240Snjl#
667141240Snjlrelease.9:
668141240Snjl	@echo "Making fixit floppy."
669141240Snjl	@rm -rf ${RD}/fixitfd
670141240Snjl	@mkdir ${RD}/fixitfd
671141240Snjl	@cd ${RD}/fixitfd && \
672141240Snjl		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
673141240Snjl		usr/share/misc
674141240Snjl	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
675141240Snjl		DIR=${RD}/fixitfd/stand ZIP=false
676141413Snjl	@( cd ${RD}/fixitfd/dev && \
677141240Snjl		cp ${RD}/trees/bin/dev/MAKEDEV MAKEDEV && \
678141240Snjl		chmod 755 MAKEDEV && \
679141413Snjl		sh MAKEDEV fixit )
680141240Snjl	@cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
681141240Snjl		${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
682141240Snjl	@cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
683142603Snjl		${RD}/fixitfd/usr/share/misc
684142603Snjl	@cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
685141413Snjl	@cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
686141240Snjl	@cp ${.CURDIR}/scripts/tar.sh ${RD}/fixitfd/stand/tar
687141240Snjl	@chmod 555 ${RD}/fixitfd/stand/tar
688141240Snjl	@sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/fixit.flp ${RD} \
689141240Snjl		${MNT} ${FIXITSIZE} ${RD}/fixitfd ${FIXITINODE} ${FIXITLABEL}
690141240Snjl# Do our last minute floppies directory setup in a convenient place.
691141413Snjl.if !defined(NODOC)
692141413Snjl	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/installation/${MACHINE_ARCH}/article.txt \
693141413Snjl		${RD}/floppies/README.TXT
694141240Snjl	@(cd ${RD}/floppies; md5 README.TXT *.flp > CHECKSUM.MD5)
695141240Snjl.else
696144876Snjl	@(cd ${RD}/floppies; md5 *.flp > CHECKSUM.MD5)
697144876Snjl.endif
698141240Snjl	touch release.9
699141240Snjl
700141240Snjl#
701141240Snjl# --==## Setup a suitable ftp-area ##==--
702141240Snjl#
703141413Snjlftp.1:
704144876Snjl	@echo "Setting up FTP distribution area"
705144876Snjl	@mkdir -p ${FD}
706141240Snjl	-@ln -s . ${FD}/${BUILDNAME}
707141240Snjl	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
708141240Snjl	@cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
709141240Snjl.if !defined(NODOC)
710141240Snjl	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
711141240Snjl	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
712141240Snjl	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
713141240Snjl	done
714141413Snjl	@for i in ${DIST_DOCS_ARCH_DEP}; do \
715141413Snjl	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
716141413Snjl	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${FD}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
717141240Snjl	done
718141413Snjl	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/readme/docbook.css ${FD}
719141413Snjl	@mv ${FD}/INSTALLATION.TXT ${FD}/INSTALL.TXT
720141413Snjl	@mv ${FD}/INSTALLATION.HTM ${FD}/INSTALL.HTM
721141413Snjl.endif
722141413Snjl	@echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
723141413Snjl.if !defined(NOPORTS)
724142603Snjl	@tar --exclude CVS -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
725142603Snjl.endif
726149607Snjl	touch ftp.1
727149607Snjl
728149607Snjl#
729149607Snjl# --==## Setup a suitable cdrom-area ##==--
730149607Snjl#
731149607Snjlcdrom.1:
732149607Snjl	@echo "Setting up CDROM distribution area"
733149607Snjl	@mkdir -p ${CD_DISC1} ${CD_DISC2}
734149607Snjl	@cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
735141413Snjl	@cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
736141413Snjl	@for i in ${DISTRIBUTIONS} ; \
737141413Snjl	do \
738141413Snjl		if [ -d ${RD}/trees/$${i} ] ; then \
739141413Snjl			chflags -R noschg ${RD}/trees/$${i} || true ; \
740141413Snjl			( cd ${RD}/trees/$${i} && \
741141413Snjl			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
742141413Snjl		fi \
743141413Snjl	done
744149607Snjl	@rm -f ${CD_DISC2}/.profile
745141413Snjl	@cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
746141413Snjl	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
747149607Snjl	@echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
748149607Snjl.if !defined(NODOC)
749149607Snjl	@for i in ${DIST_DOCS_ARCH_INDEP}; do \
750149607Snjl	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
751149607Snjl	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
752149607Snjl	done
753149607Snjl	@for i in ${DIST_DOCS_ARCH_DEP}; do \
754149607Snjl	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.txt ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \
755149607Snjl	  cp ${.CURDIR}/doc/${RELNOTES_LANG}/$$i/${MACHINE_ARCH}/article.html ${CD_DISC1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \
756149607Snjl	done
757141413Snjl	@cp ${.CURDIR}/doc/${RELNOTES_LANG}/readme/docbook.css ${CD_DISC1}
758141413Snjl	@mv ${CD_DISC1}/INSTALLATION.TXT ${CD_DISC1}/INSTALL.TXT
759141413Snjl	@mv ${CD_DISC1}/INSTALLATION.HTM ${CD_DISC1}/INSTALL.HTM
760141413Snjl.endif
761141413Snjl.if ${MACHINE} != "pc98"
762141413Snjl	@echo "Setting up /boot"
763141413Snjl	@cp -Rp ${CD_DISC2}/boot ${CD_DISC1}
764144876Snjl	@ln -f ${RD}/image.boot/mfsroot.gz ${CD_DISC1}/boot/mfsroot.gz
765144876Snjl	@ln -f ${CD_DISC1}/boot/mfsroot.gz ${CD_DISC2}/boot/mfsroot.gz
766144876Snjl	@echo 'mfsroot_load="YES"' > ${CD_DISC1}/boot/loader.conf
767141413Snjl	@echo 'mfsroot_type="mfs_root"' >> ${CD_DISC1}/boot/loader.conf
768141413Snjl	@echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DISC1}/boot/loader.conf
769141413Snjl	@ln -f ${CD_DISC1}/boot/loader.conf ${CD_DISC2}/boot/loader.conf
770141413Snjl.endif
771141413Snjl.if ${MACHINE} == "i386"
772141413Snjl	@mkdir -p ${CD_DISC2}/floppies
773141413Snjl	@cp ${CD_DISC1}/floppies/boot.flp ${CD_DISC2}/floppies
774141413Snjl.endif
775141413Snjl.if !defined(NOPORTS)
776141413Snjl	@-rm -rf /usr/ports/distfiles/*
777141413Snjl	@mkdir -p ${CD_DISC1}/ports && \
778141413Snjl	  tar --exclude CVS -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
779141413Snjl	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh \
780141413Snjl	  && (cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
781141413Snjl.endif
782142603Snjl	touch cdrom.1
783142603Snjl
784141413Snjliso.1:
785141413Snjl	@if [ -r ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh ]; then \
786141413Snjl		echo "Creating ISO images..."; \
787141413Snjl		sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh -b fbsd_miniinst \
788141413Snjl		  ${CD}/miniinst.iso ${CD_DISC1}; \
789141413Snjl		sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh -b fbsd_livefs \
790141413Snjl		  ${CD}/disc2.iso ${CD_DISC2}; \
791141413Snjl		if [ "x${CD_EXTRA_BITS}" != "x" ]; then \
792141413Snjl			sh ${.CURDIR}/${MACHINE_ARCH}/mkisoimages.sh -b fbsd_boot \
793141413Snjl			  ${CD}/disc1.iso ${CD_DISC1} ${CD_EXTRA_BITS}; \
794141413Snjl			    && false; \
795141413Snjl		fi \
796141413Snjl	else \
797141413Snjl		echo "Do not know how to create an ISO for ${MACHINE_ARCH}."; \
798141413Snjl	fi
799141413Snjl	touch iso.1
800141413Snjl
801141413Snjl#
802141413Snjl# --==## Documentation Project files such as the Handbook and FAQ ##==--
803141413Snjl#
804141413Snjldoc.1:
805141413Snjl	@echo "Making docs..."
806144876Snjl	@for i in ${DOCPORTS}; do \
807141413Snjl	  cd /usr/ports/$$i && make all install clean BATCH=yes JADETEX=no FORCE_PKG_REGISTER=yes; \
808141413Snjl	done
809141413Snjl	@cd /usr/doc && make all install 'FORMATS=html html-split txt' INSTALL_COMPRESSED='' DOCDIR=${RD}/trees/bin/usr/share/doc
810141413Snjl	touch doc.1
811141413Snjl
812141413Snjl#
813141413Snjl# --==## RELNOTESng:  Next-generation replacements for *.TXT files ##==--
814141413Snjl#
815141413Snjldoc.2:
816141413Snjl	@echo "Making release documentation..."
817144876Snjl	@cd ${.CURDIR}/doc && make all 'FORMATS=html txt'
818144876Snjl	touch doc.2
819141413Snjl
820141413Snjl# Various "subroutine" and other supporting targets.
821141413Snjl
822141413Snjl# RD=
823149607Snjl# SD=
824149607Snjl# TD=
825149607Snjl# ARG=
826149607SnjldoTARBALL:
827149607Snjl.if !defined(SD)
828149607Snjl	@echo "SD undefined in doTARBALL" && exit 1
829149607Snjl.endif
830149607Snjl.if !defined(TD)
831141413Snjl	@echo "TD undefined in doTARBALL" && exit 1
832141413Snjl.endif
833149607Snjl.if !defined(ARG)
834149607Snjl	@echo "ARG undefined in doTARBALL" && exit 1
835149607Snjl.endif
836149724Snjl	@rm -rf ${RD}/dists/${TD}/${TN}*
837149724Snjl	@mkdir -p ${RD}/dists/${TD}
838149724Snjl	@( cd ${SD} && \
839149724Snjl		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
840149607Snjl		echo rolling ${TD}/$$tn tarball &&\
841149724Snjl		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
842149724Snjl		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
843149724Snjl		sh ${.CURDIR}/scripts/info.sh ${RD}/dists/${TD}/$$tn > \
844149724Snjl		   ${RD}/dists/${TD}/$$tn.inf && \
845149724Snjl		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
846149724Snjl		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
847149724Snjl		fi && \
848149724Snjl		if [ "${SD}" != "/usr/src" ]; then \
849149724Snjl			mtree -c -i -p ${SD}/${ARG} \
850149724Snjl			  -k gname,md5digest,mode,nlink,uname,size,link,type \
851149724Snjl			  > ${RD}/dists/${TD}/$$tn.mtree ; \
852149724Snjl		else \
853149724Snjl			true; \
854141413Snjl		fi; \
855141413Snjl		(cd ${RD}/dists/${TD}; \
856141413Snjl		   rm -f CHECKSUM.MD5; \
857149607Snjl		   md5 * > CHECKSUM.MD5) \
858149607Snjl	)
859149607Snjl
860149607SnjldoRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
861149607Snjl		release.6 release.7 release.8 release.9
862149607Snjl	@cd ${.CURDIR} && ${MAKE} ${EXTRAS}
863149607Snjl	@echo "Release done"
864149607Snjl
865141413Snjlfloppies:
866141413Snjl	@cd ${.CURDIR} && ${MAKE} boot.flp
867141413Snjl	@cd ${.CURDIR} && ${MAKE} fixit.flp
868141413Snjl	@cd ${RD} && find floppies -print | cpio -dumpl ${FD}
869141240Snjl
870141240Snjlboot.flp:
871141240Snjl	@rm -f release.4 release.8
872141240Snjl	@cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
873141814Snjl
874141814Snjlfixit.flp:
875141240Snjl	@rm -f release.4 release.9
876141814Snjl	@cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
877141240Snjl
878210422Savgwrite_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
879141240Snjl	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
880141240Snjl
881141240SnjlinstallCRUNCH:
882141240Snjl.if !defined(CRUNCH)
883141240Snjl	@echo "CRUNCH undefined in installCRUNCH" && exit 1
884141240Snjl.endif
885141240Snjl.if !defined(DIR)
886141240Snjl	@echo "DIR undefined in installCRUNCH" && exit 1
887141240Snjl.endif
888141814Snjl.if !defined(ZIP)
889141814Snjl	@echo "ZIP undefined in installCRUNCH" && exit 1
890141814Snjl.endif
891141814Snjl	@if ${ZIP} ; then \
892141814Snjl		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
893141814Snjl	else \
894141240Snjl		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
895141240Snjl	fi
896141814Snjl	@chmod 555 ${DIR}/${CRUNCH}_crunch
897141814Snjl	@if [ -f ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf ] ; then \
898141814Snjl		for i in `crunchgen -l ${.CURDIR}/${MACHINE}/${CRUNCH}_crunch.conf` ; do \
899142395Snjl			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
900142395Snjl		done \
901142395Snjl	else \
902142395Snjl		for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
903141240Snjl			ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
904142395Snjl		done \
905141814Snjl	fi
906141814Snjl
907141814Snjl#
908141814Snjl# --==## BOOTMFS config file ##==--
909141814Snjl#
910141814Snjl
911141240SnjlcreateBOOTMFS:
912141814Snjl	@cd ${.CURDIR}/../sys/${MACHINE}/conf && \
913141814Snjl	  sh ${.CURDIR}/${MACHINE_ARCH}/dokern.sh ${FDSIZE} < ${KERNCONF} > BOOTMFS && \
914141814Snjl	  [ -r ${KERNCONF}.hints ] && cp ${KERNCONF}.hints BOOTMFS.hints
915141814Snjl.if 0 && ${MACHINE_ARCH} == "i386"
916141240Snjl	@echo "options  INTRO_USERCONFIG" >> \
917141240Snjl	  ${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
918141240Snjl.endif
919141814Snjl.if exists(${.CURDIR}/${MACHINE}/drivers.conf)
920141814Snjl	@perl ${.CURDIR}/scripts/driver-remove.pl \
921141240Snjl		${.CURDIR}/${MACHINE}/drivers.conf \
922141240Snjl		${.CURDIR}/../sys/${MACHINE}/conf/BOOTMFS
923141240Snjl.endif
924141240Snjl
925141240Snjl#
926141240Snjl# --==## Compile a kernel by name ${KERNEL} ##==--
927141240Snjl#
928141240Snjl# We don't erase the sys/${MACHINE}/compile/${KERNEL} directory, since somebody
929141240Snjl# may want to reuse it (release.8 presently)
930141240Snjl#
931141240SnjldoKERNEL:
932141240Snjl	@rm -f ${RD}/kernels/${KERNEL}
933141240Snjl	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
934141240Snjl	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
935141240Snjl			make kernel-depend && \
936141240Snjl			make ${KERNEL_FLAGS} ${KERNEL_KO} && \
937141240Snjl			make kernel-reinstall DESTDIR=${RD}/kernels && \
938210422Savg			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
939201848Sbrueffer			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
940201848Sbrueffer
941141240SnjldoMODULES:
942201848Sbrueffer	@rm -f ${RD}/kernels/*.ko
943141240Snjl	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
944142395Snjl	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
945142395Snjl			make modules-depend && \
946142395Snjl			make ${KERNEL_FLAGS} modules && \
947141240Snjl			make modules-reinstall DESTDIR=${RD}/kernels && \
948142395Snjl
949141240SnjldoSTDKERNEL:
950141240Snjl	@rm -f ${RD}/kernels/${KERNEL}
951141240Snjl	@cd ${.CURDIR}/../sys/${MACHINE}/conf && config ${KERNEL}
952141240Snjl	@cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
953141240Snjl			make depend && \
954141240Snjl			make ${KERNEL_FLAGS} KERNEL=${KERNEL} && \
955141240Snjl			make KERNEL=${KERNEL} DESTDIR=${RD}/kernels install && \
956141240Snjl			[ -r ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ] && \
957141240Snjl			cp ${.CURDIR}/../sys/${MACHINE}/conf/${KERNEL}.hints ${RD}/kernels
958141240Snjl	@-cd ${.CURDIR}/../sys/${MACHINE}/compile/${KERNEL} && \
959141240Snjl			make KERNEL=${KERNEL} DESTDIR=${RD}/kernels \
960141240Snjl				kernel-reinstall.debug
961141240Snjl
962141240Snjl#
963141240Snjl# --==## Put a filesystem into a BOOTMFS kernel ##==--
964141240Snjl#
965142114SnjldoMFSKERN:
966142114Snjl	@echo "Running doMFSKERN for ${FSIMAGE}"
967142114Snjl	@rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
968142114Snjl	@cd ${.CURDIR} && ${MAKE} createBOOTMFS 
969142114Snjl	@cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS KERNEL_KO=BOOTMFS KODIR=""
970142114Snjl	@rm -rf ${RD}/image.${FSIMAGE}
971142114Snjl	@mkdir  ${RD}/image.${FSIMAGE}
972142114Snjl	@cd ${RD}/kernels && \
973142114Snjl	  (chflags noschg BOOTMFS || true) && \
974142114Snjl	  strip BOOTMFS && \
975142114Snjl	  cp BOOTMFS BOOTMFS.${FSIMAGE} && \
976142114Snjl	  [ -r BOOTMFS.hints ] && mv BOOTMFS.hints BOOTMFS.${FSIMAGE}.hints
977142114Snjl	mv ${RD}/kernels/BOOTMFS ${RD}/image.${FSIMAGE}/kernel
978142114Snjl	@echo "Setting up /boot directory for ${FSIMAGE} floppy"
979201848Sbrueffer	@mkdir -p ${RD}/image.${FSIMAGE}/boot
980201848Sbrueffer	@cp /boot/loader ${RD}/image.${FSIMAGE}/boot
981142114Snjl	@[ -r ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints ] && \
982201848Sbrueffer	  sed -e '/^hint/s/^/set /' -e '/^#/d' \
983142114Snjl	    ${RD}/kernels/BOOTMFS.${FSIMAGE}.hints > \
984142114Snjl	    ${RD}/image.${FSIMAGE}/boot/device.hints && \
985142114Snjl	  echo "include /boot/device.hints" > ${RD}/image.${FSIMAGE}/boot/loader.rc
986142114Snjl	@echo "load /kernel" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
987142114Snjl.if !defined(FDSIZE) || ${FDSIZE} != "BIG"
988142114Snjl	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
989142114Snjl	@echo "echo Please insert MFS root floppy and press enter:" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
990142114Snjl	@echo "read" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
991142114Snjl.endif
992142114Snjl	@echo "load -t mfs_root /mfsroot" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
993142114Snjl	@echo "echo \\007\\007" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
994142114Snjl	@echo "autoboot 10" >> ${RD}/image.${FSIMAGE}/boot/loader.rc
995142114Snjl.if ${MACHINE_ARCH} == "i386" && ${AUTO_KEYBOARD_DETECT}
996142114Snjl	@echo "-P" >> ${RD}/image.${FSIMAGE}/boot.config
997142114Snjl.endif
998142114Snjl	@gzip -9v ${RD}/image.${FSIMAGE}/kernel
999142114Snjl	@rm -f ${RD}/floppies/${FSIMAGE}.flp
1000142114Snjl.if defined(FDSIZE) && ${FDSIZE} == "BIG"
1001141240Snjl	@cp mfsroot.gz ${RD}/image.${FSIMAGE}
1002141240Snjl	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1003141240Snjl		${RD} ${MNT} ${BIGBOOTSIZE} ${RD}/image.${FSIMAGE} \
1004141945Snjl		${BOOTINODE} ${BIGBOOTLABEL}
1005141240Snjl.elif defined(FDSIZE) && ${FDSIZE} == "SMALL"
1006141240Snjl	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1007142114Snjl		${RD} ${MNT} ${SMALLBOOTSIZE} ${RD}/image.${FSIMAGE} \
1008142114Snjl		${BOOTINODE} ${SMALLBOOTLABEL}
1009142114Snjl.else
1010142114Snjl	sh -e ${.CURDIR}/scripts/doFS.sh ${RD}/floppies/${FSIMAGE}.flp \
1011142114Snjl		${RD} ${MNT} ${BOOTSIZE} ${RD}/image.${FSIMAGE} \
1012142114Snjl		${BOOTINODE} ${BOOTLABEL}
1013141240Snjl.endif
1014141814Snjl	@echo "Created ${RD}/floppies/${FSIMAGE}.flp"
1015141814Snjl
1016141240Snjl.include <bsd.prog.mk>
1017141814Snjl