Makefile revision 8759
1#	$Id: Makefile,v 1.180 1995/05/25 18:48:06 jkh 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=SOME_RANDOM_BUILD
15
16# If this is a RELEASE, then set
17#RELEASETAG=something
18
19# Things which without too much trouble can be considered variables
20
21EXPORT_DISTS=	games manpages proflibs dict info
22EXTRA_DISTS=	des ${EXPORT_DISTS}
23ALL_DISTS=	bin ${EXTRA_DISTS}
24
25ROOT1=	etc/services etc/protocols etc/sysconfig
26
27FAQS=	README MIRROR.SITES
28
29# define this to use a vn device instead of the floppy drive
30VNDEVICE=		vn0
31
32# which floppy to use, if VNDEVICE isn't defined.
33FDDEVICE=		fd0
34
35# define FDFORMAT to format physical floppies
36FDFORMAT=		yes
37
38# mountpoint for filesystems.
39MNT=			/mnt
40
41# other floppy parameters.
42FDCYLS=			80
43FDCYLSIZE=		15k
44FDLABEL=		fd1200
45
46NEWFSARGS=		-c 80 -b 4096 -f 512 -i 4300 -m 0 -t 0 -u 0 \
47				-o space -T ${FDLABEL}
48
49ZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
50
51
52# Things which will get you into trouble if you change them
53DISTRIBUTIONS=		bin ${EXTRA_DISTS}                      
54MTREEFILES=		${.CURDIR}/../etc/mtree
55RD=			${RELEASEDIR}/stage
56FD=			${RELEASEDIR}/ftp
57CD=			${RELEASEDIR}/cdrom
58
59.if !defined(WHICH_CRUNCH)
60WHICH_CRUNCH=	boot root fixit
61.endif
62
63release:
64.if !defined(CHROOTDIR) || !defined(BUILDNAME)
65	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
66.endif
67.if exists(${CHROOTDIR})
68	chflags -R noschg ${CHROOTDIR}/.
69	rm -rf ${CHROOTDIR}/*
70.else
71	mkdir ${CHROOTDIR}
72.endif
73	cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
74	cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR}
75	cd ${.CURDIR}/.. ; ${MAKE} install DESTDIR=${CHROOTDIR}
76	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
77	echo "set -ex"				>> ${CHROOTDIR}/mk
78	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
79	echo "make world"			>> ${CHROOTDIR}/mk
80	echo "cd /usr/src/release/libdisk"	>> ${CHROOTDIR}/mk
81	echo "make obj depend"			>> ${CHROOTDIR}/mk
82	echo "make all"				>> ${CHROOTDIR}/mk
83	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
84	echo "make obj depend"			>> ${CHROOTDIR}/mk
85	echo "make all"				>> ${CHROOTDIR}/mk
86	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
87	echo "make obj"				>> ${CHROOTDIR}/mk
88	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
89	echo "RELEASEDIR=/R"			>> ${CHROOTDIR}/etc/make.conf
90.if !defined(RELEASETAG)
91	cd ${CHROOTDIR}/usr ; cvs co -P src
92.else
93	cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} src
94.endif
95	( cd ${CHROOTDIR}/usr/src/sys/conf && \
96	mv newvers.sh foo && \
97	sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh )
98	# To be used in development...
99	#find ${.CURDIR} -print | cpio -dumpv ${CHROOTDIR}
100	chmod 755 ${CHROOTDIR}/mk
101	chroot ${CHROOTDIR} /mk
102
103# Same as above, but assume that a build just fell over, has been corrected
104# and now we just want to pick up where we left off.
105rerelease:
106.if !defined(CHROOTDIR) || !defined(BUILDNAME)
107	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
108.endif
109	@if [ ! -d ${CHROOTDIR} ]; then echo "No ${CHROOTDIR} directory to re-release in!"; exit 1; fi
110	cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
111	cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR}
112	cd ${.CURDIR}/.. ; ${MAKE} -k install DESTDIR=${CHROOTDIR}
113	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
114	echo "set -ex"				>> ${CHROOTDIR}/mk
115	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
116	echo "make all install"			>> ${CHROOTDIR}/mk
117	echo "cd /usr/src/release/libdisk"	>> ${CHROOTDIR}/mk
118	echo "make obj"				>> ${CHROOTDIR}/mk
119	echo "make all"				>> ${CHROOTDIR}/mk
120	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
121	echo "make obj"				>> ${CHROOTDIR}/mk
122	echo "make all"				>> ${CHROOTDIR}/mk
123	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
124	echo "make obj"				>> ${CHROOTDIR}/mk
125	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
126	echo "RELEASEDIR=/R"			>> ${CHROOTDIR}/etc/make.conf
127.if !defined(RELEASENOUPDATE)
128.if !defined(RELEASETAG)
129	cd ${CHROOTDIR}/usr ; cvs update -P -d -q src
130.else
131	cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} -P -d -q src
132.endif
133.endif
134	( cd ${CHROOTDIR}/usr/src/sys/conf && \
135	mv newvers.sh foo && \
136	sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh )
137	# To be used in development...
138	#find ${.CURDIR} -print | cpio -dumpv ${CHROOTDIR}
139	chmod 755 ${CHROOTDIR}/mk
140	chroot ${CHROOTDIR} /mk
141
142clean:
143	rm -rf root_crunch boot_crunch release.[0-9] release.1[0]
144
145# Clean out ${RELEASEDIR} and make the directory structure.
146release.1:
147	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
148	-mkdir ${RELEASEDIR}
149	chflags -R noschg ${RELEASEDIR}/.
150	rm -rf ${RELEASEDIR}/*
151	mkdir ${RD}
152	mkdir ${RD}/floppies
153	mkdir ${RD}/trees
154	mkdir ${RD}/dists
155	for i in ${ALL_DISTS} ; do \
156		mkdir ${RD}/trees/$$i ; \
157		mkdir ${RD}/dists/$$i ; \
158		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
159		    -p ${RD}/trees/$$i > /dev/null ; \
160		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
161		    -p ${RD}/trees/$$i/usr > /dev/null ; \
162		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
163		    -p ${RD}/trees/$$i/usr/include > /dev/null ; \
164		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
165		    -p ${RD}/trees/$$i/var > /dev/null ; \
166	done
167	touch release.1
168
169# Install the system into the various distributions.
170release.2:
171	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
172	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
173	cd ${.CURDIR}/.. ; make distribute DISTDIR=${RD}/trees
174	chflags -R noschg ${RD}/trees
175	uudecode ${.CURDIR}/compat20/libgcc.so.261.0.uu
176	install -m 444 -o bin -g bin libgcc.so.261.0 ${RD}/trees/bin/usr/lib
177	touch release.2
178
179# Make and install a couple of kernels we need.
180release.3:
181	rm -rf ${RD}/kernels
182	mkdir -p ${RD}/kernels
183	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
184	cd ${.CURDIR}/../sys/i386/conf && \
185		sed 's/GENERIC/BOOTCDROM/g' GENERIC > BOOTCDROM
186	for i in GENERIC BOOTCDROM ; do \
187		cd ${.CURDIR}/../sys/i386/conf && \
188			config $$i && \
189		cd ${.CURDIR}/../sys/compile/$$i && \
190			make depend && \
191			make kernel && \
192			cp kernel ${RD}/kernels/$$i ; \
193		rm -rf ${.CURDIR}/../sys/compile/$$i ; \
194	done
195	rm -f ${.CURDIR}/../sys/i386/conf/BOOTCDROM
196	cd ${RD}/kernels && kzip GENERIC
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	rm -rf ${RD}/crunch
204	mkdir -p ${RD}/crunch
205	for j in ${WHICH_CRUNCH} ; do \
206		rm -rf $${j}_crunch && \
207		mkdir $${j}_crunch && \
208		( cd $${j}_crunch && \
209		crunchgen ${.CURDIR}/$${j}_crunch.conf && \
210		${MAKE} -f $${j}_crunch.mk objs exe NOCRYPT=yes \
211		    "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
212		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
213		rm -rf $${j}_crunch ; \
214	done
215	touch release.4
216
217# Fix up the distributions.
218release.5:
219	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
220	ln -f ${RD}/kernels/GENERIC ${RD}/trees/bin/kernel.GENERIC
221	if [ -d ${RD}/trees/bin/usr/share/man ] ; then \
222		rm -rf ${RD}/trees/manpages/usr/share/man ;\
223		mv ${RD}/trees/bin/usr/share/man \
224			${RD}/trees/manpages/usr/share/man ;\
225	fi
226	if [ -d ${RD}/trees/bin/usr/games ] ; then \
227		rm -rf ${RD}/trees/games/usr/games ;\
228		mv ${RD}/trees/bin/usr/games \
229			${RD}/trees/games/usr/games ;\
230	fi
231	if [ -d ${RD}/trees/bin/usr/share/games ] ; then \
232		rm -rf ${RD}/trees/games/usr/share/games ;\
233		mv ${RD}/trees/bin/usr/share/games \
234			${RD}/trees/games/usr/share/games ;\
235	fi
236	if [ -d ${RD}/trees/bin/var/games ] ; then \
237		rm -rf ${RD}/trees/games/var/games ;\
238		mv ${RD}/trees/bin/var/games \
239			${RD}/trees/games/var/games ;\
240	fi
241	if [ -d ${RD}/trees/bin/usr/share/dict ] ; then \
242		rm -rf ${RD}/trees/dict/usr/share/dict ;\
243		mv ${RD}/trees/bin/usr/share/dict \
244			${RD}/trees/dict/usr/share/dict ;\
245	fi
246	for i in airport birthtoken flowers na.phone zipcodes ; do \
247		if [ -f ${RD}/trees/bin/usr/share/misc/$$i ] ; then \
248			mv ${RD}/trees/bin/usr/share/misc/$$i \
249				${RD}/trees/dict/usr/share/misc ; \
250		fi ; \
251	done
252	-mv ${RD}/trees/bin/usr/share/info/* \
253		${RD}/trees/info/usr/share/info
254	for i in ${RD}/trees/bin/usr/lib/*_p.a ; do \
255		if [ -f $$i ] ; then \
256			mv $$i \
257				${RD}/trees/proflibs/usr/lib ; \
258		fi ; \
259	done
260	cd ${RD}/trees/bin/usr/share/misc && rm -f termcap.db vgrindefs.db
261	-cd ${RD}/trees && \
262		find ${EXTRA_DISTS} -depth -type d -print | xargs rmdir
263	touch release.5
264
265# Make binary dists, notice that DES dist isn't finished yet.
266release.6:
267	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
268	rm -rf ${RD}/dists
269	mkdir -p ${RD}/dists
270	mkdir -p ${RD}/info
271	@for i in ${DISTRIBUTIONS} ; \
272	do \
273		if [ -d ${RD}/trees/$${i} ] ; then \
274			cd ${.CURDIR} ; \
275				$(MAKE) doTARBALL SD=${RD}/trees/$${i} \
276					TN=$$i TD=$$i ARG="." ; \
277			echo "$${i} distribution is finished."; \
278		fi ; \
279	done                                                 
280	touch release.6
281
282
283# Make source dists, and finish of DES too
284release.7:
285	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
286	@cd ${.CURDIR} ; $(MAKE) doTARBALL SD=/usr/src \
287		TD=src TN=sbase ARG="[A-Z]*"
288	@for i in `cd /usr/src ; echo [a-z]*` ; do \
289		if [ -d /usr/src/$$i -a "$$i" != "CVS" ] ; then \
290			cd ${.CURDIR} ; \
291			$(MAKE) doTARBALL SD=/usr/src \
292				TN=`echo s$$i | tr -d '.' | sed 's/usr/u/'` \
293				TD=src ARG="$$i" ; \
294		fi ; \
295	done
296	( cd ${RD}/dists/src && \
297	if [ -f sdes.aa ] ; then mv sdes.* ../des ; fi && \
298	if [ -f sebones.aa ] ; then mv sebones.* ../des ; fi )
299	@echo "src distribution is finished."
300	touch release.7
301
302# Complete the bootfd 
303release.8:
304	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
305	rm -rf ${RD}/bootfd
306	mkdir ${RD}/bootfd
307	cd ${RD}/bootfd && \
308		mkdir -p dev mnt stand/help
309	ln -f ${RD}/kernels/GENERIC.kz ${RD}/bootfd/kernel
310	@cd ${.CURDIR} ; $(MAKE) installCRUNCH CRUNCH=boot \
311		DIR=${RD}/bootfd/stand ZIP=true
312	( cd ${RD}/trees/bin/dev ; \
313		ls console tty ttyv0 ttyv1 ttyv2 ttyv3 null zero \
314		*[sw]d* cuaa[01] fd[01] rfd[01] \
315		cd0a mcd0a scd0a matcd0a rst0 ft0 rwt0 | \
316	cpio -dump ${RD}/bootfd/dev )
317	tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
318		tar xvf - -C ${RD}/bootfd/stand
319	install -c ${.CURDIR}/../COPYRIGHT ${RD}/bootfd/stand/help/en_US.ISO8859-1/COPYRIGHT
320	cd ${RD}/trees/bin/usr/share/FAQ/Text ; \
321		install -c RELNOTES.FreeBSD ${RD}/bootfd/stand/help/en_US.ISO8859-1/RELNOTES; \
322		install -c README ${RD}/bootfd/stand/help/en_US.ISO8859-1/README
323	touch ${RD}/bootfd/this_is_boot_flp
324	cd ${.CURDIR} ; ${MAKE} doFLOPPY FLOPPY=boot
325	touch release.8
326
327# Complete the rootfd directory
328release.9:
329	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
330	rm -rf ${RD}/rootfd
331	mkdir ${RD}/rootfd
332	cd ${RD}/rootfd && \
333		mkdir stand stand/info
334	ln -f ${RD}/kernels/GENERIC ${RD}/rootfd/kernel
335	@cd ${.CURDIR} ; $(MAKE) installCRUNCH CRUNCH=root \
336		DIR=${RD}/rootfd/stand ZIP=false
337	cd ${RD}/trees/bin ; ls ${ROOT1} | cpio -dump ${RD}/rootfd/stand
338	tar --exclude CVS -cf - -C ${RD} info | tar xvf - -C ${RD}/rootfd/stand
339	cd ${RD}/rootfd ; ( rm -f OK ; find . -print ; touch OK ; echo OK ) | cpio -H tar -oa | gzip -9 -c | dd conv=osync > ${RD}/floppies/root.tmp
340	mv ${RD}/floppies/root.tmp ${RD}/floppies/root.flp
341	touch release.9
342
343# Complete the fixitfd
344release.10:
345	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
346	rm -rf ${RD}/fixitfd
347	mkdir ${RD}/fixitfd
348	cd ${RD}/fixitfd && \
349		mkdir stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp
350	ln -f ${RD}/kernels/GENERIC.kz ${RD}/fixitfd/kernel
351	@cd ${.CURDIR} ; $(MAKE) installCRUNCH CRUNCH=fixit \
352		DIR=${RD}/fixitfd/stand ZIP=true
353	( cd ${RD}/trees/bin/dev && \
354		sh MAKEDEV wd0s5 wd0s6 wd0s7 wd0s8 && \
355		ls console tty ttyv0 ttyv1 null zero \
356		*[sw]d* fd[01] rfd[01] | \
357	cpio -dump ${RD}/fixitfd/dev )
358	ln -f ${RD}/fixitfd/stand/init ${RD}/fixitfd/sbin
359	ln -f ${RD}/fixitfd/stand/sh ${RD}/fixitfd/bin
360	cp ${RD}/trees/bin/usr/mdec/fdboot ${RD}/fixitfd/etc/boot1
361	cp ${RD}/trees/bin/usr/mdec/bootfd ${RD}/fixitfd/etc/boot2
362	cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
363	echo 'echo /etc/rc'	> ${RD}/fixitfd/etc/rc
364	echo 'exit 1'		>> ${RD}/fixitfd/etc/rc
365	touch ${RD}/fixitfd/etc/spwd.db
366	cd ${.CURDIR} ; ${MAKE} doFLOPPY FLOPPY=fixit
367	touch release.10
368
369ftp.1:
370	rm -rf ${FD}
371	mkdir ${FD}
372	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
373	cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
374	cd ${RD}/trees/bin/usr/share/FAQ/Text && ln -f ${FAQS} ${FD}
375
376	# This rule makes ${CHROOTDIR}/R/ftp a suitable anon ftp for testing.
377ftp.2:
378	-mkdir ${FD}/bin
379	ln -f ${RD}/trees/bin/bin/ls ${FD}/bin/ls
380
381cdrom.1:
382	rm -rf ${CD}
383	mkdir ${CD}
384	mkdir ${CD}/filesys
385	cd ${RD} && find floppies dists bootfd -print | cpio -dumpl ${CD}
386	cd ${CD} && mv bootfd bootcd
387	rm -f ${CD}/bootcd/kernel
388	ln -f ${RD}/kernels/BOOTCDROM ${CD}/bootcd/kernel
389	ln -f ${RD}/trees/bin/usr/mdec/fbsdboot.exe ${CD}/bootcd
390	for i in ${DISTRIBUTIONS} ; \
391	do \
392		if [ -d ${RD}/trees/$${i} ] ; then \
393			( cd ${RD}/trees/$${i} && \
394			find . -depth -print | cpio -dumpl ${CD}/filesys ) ; \
395		fi \
396	done
397
398# Various "subroutine" and other supporting targets.
399
400doTARBALL:
401.if !defined(SD)
402	@echo "SD undefined in doTARBALL" ; exit 1
403.endif               
404.if !defined(TD)
405	@echo "TB undefined in doTARBALL" ; exit 1
406.endif               
407.if !defined(ARG)
408	@echo "ARG undefined in doTARBALL" ; exit 1
409.endif               
410	rm -rf ${RD}/dists/${TD}/${TN}*
411	mkdir -p ${RD}/dists/${TD}
412	( cd ${SD} && \
413		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
414		echo rolling ${TD}/$$tn tarball &&\
415		tar --exclude CVS --exclude obj -cf - ${ARG} | \
416		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
417		cd ${RD}/info && \
418		mkdir -p ${TD} && \
419		chmod a+x ${.CURDIR}/info.sh && \
420		${.CURDIR}/info.sh ${RD}/dists/${TD}/$$tn > ${TD}/$$tn.inf \
421	)
422
423doRELEASE:  release.1 release.2 release.3 release.4 release.5 release.6 \
424		release.7 release.8 release.9 release.10
425	cd ${.CURDIR} && ${MAKE} cdrom.1 ftp.1
426	@echo "Release done"
427
428floppies:
429	rm -f release.4 release.8 release.9 release.10
430	cd ${.CURDIR} && ${MAKE} doRELEASE
431
432boot.flp:
433	rm -f release.4 release.8
434	cd ${.CURDIR} && ${MAKE} release.4 release.8 WHICH_CRUNCH=boot
435
436root.flp:
437	rm -f release.4 release.9
438	cd ${.CURDIR} && ${MAKE} release.4 release.9 WHICH_CRUNCH=root
439
440fixit.flp:
441	rm -f release.4 release.10
442	cd ${.CURDIR} && ${MAKE} release.4 release.10 WHICH_CRUNCH=fixit
443
444ckRELEASEDIR:
445.if !defined(RELEASEDIR)
446	@echo "To make a release RELEASEDIR must be defined" && false
447.endif               
448
449doFLOPPY:
450.if !defined(FLOPPY)
451	@echo "FLOPPY undefined in doFLOPPY" ; exit 1
452.endif
453	rm -f ${RD}/floppies/${FLOPPY}.tmp ${RD}/floppies/${FLOPPY}.flp
454.if defined(VNDEVICE)
455	if [ ! -b /dev/${VNDEVICE} -o ! -c /dev/r${VNDEVICE} ] ; then \
456		cd /dev && sh MAKEDEV ${VNDEVICE} ; fi
457	@umount /dev/${VNDEVICE} 2>/dev/null || true
458	@umount ${MNT} 2>/dev/null || true
459	@vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true
460	dd of=${RD}/floppies/${FLOPPY}.tmp if=/dev/zero \
461		bs=${FDCYLSIZE} count=${FDCYLS} 2>/dev/null
462	vnconfig -c /dev/r${VNDEVICE} ${RD}/floppies/${FLOPPY}.tmp
463	disklabel -w -r -B \
464		-b ${RD}/trees/bin/usr/mdec/fdboot \
465		-s ${RD}/trees/bin/usr/mdec/bootfd \
466		/dev/r${VNDEVICE} ${FDLABEL}
467	newfs ${NEWFSARGS} /dev/r${VNDEVICE}
468	mount /dev/${VNDEVICE} ${MNT}
469	cd ${RD}/${FLOPPY}fd ; find . -print | cpio -dump ${MNT}
470	umount ${MNT}
471	fsck  /dev/r${VNDEVICE} < /dev/null
472.else
473	-umount /dev/${FDDEVICE}
474	-umount ${MNT}
475.if !defined(FDFORMAT)
476	echo y | fdformat /dev/r${FDDEVICE}
477.endif
478	disklabel -w -r -B \
479		-b ${RD}/trees/bin/usr/mdec/fdboot \
480		-s ${RD}/trees/bin/usr/mdec/bootfd \
481		/dev/r${FDDEVICE} ${FDLABEL}
482	newfs ${NEWFSARGS} /dev/r${FDDEVICE}
483	mount /dev/${FDDEVICE} ${MNT}
484	cd ${RD}/${FLOPPY}fd ; find . -print | cpio -dump ${MNT}
485	umount ${MNT}
486	fsck -n /dev/r${FDDEVICE} < /dev/null
487	dd if=/dev/r${FDDEVICE} of=${RD}/floppies/${FLOPPY}.tmp \
488		bs=${FDCYLSIZE} count=${FDCYLS}
489.endif
490	mv ${RD}/floppies/${FLOPPY}.tmp ${RD}/floppies/${FLOPPY}.flp
491
492installCRUNCH:
493.if !defined(CRUNCH)
494	@echo "CRUNCH undefined in installCRUNCH" ; exit 1
495.endif
496.if !defined(DIR)
497	@echo "DIR undefined in installCRUNCH" ; exit 1
498.endif
499.if !defined(ZIP)
500	@echo "ZIP undefined in installCRUNCH" ; exit 1
501.endif
502	if ${ZIP} ; then \
503		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
504	else \
505		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
506	fi
507	chmod 555 ${DIR}/${CRUNCH}_crunch
508	for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
509		ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
510	done
511.include <bsd.prog.mk>
512