xref: /freebsd/release/Makefile (revision 5ebc7e6281887681c3a348a5a4c902e262ccd656)
1#	$Id: Makefile,v 1.190 1995/05/29 02:20:32 phk 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
25BOOT1=	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# mountpoint for filesystems.
33MNT=			/mnt
34
35# other floppy parameters.
36FDSIZE=			1200
37FDLABEL=		fd1200
38FDINODE=		4300
39
40NEWFSARGS=		-c 80 -b 4096 -f 512 -i 4000 -m 0 -t 0 -u 0 \
41				-o space -T ${FDLABEL}
42
43ZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
44
45# Size of the mfs to put in the kernel we boot.
46# You want to keep this as small as possible, it costs dearly in RAM.
47BOOTMFSSIZE=		1075
48MFSINODE=		70000
49
50# Things which will get you into trouble if you change them
51DISTRIBUTIONS=		bin ${EXTRA_DISTS}
52MTREEFILES=		${.CURDIR}/../etc/mtree
53RD=			${RELEASEDIR}/stage
54FD=			${RELEASEDIR}/ftp
55CD=			${RELEASEDIR}/cdrom
56
57.if !defined(WHICH_CRUNCH)
58WHICH_CRUNCH=	boot root fixit
59.endif
60
61release:
62.if !defined(CHROOTDIR) || !defined(BUILDNAME)
63	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
64.endif
65.if exists(${CHROOTDIR})
66	chflags -R noschg ${CHROOTDIR}/.
67	rm -rf ${CHROOTDIR}/*
68.else
69	mkdir ${CHROOTDIR}
70.endif
71	cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
72	cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR}
73	cd ${.CURDIR}/.. ; ${MAKE} install DESTDIR=${CHROOTDIR}
74	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
75	echo "set -ex"				>> ${CHROOTDIR}/mk
76	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
77	echo "make world"			>> ${CHROOTDIR}/mk
78	echo "cd /usr/src/release/libdisk"	>> ${CHROOTDIR}/mk
79	echo "make obj depend"			>> ${CHROOTDIR}/mk
80	echo "make all"				>> ${CHROOTDIR}/mk
81	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
82	echo "make obj depend"			>> ${CHROOTDIR}/mk
83	echo "make all"				>> ${CHROOTDIR}/mk
84	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
85	echo "make obj"				>> ${CHROOTDIR}/mk
86	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
87	echo "RELEASEDIR=/R"			>> ${CHROOTDIR}/etc/make.conf
88.if !defined(RELEASETAG)
89	cd ${CHROOTDIR}/usr ; cvs co -P src
90.else
91	cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} src
92.endif
93	( cd ${CHROOTDIR}/usr/src/sys/conf && \
94	mv newvers.sh foo && \
95	sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh )
96	# To be used in development...
97	#find ${.CURDIR} -print | cpio -dumpv ${CHROOTDIR}
98	chmod 755 ${CHROOTDIR}/mk
99	chroot ${CHROOTDIR} /mk
100
101# Same as above, but assume that a build just fell over, has been corrected
102# and now we just want to pick up where we left off.
103rerelease:
104.if !defined(CHROOTDIR) || !defined(BUILDNAME)
105	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
106.endif
107	@if [ ! -d ${CHROOTDIR} ]; then echo "No ${CHROOTDIR} directory to re-release in!"; exit 1; fi
108	cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
109	cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR}
110	cd ${.CURDIR}/.. ; ${MAKE} -k install DESTDIR=${CHROOTDIR}
111	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
112	echo "set -ex"				>> ${CHROOTDIR}/mk
113	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
114	echo "make all install"			>> ${CHROOTDIR}/mk
115	echo "cd /usr/src/release/libdisk"	>> ${CHROOTDIR}/mk
116	echo "make obj"				>> ${CHROOTDIR}/mk
117	echo "make all"				>> ${CHROOTDIR}/mk
118	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
119	echo "make obj"				>> ${CHROOTDIR}/mk
120	echo "make all"				>> ${CHROOTDIR}/mk
121	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
122	echo "make obj"				>> ${CHROOTDIR}/mk
123	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
124	echo "RELEASEDIR=/R"			>> ${CHROOTDIR}/etc/make.conf
125.if !defined(RELEASENOUPDATE)
126.if !defined(RELEASETAG)
127	cd ${CHROOTDIR}/usr ; cvs update -P -d -q src
128.else
129	cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} -P -d -q src
130.endif
131.endif
132	( cd ${CHROOTDIR}/usr/src/sys/conf && \
133	mv newvers.sh foo && \
134	sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh )
135	# To be used in development...
136	#find ${.CURDIR} -print | cpio -dumpv ${CHROOTDIR}
137	chmod 755 ${CHROOTDIR}/mk
138	chroot ${CHROOTDIR} /mk
139
140clean:
141	rm -rf root_crunch boot_crunch release.[0-9] release.1[0]
142
143# Clean out ${RELEASEDIR} and make the directory structure.
144release.1:
145	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
146	-mkdir ${RELEASEDIR}
147	chflags -R noschg ${RELEASEDIR}/.
148	rm -rf ${RELEASEDIR}/*
149	mkdir ${RD}
150	mkdir ${RD}/floppies
151	mkdir ${RD}/trees
152	mkdir ${RD}/dists
153	for i in ${ALL_DISTS} ; do \
154		mkdir ${RD}/trees/$$i ; \
155		mkdir ${RD}/dists/$$i ; \
156		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
157		    -p ${RD}/trees/$$i > /dev/null ; \
158		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
159		    -p ${RD}/trees/$$i/usr > /dev/null ; \
160		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
161		    -p ${RD}/trees/$$i/usr/include > /dev/null ; \
162		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
163		    -p ${RD}/trees/$$i/var > /dev/null ; \
164	done
165	touch release.1
166
167# Install the system into the various distributions.
168release.2:
169	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
170	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
171	cd ${.CURDIR}/.. ; make distribute DISTDIR=${RD}/trees
172	chflags -R noschg ${RD}/trees
173	uudecode ${.CURDIR}/compat20/libgcc.so.261.0.uu
174	install -m 444 -o bin -g bin libgcc.so.261.0 ${RD}/trees/bin/usr/lib
175	touch release.2
176
177# Make and install a couple of kernels we need.
178release.3:
179	rm -rf ${RD}/kernels
180	mkdir -p ${RD}/kernels
181	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
182	cd ${.CURDIR}/../sys/i386/conf && \
183		sed 's/GENERIC/BOOTMFS/g' GENERIC > BOOTMFS && \
184		echo "options  \"MFS_ROOT=${BOOTMFSSIZE}\"" >> BOOTMFS && \
185		echo "options  MFS" >> BOOTMFS
186	for i in BOOTMFS GENERIC ; 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
303#
304# Now, just to get this picture down once and for all:
305#
306# +------------------------------------------------------------------------+
307# |boot.flp                                                                |
308# +-----+-----+------------------------------------------------------------+
309# |boot1|boot2|floppy filesystem "bootfd"                                  |
310# +-----+-----+-+--------------------------------------------------------+-+
311#               |kernel                                                  |
312#               +------------+-----------------------------------------+-+
313#                            |mfs filesystem "mfsfd"                   |
314#                            +-----------------------------------------+
315#
316
317release.8: write_mfs_in_kernel
318	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
319	rm -rf ${RD}/mfsfd
320	mkdir ${RD}/mfsfd
321	cd ${RD}/mfsfd && \
322		mkdir -p dev mnt stand/help
323	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=boot \
324		DIR=${RD}/mfsfd/stand ZIP=false
325	( cd ${RD}/trees/bin/dev && \
326		ls console tty ttyv0 ttyv1 ttyv2 ttyv3 null zero \
327		*[sw]d* cuaa[01] fd[01] rfd[01] \
328		cd0a mcd0a scd0a matcd0a rst0 ft0 rwt0 | \
329	cpio -dump ${RD}/mfsfd/dev )
330	( cd ${RD}/mfsfd/dev && rm -f *[sw]d*[bdefgh] )
331	cd ${RD}/trees/bin && ls ${BOOT1} | cpio -dump ${RD}/mfsfd/stand
332	tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
333		tar xvf - -C ${RD}/mfsfd/stand
334	install -c ${.CURDIR}/../COPYRIGHT ${RD}/mfsfd/stand/help/en_US.ISO8859-1/COPYRIGHT
335	cd ${RD}/trees/bin/usr/share/FAQ/Text && \
336		install -c RELNOTES.FreeBSD ${RD}/mfsfd/stand/help/en_US.ISO8859-1/RELNOTES && \
337		install -c README ${RD}/mfsfd/stand/help/en_US.ISO8859-1/README
338	(cd ${RD}/mfsfd/stand/help && tar cf - * | gzip -9 > ../help.tgz)
339	(cd ${RD}/mfsfd/stand && rm -rf help)
340	( 								\
341	a=`expr ${BOOTMFSSIZE} \* 2` &&					\
342	echo &&								\
343	echo "mfs${BOOTMFSSIZE}:ty=mfs:se#512:nt#1:rm#300:\\" &&	\
344	echo "	:ns#$$a:nc#1:\\" &&					\
345	echo "	:pa#$$a:oa#0:ba#4096:fa#512:\\" &&			\
346	echo "	:pc#$$a:oc#0:bc#4096:fc#512:" &&			\
347	echo   								\
348	) >> /etc/disktab
349	cd ${.CURDIR} && ${MAKE} doFS FSSIZE=${BOOTMFSSIZE} \
350		FSPROTO=${RD}/mfsfd FSLABEL=mfs${BOOTMFSSIZE} \
351		FSINODE=${MFSINODE}
352	rm -rf ${RD}/bootfd
353	mkdir ${RD}/bootfd
354	cp ${RD}/kernels/BOOTMFS ${RD}/bootfd/kernel
355	./write_mfs_in_kernel ${RD}/bootfd/kernel fs-image
356	kzip ${RD}/bootfd/kernel
357	mv ${RD}/bootfd/kernel.kz ${RD}/bootfd/kernel
358	ls -l ${RD}/bootfd/kernel
359	cd ${.CURDIR} && ${MAKE} doFLOPPY FLOPPY=boot
360	touch release.8
361
362# Complete the rootfd directory
363release.9:
364	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
365	rm -rf ${RD}/rootfd
366	mkdir ${RD}/rootfd
367	cd ${RD}/rootfd && \
368		mkdir stand stand/info
369	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=root \
370		DIR=${RD}/rootfd/stand ZIP=false
371	tar --exclude CVS -cf - -C ${RD} info | tar xvf - -C ${RD}/rootfd/stand
372	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
373	mv ${RD}/floppies/root.tmp ${RD}/floppies/root.flp
374	touch release.9
375
376# Complete the fixitfd
377release.10:
378	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
379	rm -rf ${RD}/fixitfd
380	mkdir ${RD}/fixitfd
381	cd ${RD}/fixitfd && \
382		mkdir stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp
383	ln -f ${RD}/kernels/GENERIC.kz ${RD}/fixitfd/kernel
384	@cd ${.CURDIR} && $(MAKE) installCRUNCH CRUNCH=fixit \
385		DIR=${RD}/fixitfd/stand ZIP=true
386	( cd ${RD}/trees/bin/dev && \
387		sh MAKEDEV wd0s5 wd0s6 wd0s7 wd0s8 && \
388		ls console tty ttyv0 ttyv1 null zero \
389		*[sw]d* fd[01] rfd[01] | \
390	cpio -dump ${RD}/fixitfd/dev )
391	ln -f ${RD}/fixitfd/stand/init ${RD}/fixitfd/sbin
392	ln -f ${RD}/fixitfd/stand/sh ${RD}/fixitfd/bin
393	cp ${RD}/trees/bin/usr/mdec/fdboot ${RD}/fixitfd/etc/boot1
394	cp ${RD}/trees/bin/usr/mdec/bootfd ${RD}/fixitfd/etc/boot2
395	cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
396	echo 'echo /etc/rc'	> ${RD}/fixitfd/etc/rc
397	echo 'exit 1'		>> ${RD}/fixitfd/etc/rc
398	touch ${RD}/fixitfd/etc/spwd.db
399	cd ${.CURDIR} && ${MAKE} doFLOPPY FLOPPY=fixit
400	touch release.10
401
402ftp.1:
403	rm -rf ${FD}
404	mkdir ${FD}
405	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
406	cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
407	cd ${RD}/trees/bin/usr/share/FAQ/Text && ln -f ${FAQS} ${FD}
408
409	# This rule makes ${CHROOTDIR}/R/ftp a suitable anon ftp for testing.
410ftp.2:
411	-mkdir ${FD}/bin
412	ln -f ${RD}/trees/bin/bin/ls ${FD}/bin/ls
413
414cdrom.1:
415	rm -rf ${CD}
416	mkdir ${CD}
417	mkdir ${CD}/filesys
418	cd ${RD} && find floppies dists -print | cpio -dumpl ${CD}
419	ln -f ${RD}/bootfd/kernel ${CD}
420	ln -f ${RD}/trees/bin/usr/mdec/fbsdboot.exe ${CD}
421	for i in ${DISTRIBUTIONS} ; \
422	do \
423		if [ -d ${RD}/trees/$${i} ] ; then \
424			( cd ${RD}/trees/$${i} && \
425			find . -depth -print | cpio -dumpl ${CD}/filesys ) ; \
426		fi \
427	done
428
429# Various "subroutine" and other supporting targets.
430
431doTARBALL:
432.if !defined(SD)
433	@echo "SD undefined in doTARBALL" ; exit 1
434.endif
435.if !defined(TD)
436	@echo "TB undefined in doTARBALL" ; exit 1
437.endif
438.if !defined(ARG)
439	@echo "ARG undefined in doTARBALL" ; exit 1
440.endif
441	rm -rf ${RD}/dists/${TD}/${TN}*
442	mkdir -p ${RD}/dists/${TD}
443	( cd ${SD} && \
444		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
445		echo rolling ${TD}/$$tn tarball &&\
446		tar --exclude CVS --exclude obj -cf - ${ARG} | \
447		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
448		cd ${RD}/info && \
449		mkdir -p ${TD} && \
450		chmod a+x ${.CURDIR}/info.sh && \
451		${.CURDIR}/info.sh ${RD}/dists/${TD}/$$tn > ${TD}/$$tn.inf \
452	)
453
454doRELEASE:  release.1 release.2 release.3 release.4 release.5 release.6 \
455		release.7 release.8 release.9
456	cd ${.CURDIR} && ${MAKE} cdrom.1 ftp.1
457	@echo "Release done"
458
459floppies:
460	rm -f release.4 release.8 release.9
461	cd ${.CURDIR} && ${MAKE} doRELEASE
462
463boot.flp:
464	rm -f release.4 release.8
465	cd ${.CURDIR} && ${MAKE} release.4 release.8 WHICH_CRUNCH=boot
466
467root.flp:
468	rm -f release.4 release.9
469	cd ${.CURDIR} && ${MAKE} release.4 release.9 WHICH_CRUNCH=root
470
471fixit.flp:
472	rm -f release.4 release.10
473	cd ${.CURDIR} && ${MAKE} release.4 release.10 WHICH_CRUNCH=fixit
474
475write_mfs_in_kernel:	${.CURDIR}/write_mfs_in_kernel.c
476	${CC} ${CFLAGS} -o write_mfs_in_kernel ${.CURDIR}/write_mfs_in_kernel.c
477
478ckRELEASEDIR:
479.if !defined(RELEASEDIR)
480	@echo "To make a release RELEASEDIR must be defined" && false
481.endif
482
483doFLOPPY:
484.if !defined(FLOPPY)
485	@echo "FLOPPY undefined in doFLOPPY" ; exit 1
486.endif
487	rm -f ${RD}/floppies/${FLOPPY}.flp
488	cd ${.CURDIR} && ${MAKE} doFS FSSIZE=${FDSIZE} \
489		FSPROTO=${RD}/${FLOPPY}fd \
490		FSLABEL=${FDLABEL} FSINODE=${FDINODE}
491	mv fs-image ${RD}/floppies/${FLOPPY}.flp
492
493doFS:
494.if !defined(FSSIZE)
495	@echo "FSSIZE undefined in doFS" ; exit 1
496.endif
497.if !defined(FSPROTO)
498	@echo "FSPROTO undefined in doFS" ; exit 1
499.endif
500.if !defined(FSINODE)
501	@echo "FSINODE undefined in doFS" ; exit 1
502.endif
503	rm -f fs-image
504	if [ ! -b /dev/${VNDEVICE} -o ! -c /dev/r${VNDEVICE} ] ; then \
505		cd /dev && sh MAKEDEV ${VNDEVICE} ; fi
506	@umount /dev/${VNDEVICE} 2>/dev/null || true
507	@umount ${MNT} 2>/dev/null || true
508	@vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true
509	dd of=fs-image if=/dev/zero count=${FSSIZE} bs=1k 2>/dev/null
510	vnconfig -c /dev/r${VNDEVICE} fs-image
511.if defined(FSLABEL)
512	disklabel -w -r -B \
513		-b ${RD}/trees/bin/usr/mdec/fdboot \
514		-s ${RD}/trees/bin/usr/mdec/bootfd \
515		/dev/r${VNDEVICE} ${FSLABEL}
516.endif
517	newfs -u 0 -t 0 -i ${FSINODE} -m 0 -T ${FSLABEL} /dev/r${VNDEVICE}
518	mount /dev/${VNDEVICE} ${MNT}
519	cd ${FSPROTO} && find . -print | cpio -dump ${MNT}
520	df -i /mnt
521	umount ${MNT}
522	fsck  /dev/r${VNDEVICE} < /dev/null
523
524installCRUNCH:
525.if !defined(CRUNCH)
526	@echo "CRUNCH undefined in installCRUNCH" ; exit 1
527.endif
528.if !defined(DIR)
529	@echo "DIR undefined in installCRUNCH" ; exit 1
530.endif
531.if !defined(ZIP)
532	@echo "ZIP undefined in installCRUNCH" ; exit 1
533.endif
534	if ${ZIP} ; then \
535		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
536	else \
537		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
538	fi
539	chmod 555 ${DIR}/${CRUNCH}_crunch
540	for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
541		ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
542	done
543.include <bsd.prog.mk>
544