Makefile revision 8714
11541Srgrimes#	$Id: Makefile,v 1.173 1995/05/23 21:47:26 jkh Exp $
21541Srgrimes#
31541Srgrimes# How to roll a release:
41541Srgrimes#
51541Srgrimes#	make release CHROOTDIR=<lots of disk> [ RELEASETAG=something ]
61541Srgrimes#
71541Srgrimes# As far as I know, this will roll everything nicely into the "stage"
81541Srgrimes# directory.  I still need to write the two rules to move that into
91541Srgrimes# the "cdrom" and "ftp" directories.
101541Srgrimes# I also need to "make ports" and install those, but I'm not going to do
111541Srgrimes# that on a 14.4 line just yet...
121541Srgrimes
131541Srgrimes# SET THIS !!!
141541Srgrimes#BUILDNAME=SOME_RANDOM_BUILD
151541Srgrimes
161541Srgrimes# If this is a RELEASE, then set
171541Srgrimes#RELEASETAG=something
181541Srgrimes
191541Srgrimes# Things which without too much trouble can be considered variables
201541Srgrimes
211541SrgrimesEXPORT_DISTS=	games manpages proflibs dict info
221541SrgrimesEXTRA_DISTS=	des ${EXPORT_DISTS}
231541SrgrimesALL_DISTS=	bin ${EXTRA_DISTS}
241541Srgrimes
251541SrgrimesCPIO1=	etc/services etc/protocols etc/sysconfig
261541Srgrimes
271541SrgrimesFAQS=	README MIRROR.SITES
281541Srgrimes
291541Srgrimes# define this to use a vn device instead of the floppy drive
301541SrgrimesVNDEVICE=		vn0
311541Srgrimes
321541Srgrimes# which floppy to use, if VNDEVICE isn't defined.
331541SrgrimesFDDEVICE=		fd0
346283Swollman
351541Srgrimes# define FDFORMAT to format physical floppies
361541SrgrimesFDFORMAT=		yes
371541Srgrimes
381541Srgrimes# mountpoint for filesystems.
391541SrgrimesMNT=			/mnt
401541Srgrimes
411541Srgrimes# other floppy parameters.
421541SrgrimesFDCYLS=			80
431541SrgrimesFDCYLSIZE=		15k
441541SrgrimesFDLABEL=		fd1200
451541Srgrimes
461541SrgrimesNEWFSARGS=		-c 80 -b 4096 -f 512 -i 4300 -m 0 -t 0 -u 0 \
471541Srgrimes				-o space -T ${FDLABEL}
481541Srgrimes
491541SrgrimesZIPNSPLIT=		gzip --no-name -9 -c | split -b 240640 -
501541Srgrimes
511541Srgrimes
521541Srgrimes# Things which will get you into trouble if you change them
531541SrgrimesDISTRIBUTIONS=		bin ${EXTRA_DISTS}                      
541541SrgrimesMTREEFILES=		${.CURDIR}/../etc/mtree
551541SrgrimesRD=			${RELEASEDIR}/stage
561541SrgrimesFD=			${RELEASEDIR}/ftp
571541SrgrimesCD=			${RELEASEDIR}/cdrom
581541Srgrimes
591541Srgrimes.if !defined(WHICH_CRUNCH)
601541SrgrimesWHICH_CRUNCH=	boot cpio fixit
611541Srgrimes.endif
621541Srgrimes
631541Srgrimesrelease:
641541Srgrimes.if !defined(CHROOTDIR) || !defined(BUILDNAME)
651541Srgrimes	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
661541Srgrimes.endif
671541Srgrimes.if exists(${CHROOTDIR})
681541Srgrimes	chflags -R noschg ${CHROOTDIR}/.
691541Srgrimes	rm -rf ${CHROOTDIR}/*
701541Srgrimes.else
711541Srgrimes	mkdir ${CHROOTDIR}
721541Srgrimes.endif
731541Srgrimes	cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
741541Srgrimes	cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR}
751541Srgrimes	cd ${.CURDIR}/.. ; ${MAKE} install DESTDIR=${CHROOTDIR}
761541Srgrimes	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
771541Srgrimes	echo "set -ex"				>> ${CHROOTDIR}/mk
781541Srgrimes	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
791541Srgrimes	echo "make world"			>> ${CHROOTDIR}/mk
801541Srgrimes	echo "cd /usr/src/release/libdisk"	>> ${CHROOTDIR}/mk
811541Srgrimes	echo "make obj"				>> ${CHROOTDIR}/mk
821541Srgrimes	echo "make all"				>> ${CHROOTDIR}/mk
831541Srgrimes	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
841541Srgrimes	echo "make obj"				>> ${CHROOTDIR}/mk
851541Srgrimes	echo "make all"				>> ${CHROOTDIR}/mk
861541Srgrimes	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
871541Srgrimes	echo "make obj"				>> ${CHROOTDIR}/mk
881541Srgrimes	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
891541Srgrimes	echo "RELEASEDIR=/R"			>> ${CHROOTDIR}/etc/make.conf
901541Srgrimes.if !defined(RELEASETAG)
911541Srgrimes	cd ${CHROOTDIR}/usr ; cvs co -P src
921541Srgrimes.else
931541Srgrimes	cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} src
941541Srgrimes.endif
951541Srgrimes	( cd ${CHROOTDIR}/usr/src/sys/conf && \
961541Srgrimes	mv newvers.sh foo && \
971541Srgrimes	sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh )
981541Srgrimes	# To be used in development...
991541Srgrimes	#find ${.CURDIR} -print | cpio -dumpv ${CHROOTDIR}
1001541Srgrimes	chmod 755 ${CHROOTDIR}/mk
1011541Srgrimes	chroot ${CHROOTDIR} /mk
1021541Srgrimes
1031541Srgrimes# Same as above, but assume that a build just fell over, has been corrected
1041541Srgrimes# and now we just want to pick up where we left off.
1051541Srgrimesrerelease:
1061541Srgrimes.if !defined(CHROOTDIR) || !defined(BUILDNAME)
1071541Srgrimes	@echo "To make a release you must set CHROOTDIR and BUILDNAME" && false
1081541Srgrimes.endif
1091541Srgrimes	@if [ ! -d ${CHROOTDIR} ]; then echo "No ${CHROOTDIR} directory to re-release in!"; exit 1; fi
1101541Srgrimes	cd ${.CURDIR}/../etc ; ${MAKE} distrib-dirs DESTDIR=${CHROOTDIR}
1111541Srgrimes	cd ${.CURDIR}/../etc ; ${MAKE} distribution DESTDIR=${CHROOTDIR}
1121541Srgrimes	cd ${.CURDIR}/.. ; ${MAKE} -k install DESTDIR=${CHROOTDIR}
1131541Srgrimes	echo "#!/bin/sh"			> ${CHROOTDIR}/mk
1141541Srgrimes	echo "set -ex"				>> ${CHROOTDIR}/mk
1151541Srgrimes	echo "cd /usr/src"			>> ${CHROOTDIR}/mk
1161541Srgrimes	echo "make all install"			>> ${CHROOTDIR}/mk
1171541Srgrimes	echo "cd /usr/src/release/libdisk"	>> ${CHROOTDIR}/mk
1181541Srgrimes	echo "make obj"				>> ${CHROOTDIR}/mk
1191541Srgrimes	echo "make all"				>> ${CHROOTDIR}/mk
1201541Srgrimes	echo "cd /usr/src/release/sysinstall"	>> ${CHROOTDIR}/mk
1211541Srgrimes	echo "make obj"				>> ${CHROOTDIR}/mk
1221541Srgrimes	echo "make all"				>> ${CHROOTDIR}/mk
1231541Srgrimes	echo "cd /usr/src/release"		>> ${CHROOTDIR}/mk
1241541Srgrimes	echo "make obj"				>> ${CHROOTDIR}/mk
1251541Srgrimes	echo "make doRELEASE"			>> ${CHROOTDIR}/mk
1266283Swollman	echo "RELEASEDIR=/R"			>> ${CHROOTDIR}/etc/make.conf
1276283Swollman.if !defined(RELEASENOUPDATE)
1286283Swollman.if !defined(RELEASETAG)
1291541Srgrimes	cd ${CHROOTDIR}/usr ; cvs update -P -d -q src
1301541Srgrimes.else
1311541Srgrimes	cd ${CHROOTDIR}/usr ; cvs export -r ${RELEASETAG} -P -d -q src
1321541Srgrimes.endif
1331541Srgrimes.endif
1341541Srgrimes	( cd ${CHROOTDIR}/usr/src/sys/conf && \
1351541Srgrimes	mv newvers.sh foo && \
1361541Srgrimes	sed "s/^RELEASE=.*/RELEASE=${BUILDNAME}/" foo > newvers.sh )
1371541Srgrimes	# To be used in development...
1381541Srgrimes	#find ${.CURDIR} -print | cpio -dumpv ${CHROOTDIR}
1391541Srgrimes	chmod 755 ${CHROOTDIR}/mk
1401541Srgrimes	chroot ${CHROOTDIR} /mk
1411541Srgrimes
1421541Srgrimesclean:
1431541Srgrimes	rm -rf cpio_crunch boot_crunch release.[0-9] release.1[0]
1441541Srgrimes
1451541Srgrimes# Clean out ${RELEASEDIR} and make the directory structure.
1461541Srgrimesrelease.1:
1471541Srgrimes	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
1481541Srgrimes	-mkdir ${RELEASEDIR}
1491541Srgrimes	chflags -R noschg ${RELEASEDIR}/.
1501541Srgrimes	rm -rf ${RELEASEDIR}/*
1511541Srgrimes	mkdir ${RD}
1521541Srgrimes	mkdir ${RD}/floppies
1531541Srgrimes	mkdir ${RD}/trees
1541541Srgrimes	mkdir ${RD}/dists
1551541Srgrimes	for i in ${ALL_DISTS} ; do \
1561541Srgrimes		mkdir ${RD}/trees/$$i ; \
1571541Srgrimes		mkdir ${RD}/dists/$$i ; \
1581541Srgrimes		mtree -deU -f ${MTREEFILES}/BSD.root.dist \
1591541Srgrimes		    -p ${RD}/trees/$$i > /dev/null ; \
1601541Srgrimes		mtree -deU -f ${MTREEFILES}/BSD.usr.dist \
1611541Srgrimes		    -p ${RD}/trees/$$i/usr > /dev/null ; \
1621541Srgrimes		mtree -deU -f ${MTREEFILES}/BSD.include.dist \
1631541Srgrimes		    -p ${RD}/trees/$$i/usr/include > /dev/null ; \
1641541Srgrimes		mtree -deU -f ${MTREEFILES}/BSD.var.dist \
1651541Srgrimes		    -p ${RD}/trees/$$i/var > /dev/null ; \
1661541Srgrimes	done
1671541Srgrimes	touch release.1
1681541Srgrimes
1691541Srgrimes# Install the system into the various distributions.
1701541Srgrimesrelease.2:
1711541Srgrimes	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
1721541Srgrimes	cd ${.CURDIR}/../etc && make distrib-dirs DESTDIR=${RD}/trees/bin
1731541Srgrimes	cd ${.CURDIR}/.. ; make distribute DISTDIR=${RD}/trees
1741541Srgrimes	chflags -R noschg ${RD}/trees
1751541Srgrimes	uudecode ${.CURDIR}/compat20/libgcc.so.261.0.uu
1761541Srgrimes	install -m 444 -o bin -g bin libgcc.so.261.0 ${RD}/trees/bin/usr/lib
1771541Srgrimes	touch release.2
1781541Srgrimes
1791541Srgrimes# Make and install a couple of kernels we need.
1801541Srgrimesrelease.3:
1811541Srgrimes	rm -rf ${RD}/kernels
1821541Srgrimes	mkdir -p ${RD}/kernels
1831541Srgrimes	@cd ${.CURDIR} && $(MAKE) ckRELEASEDIR
1841541Srgrimes	cd ${.CURDIR}/../sys/i386/conf && \
1851541Srgrimes		sed 's/GENERIC/BOOTCDROM/g' GENERIC > BOOTCDROM
1861541Srgrimes	for i in GENERIC BOOTCDROM ; do \
1871541Srgrimes		cd ${.CURDIR}/../sys/i386/conf && \
1881541Srgrimes			config $$i && \
1891541Srgrimes		cd ${.CURDIR}/../sys/compile/$$i && \
1901541Srgrimes			make depend && \
1911541Srgrimes			make kernel && \
1921541Srgrimes			cp kernel ${RD}/kernels/$$i ; \
1931541Srgrimes		rm -rf ${.CURDIR}/../sys/compile/$$i ; \
1941541Srgrimes	done
1951541Srgrimes	rm -f ${.CURDIR}/../sys/i386/conf/BOOTCDROM
1961541Srgrimes	cd ${RD}/kernels && kzip GENERIC
1971541Srgrimes	touch release.3
1981541Srgrimes
1991541Srgrimes# Make and install the three crunched binaries which live on the floppies.
2001541Srgrimes# You are not supposed to like this :-)
2011541Srgrimesrelease.4:
2021541Srgrimes	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
2031541Srgrimes	rm -rf ${RD}/crunch
2041541Srgrimes	mkdir -p ${RD}/crunch
2051541Srgrimes	for j in ${WHICH_CRUNCH} ; do \
2061541Srgrimes		rm -rf $${j}_crunch && \
2071541Srgrimes		mkdir $${j}_crunch && \
2081541Srgrimes		( cd $${j}_crunch && \
2091541Srgrimes		crunchgen ${.CURDIR}/$${j}_crunch.conf && \
2101541Srgrimes		${MAKE} -f $${j}_crunch.mk objs exe NOCRYPT=yes \
2111541Srgrimes		    "CFLAGS=${CFLAGS} -DCRUNCHED_BINARY") && \
2121541Srgrimes		mv $${j}_crunch/$${j}_crunch ${RD}/crunch/$${j} && \
2131541Srgrimes		rm -rf $${j}_crunch ; \
2141541Srgrimes	done
2151541Srgrimes	touch release.4
2161541Srgrimes
2171541Srgrimes# Fix up the distributions.
2186283Swollmanrelease.5:
2191541Srgrimes	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
2206283Swollman	ln -f ${RD}/kernels/GENERIC ${RD}/trees/bin/kernel.GENERIC
2216283Swollman	if [ -d ${RD}/trees/bin/usr/share/man ] ; then \
2226283Swollman		rm -rf ${RD}/trees/manpages/usr/share/man ;\
2236283Swollman		mv ${RD}/trees/bin/usr/share/man \
2246283Swollman			${RD}/trees/manpages/usr/share/man ;\
2251541Srgrimes	fi
2261541Srgrimes	if [ -d ${RD}/trees/bin/usr/games ] ; then \
2271541Srgrimes		rm -rf ${RD}/trees/games/usr/games ;\
2281541Srgrimes		mv ${RD}/trees/bin/usr/games \
2291541Srgrimes			${RD}/trees/games/usr/games ;\
2301541Srgrimes	fi
2311541Srgrimes	if [ -d ${RD}/trees/bin/usr/share/games ] ; then \
2321541Srgrimes		rm -rf ${RD}/trees/games/usr/share/games ;\
2331541Srgrimes		mv ${RD}/trees/bin/usr/share/games \
2341541Srgrimes			${RD}/trees/games/usr/share/games ;\
2351541Srgrimes	fi
2361541Srgrimes	if [ -d ${RD}/trees/bin/var/games ] ; then \
2371541Srgrimes		rm -rf ${RD}/trees/games/var/games ;\
2381541Srgrimes		mv ${RD}/trees/bin/var/games \
2391541Srgrimes			${RD}/trees/games/var/games ;\
2401541Srgrimes	fi
2411541Srgrimes	if [ -d ${RD}/trees/bin/usr/share/dict ] ; then \
2421541Srgrimes		rm -rf ${RD}/trees/dict/usr/share/dict ;\
2431541Srgrimes		mv ${RD}/trees/bin/usr/share/dict \
2441541Srgrimes			${RD}/trees/dict/usr/share/dict ;\
2451541Srgrimes	fi
2461541Srgrimes	for i in airport birthtoken flowers na.phone zipcodes ; do \
2471541Srgrimes		if [ -f ${RD}/trees/bin/usr/share/misc/$$i ] ; then \
2481541Srgrimes			mv ${RD}/trees/bin/usr/share/misc/$$i \
2491541Srgrimes				${RD}/trees/dict/usr/share/misc ; \
2501541Srgrimes		fi ; \
2511541Srgrimes	done
2521541Srgrimes	-mv ${RD}/trees/bin/usr/share/info/* \
2531541Srgrimes		${RD}/trees/info/usr/share/info
2541541Srgrimes	for i in ${RD}/trees/bin/usr/lib/*_p.a ; do \
2551541Srgrimes		if [ -f $$i ] ; then \
2561541Srgrimes			mv $$i \
2571541Srgrimes				${RD}/trees/proflibs/usr/lib ; \
2581541Srgrimes		fi ; \
2591541Srgrimes	done
2601541Srgrimes	cd ${RD}/trees/bin/usr/share/misc && rm -f termcap.db vgrindefs.db
2611541Srgrimes	-cd ${RD}/trees && \
2621541Srgrimes		find ${EXTRA_DISTS} -depth -type d -print | xargs rmdir
2631541Srgrimes	touch release.5
2641541Srgrimes
2651541Srgrimes# Make binary dists, notice that DES dist isn't finished yet.
2661541Srgrimesrelease.6:
2671541Srgrimes	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
2681541Srgrimes	rm -rf ${RD}/dists
2691541Srgrimes	mkdir -p ${RD}/dists
2701541Srgrimes	mkdir -p ${RD}/info
2711541Srgrimes	@for i in ${DISTRIBUTIONS} ; \
2721541Srgrimes	do \
2731541Srgrimes		if [ -d ${RD}/trees/$${i} ] ; then \
2741541Srgrimes			cd ${.CURDIR} ; \
2751541Srgrimes				$(MAKE) doTARBALL SD=${RD}/trees/$${i} \
2761541Srgrimes					TN=$$i TD=$$i ARG="." ; \
2771541Srgrimes			echo "$${i} distribution is finished."; \
2781541Srgrimes		fi ; \
2791541Srgrimes	done                                                 
2801541Srgrimes	touch release.8
2811541Srgrimes
2821541Srgrimes
2831541Srgrimes# Make source dists, and finish of DES too
2841541Srgrimesrelease.7:
2851541Srgrimes	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
2861541Srgrimes	@cd ${.CURDIR} ; $(MAKE) doTARBALL SD=/usr/src \
2871541Srgrimes		TD=src TN=sbase ARG="[A-Z]*"
2881541Srgrimes	@for i in `cd /usr/src ; echo [a-z]*` ; do \
2891541Srgrimes		if [ -d /usr/src/$$i -a "$$i" != "CVS" ] ; then \
2901541Srgrimes			cd ${.CURDIR} ; \
2911541Srgrimes			$(MAKE) doTARBALL SD=/usr/src \
2921541Srgrimes				TN=`echo s$$i | tr -d '.' | sed 's/usr/u/'` \
2931541Srgrimes				TD=src ARG="$$i" ; \
2941541Srgrimes		fi ; \
2951541Srgrimes	done
2961541Srgrimes	( cd ${RD}/dists/src && \
2971541Srgrimes	if [ -f sdes.aa ] ; then mv sdes.* ../des ; fi && \
2981541Srgrimes	if [ -f sebones.aa ] ; then mv sebones.* ../des ; fi )
2991541Srgrimes	@echo "src distribution is finished."
3001541Srgrimes	touch release.9
3011541Srgrimes
3021541Srgrimes# Complete the bootfd 
3031541Srgrimesrelease.8:
3041541Srgrimes	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
3051541Srgrimes	rm -rf ${RD}/bootfd
3061541Srgrimes	mkdir ${RD}/bootfd
3071541Srgrimes	cd ${RD}/bootfd && \
3081541Srgrimes		mkdir -p dev mnt stand/help
3091541Srgrimes	ln -f ${RD}/kernels/GENERIC.kz ${RD}/bootfd/kernel
3101541Srgrimes	@cd ${.CURDIR} ; $(MAKE) installCRUNCH CRUNCH=boot \
3111541Srgrimes		DIR=${RD}/bootfd/stand ZIP=true
3121541Srgrimes	( cd ${RD}/trees/bin/dev ; \
3131541Srgrimes		ls console tty ttyv1 null zero \
3141541Srgrimes		*[sw]d* cuaa[01] fd[01] rfd[01] \
3151541Srgrimes		cd0a mcd0a scd0a matcd0a rst0 ft0 rwt0 | \
3161541Srgrimes	cpio -dump ${RD}/bootfd/dev )
3171541Srgrimes	tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall help | \
3181541Srgrimes		tar xvf - -C ${RD}/bootfd/stand
3191541Srgrimes	install -c ${.CURDIR}/../COPYRIGHT ${RD}/bootfd/stand/help/en_US.ISO8859-1/COPYRIGHT
3201541Srgrimes	cd ${RD}/trees/bin/usr/share/FAQ/Text ; \
3211541Srgrimes		install -c RELNOTES.FreeBSD ${RD}/bootfd/stand/help/en_US.ISO8859-1/RELNOTES; \
3221541Srgrimes		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.6
326
327# Complete the cpiofd directory
328release.9:
329	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
330	rm -rf ${RD}/cpiofd
331	mkdir ${RD}/cpiofd
332	cd ${RD}/cpiofd && \
333		mkdir stand stand/info
334	ln -f ${RD}/kernels/GENERIC ${RD}/cpiofd/kernel
335	@cd ${.CURDIR} ; $(MAKE) installCRUNCH CRUNCH=cpio \
336		DIR=${RD}/cpiofd/stand ZIP=false
337	cd ${RD}/trees/bin ; ls ${CPIO1} | cpio -dump ${RD}/cpiofd/stand
338	tar --exclude CVS -cf - -C ${.CURDIR}/sysinstall info | tar xvf - -C ${RD}/cpiofd/stand
339	cd ${RD}/cpiofd ; ( rm -f OK ; find . -print ; touch OK ; echo OK ) | cpio -H newc -oa | gzip -9 -c | dd conv=osync > ${RD}/floppies/cpio.flp
340	touch release.7
341
342# Complete the fixitfd
343release.10:
344	@cd ${.CURDIR} ; $(MAKE) ckRELEASEDIR
345	rm -rf ${RD}/fixitfd
346	mkdir ${RD}/fixitfd
347	cd ${RD}/fixitfd && \
348		mkdir stand bin sbin etc mnt mnt1 mnt2 mnt3 mnt4 tmp
349	ln -f ${RD}/kernels/GENERIC.kz ${RD}/fixitfd/kernel
350	@cd ${.CURDIR} ; $(MAKE) installCRUNCH CRUNCH=fixit \
351		DIR=${RD}/fixitfd/stand ZIP=true
352	( cd ${RD}/trees/bin/dev && \
353		sh MAKEDEV wd0s5 wd0s6 wd0s7 wd0s8 && \
354		ls console tty ttyv1 null zero \
355		*[sw]d* fd[01] rfd[01] | \
356	cpio -dump ${RD}/fixitfd/dev )
357	ln -f ${RD}/fixitfd/stand/init ${RD}/fixitfd/sbin
358	ln -f ${RD}/fixitfd/stand/sh ${RD}/fixitfd/bin
359	cp ${RD}/trees/bin/usr/mdec/fdboot ${RD}/fixitfd/etc/boot1
360	cp ${RD}/trees/bin/usr/mdec/bootfd ${RD}/fixitfd/etc/boot2
361	cp ${.CURDIR}/fixit.profile ${RD}/fixitfd/.profile
362	echo 'echo /etc/rc'	> ${RD}/fixitfd/etc/rc
363	echo 'exit 1'		>> ${RD}/fixitfd/etc/rc
364	touch ${RD}/fixitfd/etc/spwd.db
365	cd ${.CURDIR} ; ${MAKE} doFLOPPY FLOPPY=fixit
366	touch release.10
367
368ftp.1:
369	rm -rf ${FD}
370	mkdir ${FD}
371	cd ${RD} && find floppies -print | cpio -dumpl ${FD}
372	cd ${RD}/dists && find . -print | cpio -dumpl ${FD}
373	cd ${RD}/trees/bin/usr/share/FAQ/Text && ln -f ${FAQS} ${FD}
374
375	# This rule makes ${CHROOTDIR}/R/ftp a suitable anon ftp for testing.
376ftp.2:
377	-mkdir ${FD}/bin
378	ln -f ${RD}/trees/bin/bin/ls ${FD}/bin/ls
379
380cdrom.1:
381	rm -rf ${CD}
382	mkdir ${CD}
383	mkdir ${CD}/filesys
384	cd ${RD} && find floppies dists bootfd -print | cpio -dumpl ${CD}
385	cd ${CD} && mv bootfd bootcd
386	rm -f ${CD}/bootcd/kernel
387	ln -f ${RD}/kernels/BOOTCDROM ${CD}/bootcd/kernel
388	ln -f ${RD}/trees/bin/usr/mdec/fbsdboot.exe ${CD}/bootcd
389	for i in ${DISTRIBUTIONS} ; \
390	do \
391		if [ -d ${RD}/trees/$${i} ] ; then \
392			( cd ${RD}/trees/$${i} && \
393			find . -depth -print | cpio -dumpl ${CD}/filesys ) ; \
394		fi \
395	done
396
397# Various "subroutine" and other supporting targets.
398
399doTARBALL:
400.if !defined(SD)
401	@echo "SD undefined in doTARBALL" ; exit 1
402.endif               
403.if !defined(TD)
404	@echo "TB undefined in doTARBALL" ; exit 1
405.endif               
406.if !defined(ARG)
407	@echo "ARG undefined in doTARBALL" ; exit 1
408.endif               
409	rm -rf ${RD}/dists/${TD}/${TN}*
410	mkdir -p ${RD}/dists/${TD}
411	( cd ${SD} && \
412		tn=`echo ${TN} | tr '[A-Z]' '[a-z]' | cut -c1-8` && \
413		echo rolling ${TD}/$$tn tarball &&\
414		tar --exclude CVS --exclude obj -cf - ${ARG} | \
415		${ZIPNSPLIT} ${RD}/dists/${TD}/$$tn. && \
416		cd ${RD}/info && \
417		mkdir ${TD} && \
418		echo ${SD}/${TD}/$$tn.* | wc | awk ' { print "Pieces = ", $$1 } ' > ${TD}/$$tn.inf
419	}
420
421doRELEASE:  release.1 release.2 release.3 release.4 release.5 release.6 \
422		release.7 release.8 release.9 release.10
423	cd ${.CURDIR} && ${MAKE} cdrom.1 ftp.1
424	@echo "Release done"
425
426floppies:
427	rm -f release.4 release.8 release.9
428	cd ${.CURDIR} && ${MAKE} doRELEASE
429
430boot.flp:
431	rm -f release.4 release.6
432	cd ${.CURDIR} && ${MAKE} release.4 release.6 WHICH_CRUNCH=boot
433
434fixit.flp:
435	rm -f release.4 release.10
436	cd ${.CURDIR} && ${MAKE} release.4 release.10 WHICH_CRUNCH=fixit
437
438ckRELEASEDIR:
439.if !defined(RELEASEDIR)
440	@echo "To make a release RELEASEDIR must be defined" && false
441.endif               
442
443doFLOPPY:
444.if !defined(FLOPPY)
445	@echo "FLOPPY undefined in doFLOPPY" ; exit 1
446.endif
447	rm -f ${RD}/floppies/${FLOPPY}.tmp ${RD}/floppies/${FLOPPY}.flp
448.if defined(VNDEVICE)
449	if [ ! -b /dev/${VNDEVICE} -o ! -c /dev/r${VNDEVICE} ] ; then \
450		cd /dev && sh MAKEDEV ${VNDEVICE} ; fi
451	@umount /dev/${VNDEVICE} 2>/dev/null || true
452	@umount ${MNT} 2>/dev/null || true
453	@vnconfig -u /dev/r${VNDEVICE} 2>/dev/null || true
454	dd of=${RD}/floppies/${FLOPPY}.tmp if=/dev/zero \
455		bs=${FDCYLSIZE} count=${FDCYLS} 2>/dev/null
456	vnconfig -c /dev/r${VNDEVICE} ${RD}/floppies/${FLOPPY}.tmp
457	disklabel -w -r -B \
458		-b ${RD}/trees/bin/usr/mdec/fdboot \
459		-s ${RD}/trees/bin/usr/mdec/bootfd \
460		/dev/r${VNDEVICE} ${FDLABEL}
461	newfs ${NEWFSARGS} /dev/r${VNDEVICE}
462	mount /dev/${VNDEVICE} ${MNT}
463	cd ${RD}/${FLOPPY}fd ; find . -print | cpio -dump ${MNT}
464	umount ${MNT}
465	fsck  /dev/r${VNDEVICE} < /dev/null
466.else
467	-umount /dev/${FDDEVICE}
468	-umount ${MNT}
469.if !defined(FDFORMAT)
470	echo y | fdformat /dev/r${FDDEVICE}
471.endif
472	disklabel -w -r -B \
473		-b ${RD}/trees/bin/usr/mdec/fdboot \
474		-s ${RD}/trees/bin/usr/mdec/bootfd \
475		/dev/r${FDDEVICE} ${FDLABEL}
476	newfs ${NEWFSARGS} /dev/r${FDDEVICE}
477	mount /dev/${FDDEVICE} ${MNT}
478	cd ${RD}/${FLOPPY}fd ; find . -print | cpio -dump ${MNT}
479	umount ${MNT}
480	fsck -n /dev/r${FDDEVICE} < /dev/null
481	dd if=/dev/r${FDDEVICE} of=${RD}/floppies/${FLOPPY}.tmp \
482		bs=${FDCYLSIZE} count=${FDCYLS}
483.endif
484	mv ${RD}/floppies/${FLOPPY}.tmp ${RD}/floppies/${FLOPPY}.flp
485
486installCRUNCH:
487.if !defined(CRUNCH)
488	@echo "CRUNCH undefined in installCRUNCH" ; exit 1
489.endif
490.if !defined(DIR)
491	@echo "DIR undefined in installCRUNCH" ; exit 1
492.endif
493.if !defined(ZIP)
494	@echo "ZIP undefined in installCRUNCH" ; exit 1
495.endif
496	if ${ZIP} ; then \
497		gzip -9 < ${RD}/crunch/${CRUNCH} > ${DIR}/${CRUNCH}_crunch ; \
498	else \
499		ln -f ${RD}/crunch/${CRUNCH} ${DIR}/${CRUNCH}_crunch ; \
500	fi
501	chmod 555 ${DIR}/${CRUNCH}_crunch
502	for i in `crunchgen -l ${.CURDIR}/${CRUNCH}_crunch.conf` ; do \
503		ln -f ${DIR}/${CRUNCH}_crunch ${DIR}/$$i ; \
504	done
505.include <bsd.prog.mk>
506