Makefile revision 38801
1#	$Id: Makefile,v 1.373 1998/09/04 06:31:34 jkh Exp $
2#
3# make release CHROOTDIR=/some/dir BUILDNAME=somename [ RELEASETAG=tag ]
4#
5# Where "/some/dir" is the pathname of a directory on a some
6# filesystem with at least 600MB of free space, "somename" is what
7# you want the release to call itself and, optionally, which CVS "tag"
8# name should be used when checking out the sources to build the release
9# (default is HEAD).
10#
11# Please note: the vn driver must also be compiled into your kernel,
12# otherwise the target 'release.8' and possibly others will fail.
13#
14# Set these, release builder!
15#
16# Fixed version:
17#BUILDNAME=2.2-RELEASE
18#
19# Automatic SNAP versioning:
20DATE != date +%Y%m%d
21BASE = 3.0
22BUILDNAME?=${BASE}-${DATE}-SNAP
23#
24#CHROOTDIR=/junk/release
25# If this is a RELEASE, then set
26#RELEASETAG=RELENG_2_2
27
28# If you are using a local CVS repository with components stored in 
29# non-standard modules, override these on the make commandline or
30# in the environment.
31RELEASESRCMODULE?=	src
32RELEASEDOCMODULE?=	doc
33RELEASEPORTSMODULE?=	ports
34
35# Unless set elsewhere, indicate the object format we'll be using.
36OBJFORMAT?=		elf
37
38# Uncomment this to disable the doc.1 target.  It is also an ERROR
39# to set NOPORTS and not set NODOC since docs depend on ports.
40#NODOC=  YES
41# Comment the following if you want the release documentation to be
42# in English only.
43ALLLANG= yes
44DOCPORTS= archivers/unzip lang/perl5 textproc/jade textproc/iso8879 \
45          textproc/linuxdoc textproc/docbook textproc/sgmlformat
46
47# Things which without too much trouble can be considered variables
48# BIN_DISTS are special in that they get full /etc installation sets.
49#
50COMPAT_DISTS?=	compat1x compat20 compat21
51OTHER_DISTS?=	manpages catpages games proflibs dict info doc
52CRYPTO_DISTS?=	krb des
53BIN_DISTS?=	bin
54DISTRIBUTIONS?=	${BIN_DISTS} ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS}
55KERNELS?=	GENERIC
56
57# Extra source tarballs; each argument is a pair of source dir and
58# distribution name.  The dist name should not exceed 7 characters
59# (another "s" for "source" will be prepended).
60EXTRA_SRC+=	usr.sbin/sendmail/cf smailcf
61
62BOOT1=	etc/protocols etc/rc.conf
63
64# mountpoint for filesystems.
65MNT=			/mnt
66
67# other floppy parameters.
68FDSIZE=			1440
69FDLABEL=		fd1440
70
71ZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
72
73# Upper size for the mfs in the boot.flp kernel.
74# These are adjusted down to the minimum needed by doFS.sh.
75BOOTMFSSIZE=		1440
76MFSINODE=		8000
77FIXITINODE=		2000
78BOOTINODE=		1000000
79
80VNDEVICE?=		vn0
81
82# Things which may get you into trouble if you change them
83MTREEFILES=		${.CURDIR}/../etc/mtree
84RD=			/R/stage
85FD=			/R/ftp
86CD=			/R/cdrom
87CD_DISC1=		${CD}/disc1
88CD_DISC2=		${CD}/disc2
89
90# Where the bootstrap ports (see DOCPORTS) get installed.
91LOCALDIR=		/usr/local/bin
92
93# ${BOOTSTRAPDIR} is for those utilities that refer to the hosting
94# environment, rather than the target environment.  This is specifically
95# intended for kernel-dependent utilities that are used during the build.
96#
97# ${BOOTSTRAPDIR} is actually being used by prepending it to the normal
98# ${PATH}.  Thus, it's also available to outside utilities like doFS.sh.
99BOOTSTRAPDIR=	/bootstrap
100#
101# The mount subsystem has been changed between 2.2 and 3.0 by the
102# Lite2 import.
103BOOTSTRAPUTILS=	/sbin/mount /sbin/umount
104#
105# 3.0 cpio tries to reference lchown(2) which is not available in 2.2
106BOOTSTRAPUTILS+= /usr/bin/cpio
107
108.if !defined(CRUNCH_TARGETS)
109CRUNCH_TARGETS=	boot fixit
110.endif
111
112EXTRAS= cdrom.1 ftp.1
113
114.if !defined(NODOC)
115DOCREL= doc.1
116.endif
117
118REDO?=		sysinstall
119REDOSED=	sed -e 's/dirs/release.1/' -e 's/trees/release.2/' \
120		    -e 's/kerns/release.3/' -e 's/sysinstall/release.4/' \
121		    -e 's/fixup/release.5/' -e 's/tarbin/release.6/' \
122		    -e 's/tarsrc/release.7/' -e 's/boot\.flp/release.8/' \
123		    -e 's/fixit\.flp/release.9/' -e 's/ftp/ftp.1/' \
124		    -e 's/cdrom/cdrom.1/'
125
126REDOREDO!=	echo ${REDO} | ${REDOSED}
127
128rerelease release:
129.if !defined(CHROOTDIR) || !defined(BUILDNAME) || !defined(CVSROOT)
130	@echo "To make a release you must set CHROOTDIR, BUILDNAME and CVSROOT" && false
131.endif
132.if make(release)
133.if exists(${CHROOTDIR})
134# The first command will fail on a handful of files that have their schg
135# flags set.  But it greatly speeds up the next two commands.
136	-rm -rf ${CHROOTDIR}
137	-chflags -R noschg ${CHROOTDIR}/.
138	-rm -rf ${CHROOTDIR}
139.endif
140	-mkdir -p ${CHROOTDIR}
141	cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
142	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
143	cd ${.CURDIR}/.. && ${MAKE} install DESTDIR=${CHROOTDIR} NOMAN=1
144	mkdir ${CHROOTDIR}/${BOOTSTRAPDIR}
145	for i in ${BOOTSTRAPUTILS} ; do \
146		cp -p ${CHROOTDIR}$$i ${CHROOTDIR}/${BOOTSTRAPDIR} ; \
147	done
148.if !defined(RELEASETAG)
149	cd ${CHROOTDIR}/usr && rm -rf src && \
150		cvs -d ${CVSROOT} co -P ${RELEASESRCMODULE}
151.else
152	cd ${CHROOTDIR}/usr && rm -rf src && \
153		cvs -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
154.endif
155.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
156	cd ${CHROOTDIR}/usr/src && patch --silent < ${LOCAL_PATCHES}
157.endif
158.if defined(LOCAL_SCRIPT) && exists(${LOCAL_SCRIPT})
159	cd ${CHROOTDIR} && env CHROOTDIR=${CHROOTDIR} BUILDNAME=${BUILDNAME} RELEASETAG=${RELEASETAG} ${LOCAL_SCRIPT}
160.endif
161.if !defined(NOPORTS)
162	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && make readmes PORTSDIR=${CHROOTDIR}/usr/ports
163.endif
164.if !defined(NODOC)
165	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
166	cd ${CHROOTDIR}/usr/ports && for i in ${DOCPORTS}; do \
167	  (cd $$i; make fetch MASTER_SITE_OVERRIDE=file:/usr/ports/distfiles/ \
168	    DISTDIR=${CHROOTDIR}/usr/ports/distfiles ); \
169        done
170.endif
171.endif
172.if make(rerelease)
173.if !defined(RELEASENOUPDATE)
174.if !defined(RELEASETAG)
175	cd ${CHROOTDIR}/usr/src && cvs -q update -P -d
176.else
177	cd ${CHROOTDIR}/usr/src && cvs -q update -P -d -r ${RELEASETAG}
178.endif
179.if !defined(NOPORTS)
180	cd ${CHROOTDIR}/usr/ports && cvs -q update -P -d
181.endif
182.if !defined(NODOC)
183	cd ${CHROOTDIR}/usr/doc && cvs -q update -P -d
184.endif
185.endif
186.endif
187	# Add version information to those things that need it.
188	( cd ${CHROOTDIR}/usr/src/sys/conf && \
189	  mv newvers.sh foo && \
190	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh&& rm foo )
191	( cd ${CHROOTDIR}/usr/src/release/sysinstall && \
192	  sed "s/__RELEASE/${BUILDNAME}/" version.h > version.h.new && \
193	  mv version.h.new version.h && \
194	  echo XXXX )
195	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
196	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
197	echo "set -ex"				>> ${CHROOTDIR}/mk
198	echo "export CFLAGS='-O2 -pipe'"	>> ${CHROOTDIR}/mk
199	echo "export DISTRIBUTIONS=\"${DISTRIBUTIONS}\"" >> ${CHROOTDIR}/mk
200	echo "export BUILDNAME=${BUILDNAME}"	>> ${CHROOTDIR}/mk
201	echo "export VNDEVICE=${VNDEVICE}"	>> ${CHROOTDIR}/mk
202.if defined(RELEASETAG)
203	echo "export RELEASETAG=${RELEASETAG}"	>> ${CHROOTDIR}/mk
204.endif
205.if defined(NOPORTS)
206	echo "export NOPORTS=${NOPORTS}"	>> ${CHROOTDIR}/mk
207.endif
208.if defined(NODOC)
209	echo "export NODOC=${NODOC}"		>> ${CHROOTDIR}/mk
210.endif
211.if defined(ALLLANG)
212	echo "export ALLLANG=${ALLLANG}"	>> ${CHROOTDIR}/mk
213.endif
214.if defined(NOSRC)
215	echo "export NOSRC=${NOSRC}"		>> ${CHROOTDIR}/mk
216.endif
217.if defined(NOSHARED)
218	echo "export NOSHARED=${NOSHARED}"	>> ${CHROOTDIR}/mk
219.endif
220.if defined(BOOT_CONFIG)
221	echo "export BOOT_CONFIG=\"${BOOT_CONFIG}\"">> ${CHROOTDIR}/mk
222.endif
223	# Don't remove this, or the build will fall over!
224	echo "export RELEASEDIR=/R"		>> ${CHROOTDIR}/mk
225	echo "export PATH=${BOOTSTRAPDIR}:$${PATH}:${LOCALDIR}" >> ${CHROOTDIR}/mk
226	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
227.if make(release)
228	# This eases bootstrapping from a more recent hosting environment:
229	echo "mkdir -p /usr/lib/compat"		>> ${CHROOTDIR}/mk
230	echo "chflags noschg /usr/lib/lib*.so.*" >> ${CHROOTDIR}/mk
231	echo "mv /usr/lib/lib*.so.* /usr/lib/compat" >> ${CHROOTDIR}/mk
232	echo "(cd include; make all install)"   >> ${CHROOTDIR}/mk
233	echo "(cd etc; make distrib-dirs distribution)" >> ${CHROOTDIR}/mk
234	echo "make world"			>> ${CHROOTDIR}/mk
235	echo "(cd etc; make distribution)"	>> ${CHROOTDIR}/mk
236	# Now we've got our own shared libs, remove the bootstrapping
237	# libs again.
238	echo "rm -f /usr/lib/compat/*"		>> ${CHROOTDIR}/mk
239.endif
240.if make(rerelease)
241	echo "make all install"			>> ${CHROOTDIR}/mk
242.endif
243	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
244	echo "make obj"				>> ${CHROOTDIR}/mk
245	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
246	echo "make objlink"			>> ${CHROOTDIR}/mk
247	echo "(cd obj; rm -f ${REDOREDO})"	>> ${CHROOTDIR}/mk
248	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
249	echo "echo make ${.TARGET} Finished"	>> ${CHROOTDIR}/mk
250	chmod 755 ${CHROOTDIR}/mk
251	chroot ${CHROOTDIR} /mk
252
253clean:
254	rm -rf boot_crunch release.[0-9]
255
256# Clean out /R and make the directory structure.
257release.1:
258	-mkdir /R
259	chflags -R noschg /R/.
260	rm -rf /R/*
261	mkdir ${RD}
262	mkdir ${RD}/floppies
263	mkdir ${RD}/trees
264	mkdir ${RD}/dists
265	mkdir ${RD}/kernels
266	for i in ${DISTRIBUTIONS} ; do \
267		mkdir ${RD}/trees/$$i && \
268		mkdir ${RD}/dists/$$i && \
269		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
270		    -p ${RD}/trees/$$i > /dev/null && \
271		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
272		    -p ${RD}/trees/$$i/usr > /dev/null && \
273		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
274		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
275		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
276		    -p ${RD}/trees/$$i/var > /dev/null ; \
277	done
278	touch release.1
279
280# Install the system into the various distributions.
281release.2:
282	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
283	cd ${.CURDIR}/.. && make distribute DISTDIR=${RD}/trees
284.if exists(${.CURDIR}/../kerberosIV) && !defined(NOKERBEROS)
285	cd ${.CURDIR}/../kerberosIV && ( \
286		make bootstrap &&\
287		make obj all help-distribute DISTDIR=${RD}/trees &&\
288		make kprog \
289	)
290.endif
291	chflags -R noschg ${RD}/trees
292	touch release.2
293
294# Make and install the generic kernel(s).
295release.3:
296.for kernel in ${KERNELS}
297	rm -f ${RD}/kernels/${kernel}
298	rm -rf ${.CURDIR}/../sys/compile/${kernel}
299	cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=${kernel}
300	rm -rf ${.CURDIR}/../sys/compile/${kernel}
301	ln -f ${RD}/kernels/${kernel} ${RD}/trees/bin/kernel.${kernel}
302.endfor
303	touch release.3
304
305# Make and install the three crunched binaries which live on the floppies.
306# You are not supposed to like this :-)
307#
308# NB: the "RELEASE_BUILD_FIXIT" magic prevents vi from including the
309# Tcl and Perl APIs.  See also /usr/src/usr.bin/vi/Makefile.
310release.4:
311	@mkdir -p /stand
312	cd ${.CURDIR}/sysinstall && make obj depend all install
313	rm -rf ${RD}/crunch
314	mkdir -p ${RD}/crunch
315	export RELEASE_BUILD_FIXIT=noway ; \
316	for j in ${CRUNCH_TARGETS} ; do \
317		rm -rf $${j}_crunch && \
318		mkdir $${j}_crunch && \
319		( cd $${j}_crunch && \
320		  crunchgen ${.CURDIR}/$${j}_crunch.conf && \
321		  ${MAKE} -DRELEASE_CRUNCH -f $${j}_crunch.mk subclean all \
322		    NOCRYPT=yes "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
323		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
324		true || { rm -rf $${j}_crunch ; false ; } ; \
325	done
326	touch release.4
327
328#
329# --==## Fix up the distributions. ##==--
330#
331release.5:
332	# Handle some grief caused by the munition braindeadness.
333	for i in sbin/init bin/ed usr.sbin/ppp ; do \
334		( cd ${.CURDIR}/../$$i; \
335		  make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
336	done
337
338	# Create any "synthetic dists" now.
339	@for i in ${DISTRIBUTIONS}; do \
340		if [ -f ${.CURDIR}/scripts/$${i}-make.sh ]; then \
341			echo -n "Running $$i dist creation script... "; \
342			env OBJFORMAT=${OBJFORMAT} RD=${RD} sh ${.CURDIR}/scripts/$${i}-make.sh || echo "$$i distribution script returned bad status."; \
343			echo "Done."; \
344		fi \
345	done \
346
347	# Create symlinks for the MD5-based crypt lib, too.  The
348	# automatically created links still point to the DES stuff,
349	# which went into its own distribution.
350	for i in ${RD}/trees/bin/usr/lib/${OBJFORMAT}/libscrypt* ; do \
351		c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \
352		rm -f $$c ; \
353		ln -s `basename $$i` $$c ; \
354	done
355
356	# Remove all the directories we don't need.
357	-cd ${RD}/trees && \
358		find ${OTHER_DISTS} ${COMPAT_DISTS} ${CRYPTO_DISTS} -depth -type d -print | xargs rmdir
359	touch release.5
360
361#
362# --==## Package up the tarballs from assembled trees ##==--
363#
364release.6:
365	rm -rf ${RD}/dists
366	mkdir -p ${RD}/dists
367	@for i in ${DISTRIBUTIONS} ; \
368	do \
369		if [ -d ${RD}/trees/$${i} ] ; then \
370			cd ${.CURDIR} && $(MAKE) doTARBALL \
371				SD=${RD}/trees/$${i} \
372				TN=$$i TD=$$i ARG="." && \
373			echo "$${i} distribution is finished."; \
374		fi ; \
375	done
376	# More munition braindeadness.
377	( cd ${RD}/dists && \
378		if [ -f krb/krb.aa ] ; then mv krb/* des && rmdir krb ; fi )
379	touch release.6
380
381
382#
383# --==## Make source dists ##==--
384#
385release.7:
386.if !defined(NOSRC)
387	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
388		TD=src TN=sbase ARG="[A-Z]*"
389	@for i in `cd /usr/src && echo [a-z]*` ; do \
390		if [ -d /usr/src/$$i ] ; then \
391			cd ${.CURDIR} && $(MAKE) doTARBALL \
392				TN=`echo s$$i | tr -d '.' | sed 's/usr/u/'` \
393				SD=/usr/src TD=src ARG="$$i" ; \
394		fi ; \
395	done
396.if defined(EXTRA_SRC)
397	@set ${EXTRA_SRC} && \
398	while [ $$# -ge 2 ] ; do \
399		if [ -d /usr/src/$$1 ] ; then \
400			cd ${.CURDIR} && $(MAKE) doTARBALL \
401				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
402		fi && shift && shift ; \
403	done
404.endif
405	( cd ${RD}/dists/src && \
406		if [ -f ssecure.aa ] ; then mv ssecure.* ../des ; fi && \
407		if [ -f scrypto.aa ] ; then mv scrypto.* ../des ; fi && \
408		if [ -f skerbero.aa ] ; then mv skerbero.* ../des ; fi ; )
409	@echo "src distribution is finished."
410.endif
411	touch release.7
412
413# Complete the bootfd
414#
415# Now, just to get this picture down once and for all:
416#
417# +------------------------------------------------------------------------+
418# |boot.flp                                                                |
419# +-----+-----+------------------------------------------------------------+
420# |boot1|boot2|floppy filesystem "bootfd"                                  |
421# +-----+-----+-+--------------------------------------------------------+-+
422#               |kernel                                                  |
423#               +------------+-----------------------------------------+-+
424#                            |mfs filesystem "mfsfd"                   |
425#                            +-----------------------------------------+
426#
427
428release.8: write_mfs_in_kernel dumpnlist
429	rm -rf ${RD}/mfsfd
430	mkdir ${RD}/mfsfd
431	cd ${RD}/mfsfd && \
432		mkdir -p etc dev mnt stand/help
433	@cp ${.CURDIR}/../sys/i386/boot/biosboot/boot.help ${RD}/mfsfd/stand
434	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
435		DIR=${RD}/mfsfd/stand ZIP=false
436	( cd ${RD}/trees/bin/dev && \
437		ls console tty ttyv0 ttyv1 ttyv2 ttyv3 null zero | \
438	cpio -dump ${RD}/mfsfd/dev )
439	( cd ${RD}/mfsfd/dev && rm -f *[swo]d*[bdefgh] )
440	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
441	echo "nameserver      42/tcp name"	> ${RD}/mfsfd/stand/etc/services
442	echo "ftp             21/tcp"		>> ${RD}/mfsfd/stand/etc/services
443	echo "domain          53/tcp          nameserver" >> ${RD}/mfsfd/stand/etc/services
444	echo "domain          53/udp          nameserver" >> ${RD}/mfsfd/stand/etc/services
445	echo "cmd             514/tcp    shell" >> ${RD}/mfsfd/stand/etc/services
446	gzip -c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
447	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
448	@echo "Making the regular boot floppy."
449	tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
450		tar xvf - -C ${RD}/mfsfd/stand
451	@echo "Compressing doc files..."
452	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
453	sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${BOOTMFSSIZE} ${RD}/mfsfd \
454		${MFSINODE} minimum
455	mv fs-image fs-image.std
456	mv fs-image.size fs-image.std.size
457	cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=std
458	mv ${RD}/floppies/bootstd.flp ${RD}/floppies/boot.flp
459	@echo "Regular boot floppy made."
460	touch release.8
461
462#
463# --==## Create a fixit floppy ##==--
464#
465release.9:
466	rm -rf ${RD}/fixitfd
467	mkdir ${RD}/fixitfd
468	cd ${RD}/fixitfd && \
469		mkdir -p dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp \
470		usr/share/misc usr/mdec
471	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
472		DIR=${RD}/fixitfd/stand ZIP=false
473	( cd ${RD}/fixitfd/dev && \
474		sed -e '/^PATH/s/^/#/' ${RD}/trees/bin/dev/MAKEDEV > MAKEDEV && \
475		chmod 755 MAKEDEV && \
476		sh MAKEDEV all )
477	cp ${RD}/trees/bin/etc/spwd.db ${RD}/trees/bin/etc/group \
478		${RD}/trees/bin/etc/protocols ${RD}/fixitfd/etc
479	cp ${RD}/trees/bin/usr/share/misc/scsi_modes \
480		${RD}/fixitfd/usr/share/misc
481	cp ${RD}/trees/bin/usr/mdec/boot[12] ${RD}/fixitfd/usr/mdec
482	for type in fd od sd wd ; do \
483		( cd ${RD}/fixitfd/usr/mdec && ln -s boot1 $${type}boot && \
484			ln -s boot2 boot$${type} ) ; \
485	done
486	cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
487	cp ${.CURDIR}/fixit.services ${RD}/fixitfd/etc/services
488	cp ${.CURDIR}/tar.sh ${RD}/fixitfd/stand/tar
489	chmod 555 ${RD}/fixitfd/stand/tar
490	sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${FDSIZE} ${RD}/fixitfd \
491		${FIXITINODE} ${FDLABEL}
492	mv fs-image ${RD}/floppies/fixit.flp
493# Do our last minute floppies directory setup in a convenient place.
494	cp ${.CURDIR}/README.TXT ${RD}/floppies/README.TXT
495	@(cd ${RD}/floppies; md5 * > CHECKSUM.MD5)
496	touch release.9
497
498#
499# --==## Setup a suitable ftp-area ##==--
500#
501ftp.1:
502	mkdir -p ${FD}
503	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
504	cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
505	cp ${.CURDIR}/ABOUT.TXT ${FD}/ABOUT.TXT
506	cp ${.CURDIR}/ERRATA.TXT ${FD}/ERRATA.TXT
507	cp ${.CURDIR}/LAYOUT.TXT ${FD}/LAYOUT.TXT
508	cp ${.CURDIR}/sysinstall/help/readme.hlp ${FD}/README.TXT
509	cp ${.CURDIR}/sysinstall/help/hardware.hlp ${FD}/HARDWARE.TXT
510	cp ${.CURDIR}/sysinstall/help/install.hlp ${FD}/INSTALL.TXT
511	cp ${.CURDIR}/sysinstall/help/relnotes.hlp ${FD}/RELNOTES.TXT
512	cp ${.CURDIR}/sysinstall/help/trouble.hlp ${FD}/TROUBLE.TXT
513	cp ${.CURDIR}/sysinstall/help/upgrade.hlp ${FD}/UPGRADE.TXT
514
515	echo "CD_VERSION = ${BUILDNAME}" > ${FD}/cdrom.inf
516.if !defined(NOPORTS)
517	tar -cBf - -C ${CD_DISC1} ports | tar -xBf - -C ${FD}
518.endif
519
520#
521# --==## Setup a suitable cdrom-area ##==--
522#
523cdrom.1:
524	mkdir -p ${CD_DISC1} ${CD_DISC2}
525	cd ${RD} && find floppies -print | cpio -dumpl ${CD_DISC1}
526	cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DISC1}
527	ln -f ${RD}/kernels/MFSKERNEL.std ${CD_DISC1}/kernel
528	ln -f ${RD}/trees/bin/usr/mdec/fbsdboot.exe ${CD_DISC1}
529	for i in ${DISTRIBUTIONS} ; \
530	do \
531		if [ -d ${RD}/trees/$${i} ] ; then \
532			chflags -R noschg ${RD}/trees/$${i} ; \
533			( cd ${RD}/trees/$${i} && \
534			find . -depth -print | cpio -dumpl ${CD_DISC2} ) ; \
535		fi \
536	done
537	rm -f ${CD_DISC2}/.profile
538	cp ${.CURDIR}/fixit.profile ${CD_DISC2}/.profile
539	echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC1}/cdrom.inf
540	echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC2}/cdrom.inf
541	cp ${.CURDIR}/ABOUT.TXT ${CD_DISC1}/ABOUT.TXT
542	cp ${.CURDIR}/ERRATA.TXT ${CD_DISC1}/ERRATA.TXT
543	cp ${.CURDIR}/LAYOUT.TXT ${CD_DISC1}/LAYOUT.TXT
544	cp ${.CURDIR}/sysinstall/help/readme.hlp ${CD_DISC1}/README.TXT
545	cp ${.CURDIR}/sysinstall/help/hardware.hlp ${CD_DISC1}/HARDWARE.TXT
546	cp ${.CURDIR}/sysinstall/help/install.hlp ${CD_DISC1}/INSTALL.TXT
547	cp ${.CURDIR}/sysinstall/help/relnotes.hlp ${CD_DISC1}/RELNOTES.TXT
548	cp ${.CURDIR}/sysinstall/help/trouble.hlp ${CD_DISC1}/TROUBLE.TXT
549	cp ${.CURDIR}/sysinstall/help/upgrade.hlp ${CD_DISC1}/UPGRADE.TXT
550
551.if !defined(NOPORTS)
552	-rm -rf /usr/ports/distfiles/*
553	tar -cBf - -C /usr ports | tar xBpf - -C ${CD_DISC2} && \
554	  mkdir -p ${CD_DISC1}/ports && \
555	  tar -czf ${CD_DISC1}/ports/ports.tgz -C /usr ports && \
556	  cp ${.CURDIR}/scripts/ports-install.sh ${CD_DISC1}/ports/install.sh && \
557		(cd ${CD_DISC1}/ports; md5 * > CHECKSUM.MD5)
558	ln -s ../ports ${CD_DISC2}/usr/ports
559.endif
560
561doc.1:
562	for i in ${DOCPORTS}; do \
563	  cd /usr/ports/$$i && make all install clean FORCE_PKG_REGISTER=yes; \
564	done
565	cd /usr/doc && make all distribute DISTDIR=${RD}/trees
566
567# Various "subroutine" and other supporting targets.
568
569doTARBALL:
570.if !defined(SD)
571	@echo "SD undefined in doTARBALL" && exit 1
572.endif
573.if !defined(TD)
574	@echo "TB undefined in doTARBALL" && exit 1
575.endif
576.if !defined(ARG)
577	@echo "ARG undefined in doTARBALL" && exit 1
578.endif
579	rm -rf ${RD}/dists/${TD}/${TN}*
580	mkdir -p ${RD}/dists/${TD}
581	( cd ${SD} && \
582		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
583		echo rolling ${TD}/$$tn tarball &&\
584		tar --exclude CVS --exclude obj --exclude BOOTMFS -cf - ${ARG} | \
585		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
586		sh ${.CURDIR}/info.sh ${RD}/dists/${TD}/$$tn > \
587		   ${RD}/dists/${TD}/$$tn.inf && \
588		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
589		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
590		fi && \
591		if [ "${SD}" != "/usr/src" ]; then \
592			mtree -c -i -p ${SD}/${ARG} \
593			  -k gname,md5digest,mode,nlink,uname,size,link,type \
594			  > ${RD}/dists/${TD}/$$tn.mtree ; \
595		else \
596			true; \
597		fi; \
598		(cd ${RD}/dists/${TD}; \
599		   rm -f CHECKSUM.MD5; \
600		   md5 * > CHECKSUM.MD5) \
601	)
602
603.if ${MACHINE_ARCH} == "i386"
604doRELEASE:  release.1 release.2 ${DOCREL} release.3 release.4 release.5 \
605		release.6 release.7 release.8 release.9
606	cd ${.CURDIR} && ${MAKE} ${EXTRAS}
607	@echo "Release done"
608.endif
609
610.if ${MACHINE_ARCH} == "alpha"
611doRELEASE:  release.1 release.2 ${DOCREL} release.5 release.6 release.7
612	cd ${.CURDIR} && ${MAKE} ${EXTRAS}
613	@echo "Release done"
614.endif
615
616floppies:
617	cd ${.CURDIR} && ${MAKE} boot.flp
618	cd ${.CURDIR} && ${MAKE} fixit.flp
619	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
620
621boot.flp:
622	rm -f release.4 release.8
623	cd ${.CURDIR} && ${MAKE} release.4 release.8 CRUNCH_TARGETS=boot
624
625fixit.flp:
626	rm -f release.4 release.9
627	cd ${.CURDIR} && ${MAKE} release.4 release.9 CRUNCH_TARGETS=fixit
628
629write_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
630	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
631
632dumpnlist:	${.CURDIR}/dumpnlist.c
633	${CC} ${CFLAGS} -o dumpnlist ${.CURDIR}/dumpnlist.c
634
635installCRUNCH:
636.if !defined(CRUNCH)
637	@echo "CRUNCH undefined in installCRUNCH" && exit 1
638.endif
639.if !defined(DIR)
640	@echo "DIR undefined in installCRUNCH" && exit 1
641.endif
642.if !defined(ZIP)
643	@echo "ZIP undefined in installCRUNCH" && exit 1
644.endif
645	if ${ZIP} ; then \
646		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
647	else \
648		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
649	fi
650	chmod 555 ${DIR}/${CRUNCH}_crunch
651	for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
652		ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
653	done
654
655#
656# --==## Compile a kernel by name ${KERNEL} ##==--
657#
658# We don't erase the sys/compile/${KERNEL} directory, since somebody
659# may want to reuse it (release.8 presently)
660#
661doKERNEL:
662	rm -f ${RD}/kernels/${KERNEL}
663	cd ${.CURDIR}/../sys/i386/conf && config ${KERNEL}
664	cd ${.CURDIR}/../sys/compile/${KERNEL} && \
665			make  depend && \
666			make  kernel && \
667			cp kernel ${RD}/kernels/${KERNEL}
668
669#
670# --==## Put a filesystem into a BOOTMFS kernel ##==--
671#
672doMFSKERN:
673	@rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
674	@rm -f /sys/compile/BOOTMFS/mfs_vfsops.o
675	@cd ${.CURDIR}/../sys/i386/conf && \
676	  sed	-e '/pty/d' \
677		-e '/PROCFS/d' \
678		-e '/SYSVSHM/d' \
679		-e '/KTRACE/d' \
680		-e '/MATH_EMULATE/d' \
681		-e 's/GENERIC/BOOTMFS/g' \
682		-e '/maxusers/s/10/4/' < GENERIC > BOOTMFS && \
683	  echo "options  MFS" >> BOOTMFS && \
684	  echo "options  NFS_NOSERVER" >> BOOTMFS && \
685	  echo 'options  "MAXCONS=4"' >> BOOTMFS && \
686	  echo "options  USERCONFIG_BOOT" >> BOOTMFS
687	@echo "options \"MFS_ROOT=`cat fs-image.${FSIMAGE}.size`\"" >> \
688	  ${.CURDIR}/../sys/i386/conf/BOOTMFS
689	cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS
690	@rm -rf ${RD}/boot.${FSIMAGE}
691	@mkdir  ${RD}/boot.${FSIMAGE}
692	@mv ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
693	@cp ${RD}/kernels/BOOTMFS.${FSIMAGE} ${RD}/boot.${FSIMAGE}/kernel
694.if defined(BOOT_CONFIG)
695	@echo "${BOOT_CONFIG}" >${RD}/boot.${FSIMAGE}/boot.config
696.endif
697	@vnconfig /dev/${VNDEVICE} fs-image.${FSIMAGE}
698	@mkdir -p /tmp/mnt_xx
699	@mount /dev/${VNDEVICE} /tmp/mnt_xx
700	./dumpnlist ${RD}/boot.${FSIMAGE}/kernel > /tmp/mnt_xx/stand/symbols
701	@umount /tmp/mnt_xx
702	@vnconfig -u /dev/${VNDEVICE}
703	@rmdir /tmp/mnt_xx
704	./write_mfs_in_kernel ${RD}/boot.${FSIMAGE}/kernel \
705		fs-image.${FSIMAGE}
706	kzip -v ${RD}/boot.${FSIMAGE}/kernel
707	@mv ${RD}/boot.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
708	@mv ${RD}/boot.${FSIMAGE}/kernel.kz ${RD}/boot.${FSIMAGE}/kernel
709	@cp ${.CURDIR}/../sys/i386/boot/biosboot/boot.help ${RD}/boot.${FSIMAGE}
710	@printf \a\a\a >> ${RD}/boot.${FSIMAGE}
711	@touch ${RD}/boot.${FSIMAGE}/boot.config
712	@touch ${RD}/boot.${FSIMAGE}/kernel.config
713	@rm -f ${RD}/floppies/boot${FSIMAGE}.flp
714	sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${FDSIZE} ${RD}/boot.${FSIMAGE} \
715		${BOOTINODE} ${FDLABEL}
716	mv fs-image ${RD}/floppies/boot${FSIMAGE}.flp
717
718.include <bsd.prog.mk>
719