xref: /freebsd/release/Makefile (revision 30548b45b9f1c06b730ff05c1fe483325f694110)
1#	$Id: Makefile,v 1.239 1996/09/26 20:48:03 pst Exp $
2#
3# How to roll a release:
4#
5#	make release CHROOTDIR=<lots of disk> [ RELEASETAG=something ]
6#
7# As far as I know, this will roll everything nicely into the "stage"
8# directory.  I still need to write the two rules to move that into
9# the "cdrom" and "ftp" directories.
10# I also need to "make ports" and install those, but I'm not going to do
11# that on a 14.4 line just yet...
12#
13# SET THIS !!!
14#BUILDNAME=2.2-960501-SNAP
15#CHROOTDIR=/junk/release
16# If this is a RELEASE, then set
17#RELEASETAG=RELENG_2_1_0
18
19# Things which without too much trouble can be considered variables
20
21EXPORT_DISTS=	games manpages proflibs dict info doc
22EXTRA_DISTS=	krb des ${EXPORT_DISTS}
23ALL_DISTS=	bin ${EXTRA_DISTS}
24KERNELS?=	GENERIC
25
26# Extra source tarballs; each argument is a pair of source dir and
27# distribution name.  The dist name should not exceed 7 characters
28# (another "s" for "source" will be prepended).
29EXTRA_SRC+=	usr.sbin/sendmail/cf smailcf
30
31BOOT1=	etc/protocols etc/sysconfig
32
33# mountpoint for filesystems.
34MNT=			/mnt
35
36# other floppy parameters.
37FDSIZE=			1200
38FDLABEL=		fd1200
39
40ZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
41
42# Upper size for the mfs in the boot.flp kernel.
43# These are adjusted down to the minimum needed by doFS.sh.
44BOOTMFSSIZE=		1200
45MFSINODE=		42000
46
47# Things which will get you into trouble if you change them
48DISTRIBUTIONS=		bin ${EXTRA_DISTS}
49MTREEFILES=		${.CURDIR}/../etc/mtree
50RD=			${RELEASEDIR}/stage
51FD=			${RELEASEDIR}/ftp
52CD=			${RELEASEDIR}/cdrom
53
54.if !defined(WHICH_CRUNCH)
55WHICH_CRUNCH=	boot fixit
56.endif
57
58REDO?=		sysinstall
59REDOSED=	sed -e 's/dirs/release.1/' -e 's/trees/release.2/' \
60		    -e 's/kerns/release.3/' -e 's/sysinstall/release.4/' \
61		    -e 's/fixup/release.5/' -e 's/tarbin/release.6/' \
62		    -e 's/tarsrc/release.7/' -e 's/boot\.flp/release.8/' \
63		    -e 's/fixit\.flp/release.9/' -e 's/ftp/ftp.1/' \
64		    -e 's/cdrom/cdrom.1/'
65
66REDOREDO!=	echo ${REDO} | ${REDOSED}
67
68rerelease release:
69.if !defined(CHROOTDIR) || !defined(BUILDNAME)
70	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
71.endif
72.if make(release)
73.if exists(${CHROOTDIR})
74	chflags -R noschg ${CHROOTDIR}/.
75	-rm -rf ${CHROOTDIR}
76.endif
77	-mkdir -p ${CHROOTDIR}
78	cd ${.CURDIR}/../etc && ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
79	cd ${.CURDIR}/../etc && ${MAKE} distribution DESTDIR=${CHROOTDIR}
80	cd ${.CURDIR}/.. && ${MAKE} install DESTDIR=${CHROOTDIR}
81.if !defined(RELEASETAG)
82	cd ${CHROOTDIR}/usr && rm -rf src && \
83		cvs -d ${CVSROOT} co -P src
84.if defined(INTCVSROOT)
85	cd ${CHROOTDIR}/usr && \
86	    cvs -d ${INTCVSROOT} co -P src/secure src/eBones
87.endif
88.else
89	cd ${CHROOTDIR}/usr && rm -rf src && \
90		cvs co -d ${CVSROOT} -P -r ${RELEASETAG} src
91.if defined(INTCVSROOT)
92	cd ${CHROOTDIR}/usr && \
93	    cvs -d ${INTCVSROOT} co -P -r ${RELEASETAG} src/secure src/eBones
94.endif
95.endif
96.if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
97	cd ${CHROOTDIR}/usr/src && patch --silent < ${LOCAL_PATCHES}
98.endif
99.endif
100.if make(rerelease)
101.if !defined(RELEASENOUPDATE)
102.if !defined(RELEASETAG)
103	cd ${CHROOTDIR}/usr/src && cvs -q update -P -d
104.else
105	cd ${CHROOTDIR}/usr/src && cvs -q update -P -d -r ${RELEASETAG}
106.endif
107.endif
108.endif
109	( cd ${CHROOTDIR}/usr/src/sys/conf && \
110	  mv newvers.sh foo && \
111	  sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh&& rm foo )
112	( cd ${CHROOTDIR}/usr/src/release/sysinstall && \
113	  sed "s/__RELEASE/${BUILDNAME}/" version.h > version.h.new && \
114	  mv version.h.new version.h && \
115	  echo XXXX )
116	-test -f install.cfg && cp install.cfg ${CHROOTDIR}/usr/src/release
117	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
118	echo "set -ex"				>> ${CHROOTDIR}/mk
119	echo "CFLAGS='-O2 -pipe'"		>> ${CHROOTDIR}/mk
120	echo "export CFLAGS"			>> ${CHROOTDIR}/mk
121	echo "RELEASEDIR=/R"			>> ${CHROOTDIR}/mk
122	echo "export RELEASEDIR"		>> ${CHROOTDIR}/mk
123	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
124.if make(release)
125	echo "make world"			>> ${CHROOTDIR}/mk
126.endif
127.if make(rerelease)
128	echo "make all install"			>> ${CHROOTDIR}/mk
129.endif
130	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
131	echo "make obj OBJLINK=yes"		>> ${CHROOTDIR}/mk
132	echo "cd obj"                           >> ${CHROOTDIR}/mk
133	echo "rm -f ${REDOREDO}"                >> ${CHROOTDIR}/mk
134	echo "cd /usr/src/release"              >> ${CHROOTDIR}/mk
135	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
136	echo "echo make ${.TARGET} Finished"	>> ${CHROOTDIR}/mk
137	chmod 755 ${CHROOTDIR}/mk
138	chroot ${CHROOTDIR} /mk
139
140whap:
141	( cd ${CHROOTDIR}/usr/src/release/sysinstall && \
142	  sed "s/__RELEASE/${BUILDNAME}/" version.h > version.h.new && mv version.h.new version.h )
143
144clean:
145	rm -rf boot_crunch release.[0-9] release.1[0]
146
147# Clean out ${RELEASEDIR} and make the directory structure.
148release.1:
149	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
150	-mkdir ${RELEASEDIR}
151	chflags -R noschg ${RELEASEDIR}/.
152	rm -rf ${RELEASEDIR}/*
153	mkdir ${RD}
154	mkdir ${RD}/floppies
155	mkdir ${RD}/trees
156	mkdir ${RD}/dists
157	mkdir ${RD}/kernels
158	for i in ${ALL_DISTS} ; do \
159		mkdir ${RD}/trees/$$i && \
160		mkdir ${RD}/dists/$$i && \
161		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
162		    -p ${RD}/trees/$$i > /dev/null && \
163		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
164		    -p ${RD}/trees/$$i/usr > /dev/null && \
165		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
166		    -p ${RD}/trees/$$i/usr/include > /dev/null && \
167		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
168		    -p ${RD}/trees/$$i/var > /dev/null ; \
169	done
170	touch release.1
171
172# Install the system into the various distributions.
173release.2:
174	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
175	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
176	cd ${.CURDIR}/.. && make distribute DISTDIR=${RD}/trees
177.if exists(${.CURDIR}/../eBones)
178	cd ${.CURDIR}/../eBones && ( \
179		make bootstrap &&\
180		make obj all help-distribute DISTDIR=${RD}/trees &&\
181		make kprog \
182	)
183.endif
184	chflags -R noschg ${RD}/trees
185	touch release.2
186
187# Make and install the generic kernel(s).
188release.3:
189	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
190.for kernel in ${KERNELS}
191	rm -f ${RD}/kernels/${kernel}
192	rm -rf ${.CURDIR}/../sys/compile/${kernel}
193	cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=${kernel}
194	rm -rf ${.CURDIR}/../sys/compile/${kernel}
195	ln -f ${RD}/kernels/${kernel} ${RD}/trees/bin/kernel.${kernel}
196.endfor
197	touch release.3
198
199# Make and install the three crunched binaries which live on the floppies.
200# You are not supposed to like this :-)
201release.4:
202	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
203	cd ${.CURDIR}/sysinstall && make depend all \
204	  KERNEL_NAME=${RD}/kernels/BOOTMFS.std
205	rm -rf ${RD}/crunch
206	mkdir -p ${RD}/crunch
207	for j in ${WHICH_CRUNCH} ; do \
208		rm -rf $${j}_crunch && \
209		mkdir $${j}_crunch && \
210		( cd $${j}_crunch && \
211		crunchgen ${.CURDIR}/$${j}_crunch.conf && \
212		${MAKE} -f $${j}_crunch.mk all NOCRYPT=yes \
213		    "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
214		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
215		true || rm -rf $${j}_crunch ; \
216	done
217	touch release.4
218
219#
220# --==## Fix up the distributions. ##==--
221#
222release.5:
223	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
224	# Handle some grief caused by the ammunition braindeadness.
225	for i in sbin/init bin/ed ; do \
226		( cd ${.CURDIR}/../$$i; \
227		  make -DNOCRYPT clean all distribute DISTDIR=${RD}/trees ) ; \
228	done
229
230	# Move all the manpages out to their own dist
231	if [ -d ${RD}/trees/bin/usr/share/man ] ; then \
232		tar -cf - -C ${RD}/trees/bin/usr/share/man . | \
233			tar xf - -C ${RD}/trees/manpages/usr/share/man && \
234		rm -rf ${RD}/trees/bin/usr/share/man; \
235	fi
236	# Move all the games out to their own dist
237	if [ -d ${RD}/trees/bin/usr/games ] ; then \
238		tar -cf - -C ${RD}/trees/bin/usr/games . | \
239			tar -xf - -C ${RD}/trees/games/usr/games && \
240		rm -rf ${RD}/trees/bin/usr/games; \
241	fi
242	if [ -d ${RD}/trees/bin/usr/share/games ] ; then \
243		tar -cf - -C ${RD}/trees/bin/usr/share/games . | \
244			tar -xf - -C ${RD}/trees/games/usr/share/games && \
245		rm -rf ${RD}/trees/bin/usr/share/games; \
246	fi
247	if [ -d ${RD}/trees/bin/var/games ] ; then \
248		tar -cf - -C ${RD}/trees/bin/var/games . | \
249			tar -xf - -C ${RD}/trees/games/var/games && \
250		rm -rf ${RD}/trees/bin/var/games; \
251	fi
252	# Move the dict out to their own dist
253	if [ -d ${RD}/trees/bin/usr/share/dict ] ; then \
254		tar -cf - -C ${RD}/trees/bin/usr/share/dict . | \
255			tar -xf - -C ${RD}/trees/dict/usr/share/dict && \
256		rm -rf ${RD}/trees/bin/usr/share/dict; \
257	fi
258	for i in airport birthtoken flowers na.phone zipcodes ; do \
259		if [ -f ${RD}/trees/bin/usr/share/misc/$$i ] ; then \
260			mv ${RD}/trees/bin/usr/share/misc/$$i \
261				${RD}/trees/dict/usr/share/misc; \
262		fi ; \
263	done
264	# Move the info files out to their own dist
265	if [ -d ${RD}/trees/bin/usr/share/info ] ; then \
266		tar -cf - -C ${RD}/trees/bin/usr/share/info . | \
267			tar -xf - -C ${RD}/trees/info/usr/share/info && \
268		rm -rf ${RD}/trees/bin/usr/share/info; \
269	fi
270	# Move the profiled libraries out to their own dist
271	for i in ${RD}/trees/bin/usr/lib/*_p.a ; do \
272		if [ -f $$i ] ; then \
273			mv $$i \
274				${RD}/trees/proflibs/usr/lib ; \
275		fi ; \
276	done
277	# Create symlinks for the MD5-based crypt lib, too.  The
278	# automatically created links still point to the DES stuff,
279	# which went into its own distribution.
280	for i in ${RD}/trees/bin/usr/lib/libscrypt* ; do \
281		c=`echo $$i | sed -e 's/libscrypt/libcrypt/'` ; \
282		rm -f $$c ; \
283		ln -s `basename $$i` $$c ; \
284	done
285
286	# Remove some files we can faster regen after installing.
287	cd ${RD}/trees/bin/usr/share/misc && rm -f termcap.db vgrindefs.db
288	# Remove all the directories we don't need.
289	-cd ${RD}/trees && \
290		find ${EXTRA_DISTS} -depth -type d -print | xargs rmdir
291	touch release.5
292
293#
294# --==## Make binary dists ##==--
295#
296release.6:
297	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
298	rm -rf ${RD}/dists
299	mkdir -p ${RD}/dists
300	@for i in ${DISTRIBUTIONS} ; \
301	do \
302		if [ -d ${RD}/trees/$${i} ] ; then \
303			cd ${.CURDIR} && $(MAKE) doTARBALL \
304				SD=${RD}/trees/$${i} \
305				TN=$$i TD=$$i ARG="." && \
306			echo "$${i} distribution is finished."; \
307		fi ; \
308	done
309	( cd ${RD}/dists && \
310		if [ -f krb/krb.aa ] ; then mv krb/* des && rmdir krb ; fi )
311	touch release.6
312
313
314#
315# --==## Make source dists ##==--
316#
317release.7:
318	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
319	@cd ${.CURDIR} && $(MAKE) doTARBALL SD=/usr/src \
320		TD=src TN=sbase ARG="[A-Z]*"
321	@for i in `cd /usr/src && echo [a-z]*` ; do \
322		if [ -d /usr/src/$$i ] ; then \
323			cd ${.CURDIR} && $(MAKE) doTARBALL \
324				TN=`echo s$$i | tr -d '.' | sed 's/usr/u/'` \
325				SD=/usr/src TD=src ARG="$$i" ; \
326		fi ; \
327	done
328.if defined(EXTRA_SRC)
329	@set ${EXTRA_SRC} && \
330	while [ $$# -ge 2 ] ; do \
331		if [ -d /usr/src/$$1 ] ; then \
332			cd ${.CURDIR} && $(MAKE) doTARBALL \
333				SD=/usr/src TN="s$$2" TD=src ARG="$$1" ; \
334		fi && shift && shift ; \
335	done
336.endif
337	( cd ${RD}/dists/src && \
338		if [ -f ssecure.aa ] ; then mv ssecure.* ../des ; fi && \
339		if [ -f sebones.aa ] ; then mv sebones.* ../des ; fi && \
340		if [ -f ssecure.inf ] ; then mv ssecure.inf ../des ; fi && \
341		if [ -f sebones.inf ] ; then mv sebones.inf ../des ; fi ; )
342	@echo "src distribution is finished."
343	touch release.7
344
345# Complete the bootfd
346#
347# Now, just to get this picture down once and for all:
348#
349# +------------------------------------------------------------------------+
350# |boot.flp                                                                |
351# +-----+-----+------------------------------------------------------------+
352# |boot1|boot2|floppy filesystem "bootfd"                                  |
353# +-----+-----+-+--------------------------------------------------------+-+
354#               |kernel                                                  |
355#               +------------+-----------------------------------------+-+
356#                            |mfs filesystem "mfsfd"                   |
357#                            +-----------------------------------------+
358#
359
360release.8: write_mfs_in_kernel
361	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
362	rm -rf ${RD}/mfsfd
363	mkdir ${RD}/mfsfd
364	cd ${RD}/mfsfd && \
365		mkdir -p dev mnt stand/help
366	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
367		DIR=${RD}/mfsfd/stand ZIP=false
368	( cd ${RD}/trees/bin/dev && \
369		ls console tty ttyv0 ttyv1 ttyv2 ttyv3 null zero \
370		*[sw]d* cuaa[01] cuaa[23] fd[01] rfd[01] \
371		cd0a mcd0a scd0a matcd0a wcd0c rst0 rft0 rwt0 | \
372	cpio -dump ${RD}/mfsfd/dev )
373	( cd ${RD}/mfsfd/dev && rm -f *[sw]d*[bdefgh] )
374	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
375	echo "nameserver      42/tcp name"	> ${RD}/mfsfd/stand/etc/services
376	echo "ftp             21/tcp"		>> ${RD}/mfsfd/stand/etc/services
377	echo "domain          53/tcp          nameserver" >> ${RD}/mfsfd/stand/etc/services
378	echo "domain          53/udp          nameserver" >> ${RD}/mfsfd/stand/etc/services
379	gzip -c ${.CURDIR}/../COPYRIGHT > ${RD}/mfsfd/stand/help/COPYRIGHT.hlp.gz
380	-test -f ${.CURDIR}/install.cfg && cp ${.CURDIR}/install.cfg ${RD}/mfsfd
381	# make the small bootfd
382	@echo "Making the small 4MB boot floppy."
383		sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${BOOTMFSSIZE} ${RD}/mfsfd \
384			${MFSINODE} minimum
385		mv fs-image fs-image.4
386	mv fs-image.size fs-image.4.size
387	# add more stuff for the complete bootfd
388	@echo "Making the regular boot floppy."
389	tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
390		tar xvf - -C ${RD}/mfsfd/stand
391	@echo "Compressing doc files..."
392	@gzip -9 ${RD}/mfsfd/stand/help/*.hlp
393	sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${BOOTMFSSIZE} ${RD}/mfsfd \
394		${MFSINODE} minimum
395	mv fs-image fs-image.std
396	mv fs-image.size fs-image.std.size
397	cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=4
398	cd ${.CURDIR} && ${MAKE} doMFSKERN FSIMAGE=std
399	mv ${RD}/floppies/bootstd.flp ${RD}/floppies/boot.flp
400	@echo "Regular boot floppy made."
401	touch release.8
402
403#
404# --==## Create a fixit floppy ##==--
405#
406release.9:
407	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
408	rm -rf ${RD}/fixitfd
409	mkdir ${RD}/fixitfd
410	cd ${RD}/fixitfd && \
411		mkdir dev stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp
412	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
413		DIR=${RD}/fixitfd/stand ZIP=true
414	( cd ${RD}/fixitfd/dev && \
415		cp ${RD}/trees/bin/dev/MAKEDEV . && \
416		sh MAKEDEV all )
417	cp ${RD}/trees/bin/etc/spwd.db ${RD}/fixitfd/etc
418	cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
419	sh -e ${.CURDIR}/doFS.sh ${RD} ${MNT} ${FDSIZE} ${RD}/fixitfd \
420		10000 ${FDLABEL}
421	mv fs-image ${RD}/floppies/fixit.flp
422	touch release.9
423
424#
425# --==## Setup a suitable ftp-area ##==--
426#
427ftp.1:
428	mkdir -p ${FD}
429	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
430	cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
431	cp ${.CURDIR}/sysinstall/help/readme.hlp ${FD}/README.TXT
432	cp ${.CURDIR}/sysinstall/help/hardware.hlp ${FD}/HARDWARE.TXT
433	cp ${.CURDIR}/sysinstall/help/install.hlp ${FD}/INSTALL.TXT
434	cp ${.CURDIR}/sysinstall/help/relnotes.hlp ${FD}/RELNOTES.TXT
435
436#
437# --==## Setup a suitable cdrom-area ##==--
438#
439cdrom.1:
440	mkdir -p ${CD}/filesys
441	cd ${RD} && find floppies -print | cpio -dumpl ${CD}
442	cd ${RD}/dists && find . -print | cpio -dumpl ${CD}
443	ln -f ${RD}/kernels/MFSKERNEL.std ${CD}/kernel
444	ln -f ${RD}/trees/bin/usr/mdec/fbsdboot.exe ${CD}
445	for i in ${DISTRIBUTIONS} ; \
446	do \
447		if [ -d ${RD}/trees/$${i} ] ; then \
448			( cd ${RD}/trees/$${i} && \
449			find . -depth -print | cpio -dumpl ${CD}/filesys ) ; \
450		fi \
451	done
452	echo "CD_VERSION = ${BUILDNAME}" > ${CD}/cdrom.inf
453	cp ${.CURDIR}/sysinstall/help/readme.hlp ${CD}/README.TXT
454	cp ${.CURDIR}/sysinstall/help/hardware.hlp ${CD}/HARDWARE.TXT
455	cp ${.CURDIR}/sysinstall/help/install.hlp ${CD}/INSTALL.TXT
456	cp ${.CURDIR}/sysinstall/help/relnotes.hlp ${CD}/RELNOTES.TXT
457
458# Various "subroutine" and other supporting targets.
459
460doTARBALL:
461.if !defined(SD)
462	@echo "SD undefined in doTARBALL" && exit 1
463.endif
464.if !defined(TD)
465	@echo "TB undefined in doTARBALL" && exit 1
466.endif
467.if !defined(ARG)
468	@echo "ARG undefined in doTARBALL" && exit 1
469.endif
470	rm -rf ${RD}/dists/${TD}/${TN}*
471	mkdir -p ${RD}/dists/${TD}
472	( cd ${SD} && \
473		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
474		echo rolling ${TD}/$$tn tarball &&\
475		tar --exclude CVS --exclude obj -cf - ${ARG} | \
476		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
477		mkdir -p ${TD} && sh ${.CURDIR}/info.sh \
478		${RD}/dists/${TD}/$$tn > ${RD}/dists/${TD}/$$tn.inf && \
479		if [ -f ${.CURDIR}/scripts/$${TD}-install.sh ]; then \
480		  cp -p ${.CURDIR}/scripts/$${TD}-install.sh ${RD}/dists/${TD}/install.sh; \
481		fi && \
482		  if [ "${SD}" != "/usr/src" ]; then \
483			mtree -c -i -p ${SD}/${ARG} \
484			  -k gname,md5digest,mode,nlink,uname,size,link,type \
485			  > ${RD}/dists/${TD}/$$tn.mtree ; else true; fi )
486
487doRELEASE:  release.1 release.2 release.3 release.4 release.5 release.6 \
488		release.7 release.8 release.9
489	cd ${.CURDIR} && ${MAKE} cdrom.1 ftp.1
490	@echo "Release done"
491
492floppies:
493	cd ${.CURDIR} && ${MAKE} boot.flp
494	cd ${.CURDIR} && ${MAKE} fixit.flp
495	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
496
497boot.flp:
498	rm -f release.4 release.8
499	cd ${.CURDIR} && ${MAKE} release.4 release.8 WHICH_CRUNCH=boot
500
501fixit.flp:
502	rm -f release.4 release.9
503	cd ${.CURDIR} && ${MAKE} release.4 release.9 WHICH_CRUNCH=fixit
504
505write_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
506	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
507
508ckRELEASEDIR:
509.if !defined(RELEASEDIR)
510	@echo "To make a release RELEASEDIR must be defined" && false
511.endif
512
513installCRUNCH:
514.if !defined(CRUNCH)
515	@echo "CRUNCH undefined in installCRUNCH" && exit 1
516.endif
517.if !defined(DIR)
518	@echo "DIR undefined in installCRUNCH" && exit 1
519.endif
520.if !defined(ZIP)
521	@echo "ZIP undefined in installCRUNCH" && exit 1
522.endif
523	if ${ZIP} ; then \
524		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
525	else \
526		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
527	fi
528	chmod 555 ${DIR}/${CRUNCH}_crunch
529	for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
530		ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
531	done
532
533#
534# --==## Compile a kernel by name ${KERNEL} ##==--
535#
536# We don't erase the sys/compile/${KERNEL} directory, since somebody
537# may want to reuse it (release.8 presently)
538#
539doKERNEL:
540	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
541	rm -f ${RD}/kernels/${KERNEL}
542	cd ${.CURDIR}/../sys/i386/conf && config -n ${KERNEL}
543	cd ${.CURDIR}/../sys/compile/${KERNEL} && \
544			make  depend && \
545			make  kernel && \
546			cp kernel ${RD}/kernels/${KERNEL}
547
548#
549# --==## Put a filesystem into a BOOTMFS kernel ##==--
550#
551doMFSKERN:
552	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
553	rm -f ${RD}/kernels/BOOTMFS.${FSIMAGE}
554	rm -f /sys/compile/BOOTMFS/mfs_vfsops.o
555	cd ${.CURDIR}/../sys/i386/conf && \
556	  sed	-e '/SYSV/d' \
557		-e '/pty/d' \
558		-e '/PROCFS/d' \
559		-e '/KTRACE/d' \
560		-e 's/GENERIC/BOOTMFS/g' \
561		-e '/maxusers/s/10/4/' < GENERIC > BOOTMFS && \
562	  echo "options  MFS" >> BOOTMFS && \
563	  echo "options  NFS_NOSERVER" >> BOOTMFS && \
564	  echo 'options  "MAXCONS=4"' >> BOOTMFS
565	echo "options \"MFS_ROOT=`cat fs-image.${FSIMAGE}.size`\"" >> \
566	  ${.CURDIR}/../sys/i386/conf/BOOTMFS
567	cd ${.CURDIR} && ${MAKE} doKERNEL KERNEL=BOOTMFS
568	rm -rf ${RD}/boot.${FSIMAGE}
569	mkdir  ${RD}/boot.${FSIMAGE}
570	mv ${RD}/kernels/BOOTMFS ${RD}/kernels/BOOTMFS.${FSIMAGE}
571	cp ${RD}/kernels/BOOTMFS.${FSIMAGE} ${RD}/boot.${FSIMAGE}/kernel
572	./write_mfs_in_kernel ${RD}/boot.${FSIMAGE}/kernel \
573		fs-image.${FSIMAGE}
574	kzip -v ${RD}/boot.${FSIMAGE}/kernel
575	mv ${RD}/boot.${FSIMAGE}/kernel ${RD}/kernels/MFSKERNEL.${FSIMAGE}
576	mv ${RD}/boot.${FSIMAGE}/kernel.kz ${RD}/boot.${FSIMAGE}/kernel
577	ls -l ${RD}/boot.${FSIMAGE}/kernel
578	rm -f ${RD}/floppies/boot${FSIMAGE}.flp
579	cat /usr/mdec/rawboot ${RD}/boot.${FSIMAGE}/kernel | \
580		dd conv=sync of=${RD}/floppies/boot${FSIMAGE}.flp
581
582.include <bsd.prog.mk>
583