Makefile revision 5569
1126430Snjl#	$Id: Makefile,v 1.74 1995/01/13 05:43:03 jkh Exp $
2126430Snjl#
3126430Snjl
4126430SnjlFLOPPY=		fd0
5126430Snjl
6126430Snjl
7126430Snjl# Evil floppies are, of course, 1.2MB floppies.
8126430Snjl.if defined(EVIL_FLOPPY)
9126430SnjlFDLABEL=	fd1200
10126430SnjlDDBS=		15k
11126430SnjlDDCOUNT=	80
12126430Snjl.else
13126430SnjlFDLABEL=	fd1440
14126430Snjl	DDBS=		18k
15126430Snjl	DDCOUNT=	80
16126430Snjl	.endif
17126430Snjl
18126430Snjl	MNT=		/mnt
19126430Snjl
20126430Snjl	CPIO1= basename cat chmod cksum cp cu date dd df dmesg echo ed expr hostname 
21126430Snjl	CPIO1+= kill ln ls mkdir mt mv rcp rm rmdir sh sleep stty sync tar test tip [ 
22126430Snjl	CPIO1+= -sh badsect chown clri disklabel dump dmesg fdisk fsck getopt ifconfig 
23126430Snjl	CPIO1+= init mknod mount mount_cd9660 mount_msdos mount_nfs ncftp newfs ping pwd
24126430Snjl	CPIO1+= reboot restore slattach swapon umount route
25126430Snjl	CPIO1+= rdump rrestore halt ft
26126430Snjl	CPIO1+= ftp rsh sed telnet rlogin grep
27126430Snjl
28126430Snjl	CPIO2=  etc/services etc/protocols
29143002Sobrien
30143002Sobrien	# bininst MUST be the last file on the cpio floppy.  It's used to detect
31143002Sobrien	# a successful extraction.
32126430Snjl	CPIO3=	miscfuncs.sh instdist.sh netinst.sh adduser.sh bininst
33126430Snjl
34126430Snjl	CPIO4=	/usr/sbin/tzsetup
35129879Sphk	CPIO4B=	tzsetup
36126430Snjl
37126430Snjl	# Somewhat on the rough side...
38126430Snjl	CLEANFILES+=	*.o *.c *.cache *.mk *.lo ${CPIO1} *.flp *.gz 
39126430Snjl	CLEANFILES+=	boot_flp cpio_flp_1
40126430Snjl
41193530Sjkim	MTREE_DIR=	${.CURDIR}/../etc/mtree
42193530Sjkim
43126430Snjl	ZIPNSPLIT=	gzip --no-name -9 -c | split -b 240640 -
44126430Snjl
45126430Snjl	hierarchy:
46126430Snjl		mtree -deU -f ${MTREE_DIR}/BSD.root.dist  -p ${DESTDIR}/
47126430Snjl		mtree -deU -f ${MTREE_DIR}/BSD.var.dist   -p ${DESTDIR}/var
48126430Snjl		mtree -deU -f ${MTREE_DIR}/BSD.usr.dist   -p ${DESTDIR}/usr
49126430Snjl	.if defined(MAKE_LOCAL)
50126430Snjl		mtree -deU -f ${MTREE_DIR}/BSD.local.dist -p ${DESTDIR}/usr/local
51126430Snjl	.endif
52126430Snjl		rm -f ${DESTDIR}/sys
53126430Snjl		ln -s usr/src/sys ${DESTDIR}/sys
54126430Snjl
55126430Snjl	kernel:	${.CURDIR}/../sys/i386/conf/GENERIC
56126430Snjl		if [ ! -f ${.CURDIR}/../sys/compile/GENERIC ]; then \
57126430Snjl			(cd ${.CURDIR}/../sys/i386/conf; config GENERIC); \
58126430Snjl			(cd ${.CURDIR}/../sys/compile/GENERIC; \
59126430Snjl				${MAKE} depend; ${MAKE} all; ) \
60126430Snjl		fi
61126430Snjl
62126430Snjl	boot_12.flp: 
63126430Snjl		(cd ${.CURDIR}; EVIL_FLOPPY=yes ${MAKE} boot.flp)
64126430Snjl		mv boot.flp boot_12.flp
65126430Snjl		gzip -9 -c < boot_12.flp > boot_12.flp.gz &
66126430Snjl
67126430Snjl	boot_144.flp:
68132526Snjl		(cd ${.CURDIR}; ${MAKE} boot.flp)
69126430Snjl		mv boot.flp boot_144.flp
70126430Snjl		gzip -9 -c < boot_144.flp > boot_144.flp.gz &
71126430Snjl
72126430Snjl	boot.flp: 
73126430Snjl		crunchgen ${.CURDIR}/boot_flp.conf
74153578Sjhb		${MAKE} -f boot_flp.mk objs exe NOCRYPT=yes
75126430Snjl		-umount ${MNT}
76126430Snjl		-umount /dev/${FLOPPY}
77126430Snjl		# echo y | fdformat ${FLOPPY}
78126430Snjl		disklabel -w -B \
79126430Snjl			-b ${DESTDIR}/usr/mdec/fdboot -s ${DESTDIR}/usr/mdec/bootfd \
80126430Snjl			/dev/r${FLOPPY} ${FDLABEL}
81126430Snjl		newfs -c 80 -b 4096 -f 512 -i 9000 -m 0 -o space /dev/r${FLOPPY}
82132526Snjl		mount -o async /dev/${FLOPPY} ${MNT}
83126430Snjl		mkdir ${MNT}/dev ${MNT}/stand ${MNT}/mnt
84126430Snjl	.if !defined(EVIL_FLOPPY)
85126430Snjl		strip -x ${.CURDIR}/../sys/compile/GENERIC/kernel
86203810Sjkim	.else
87126430Snjl		strip ${.CURDIR}/../sys/compile/GENERIC/kernel
88126430Snjl	.endif
89126430Snjl		cp ${.CURDIR}/../sys/compile/GENERIC/kernel ${MNT}/kernel
90126430Snjl		cp ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/bootsd ${MNT}/stand
91126430Snjl		( cd ${DESTDIR}/dev ; \
92126430Snjl			ls console tty ttyv1 null zero \
93126430Snjl			sd[0123][a-h] wd[0123][a-h] fd[01] \
94126430Snjl			rsd[0123][a-h] rwd[0123][a-h] rfd[01] \
95132526Snjl		| cpio -dumpv ${MNT}/dev \
96133625Snjl		)
97203810Sjkim		gzip -9 < boot_flp > ${MNT}/stand/sysinstall
98126430Snjl		chmod 755 ${MNT}/stand/sysinstall
99126430Snjl		ln ${MNT}/stand/sysinstall ${MNT}/stand/newfs
100133625Snjl		ln ${MNT}/stand/sysinstall ${MNT}/stand/gzip
101126430Snjl		ln ${MNT}/stand/sysinstall ${MNT}/stand/fsck
102126430Snjl	.if !defined(EVIL_FLOPPY)
103126430Snjl		install -m 400 -c ${.CURDIR}/../COPYRIGHT ${MNT}/COPYRIGHT
104203936Sjkim		install -m 400 -c ${.CURDIR}/../share/FAQ/diskspace.FAQ \
105203936Sjkim			${MNT}/DISKSPACE.FAQ
106203936Sjkim	.endif
107203810Sjkim		install -m 400 -c ${.CURDIR}/../share/FAQ/RELNOTES.FreeBSD \
108203810Sjkim			${MNT}/RELNOTES.FreeBSD
109203936Sjkim		install -m 400 -c ${.CURDIR}/../share/FAQ/TROUBLESHOOTING \
110126430Snjl			${MNT}/TROUBLESHOOTING
111126430Snjl		install -m 400 -c ${.CURDIR}/../share/FAQ/README-2.0 ${MNT}/README
112203936Sjkim		touch ${MNT}/this_is_boot_flp
113203936Sjkim		-umount ${MNT}
114203936Sjkim		fsck /dev/r${FLOPPY}
115203936Sjkim		dd if=/dev/r${FLOPPY} bs=${DDBS} count=${DDCOUNT} of=boot.flp
116203936Sjkim	df -k /dev/r${FLOPPY}
117126430Snjl
118126430Snjlcpio.flp:
119203936Sjkim	crunchgen ${.CURDIR}/cpio_flp_1.conf
120203936Sjkim	${MAKE} -f cpio_flp_1.mk objs exe NOCRYPT=yes
121203936Sjkim	for i in ${CPIO1} ; do rm -f ./$$i ; ln cpio_flp_1 ./$$i ; done
122203936Sjkim	( cd /${DESTDIR} ; ls ${CPIO2} | cpio -H newc -oa ) | cpio -ivd
123203936Sjkim	( cd ${.CURDIR} ; ls ${CPIO3} | cpio -H newc -oa ) | cpio -ivd
124203936Sjkim	cp ${CPIO4} .
125203936Sjkim	ls ${CPIO1} ${CPIO2} ${CPIO3} ${CPIO4B} | \
126203936Sjkim		cpio -H newc -oa | gzip -9 | \
127203936Sjkim		dd conv=osync > cpio.flp
128203936Sjkim	gzip -9 -v < cpio.flp > cpio.flp.gz &
129203936Sjkim
130203936Sjkimfloppies: boot_144.flp boot_12.flp cpio.flp
131203936Sjkim
132203936Sjkimrelease20: 
133132526Snjl.if !defined(RELEASEDIR)
134203936Sjkim	@echo "Do NOT invoke this target without a RELEASEDIR defined."
135126430Snjl	@echo "It will otherwise blow away your root directory!"
136126430Snjl	@exit 1
137203936Sjkim.endif
138203936Sjkim	@echo "Did you remember to increment the release number?"
139126430Snjl	( cd ${.CURDIR} ; ${MAKE} clean)
140126430Snjl	-mkdir ${RELEASEDIR}
141203936Sjkim	chflags -R noschg ${RELEASEDIR}/.
142203936Sjkim	rm -rf ${RELEASEDIR}/*
143203936Sjkim	( cd ${.CURDIR}/.. ;  \
144203936Sjkim		${MAKE} all distribute NOCRYPT=yes)
145203936Sjkim	( cd ${.CURDIR}/../etc ;  \
146126430Snjl		${MAKE} release-dirs )
147126430Snjl	( cd ${.CURDIR} ; ${MAKE} obj)
148203936Sjkim	( cd ${.CURDIR} ;  \
149203936Sjkim		${MAKE} kernel DESTDIR=${RELEASEDIR}/filesys )
150203936Sjkim	install ${COPY} -m 644 ${.CURDIR}/../sys/compile/GENERIC/kernel \
151203936Sjkim		${RELEASEDIR}/filesys/kernel
152126430Snjl	( cd ${.CURDIR} ;  \
153126430Snjl		${MAKE} hierarchy DESTDIR=${RELEASEDIR}/filesys )
154153578Sjhb	( cd ${.CURDIR}/../etc ; \
155126430Snjl		${MAKE} distribution DESTDIR=${RELEASEDIR}/filesys \
156126430Snjl			NOCRYPT=yes SHARED=copies)
157126430Snjl	( cd ${RELEASEDIR}/filesys; \
158126430Snjl		tar cf - . | \
159126430Snjl		${ZIPNSPLIT} ${RELEASEDIR}/tarballs/bindist/bindist.)
160126430Snjl	cp ${.CURDIR}/extract.sh ${RELEASEDIR}/tarballs/bindist
161126430Snjl	( cd ${RELEASEDIR}/tarballs/bindist; ${.CURDIR}/mkchecksums.sh )
162126430Snjl	( cd ${.CURDIR} ;  \
163126430Snjl		${MAKE} floppies )
164126430Snjlfoo:
165126430Snjl	( cd ${.CURDIR}/../etc ; \
166126430Snjl		${MAKE} srcebones-tarball \
167126430Snjl			DESTDIR=${RELEASEDIR}/filesys \
168126430Snjl			NOCRYPT=yes SHARED=copies )
169126430Snjl		
170153578Sjhbbar:
171126430Snjl	( cd ${.CURDIR}/../etc ; \
172128036Snjl		${MAKE} des-tarball \
173126430Snjl			DESTDIR=${RELEASEDIR}/filesys \
174132526Snjl			SHARED=copies )
175132526Snjl
176161184SbrunoEXTRADISTRIBUTIONS=	secrdist srcdist games manpages proflibs dict infodist
177161184SbrunoDISTRIBUTIONS=	bindist ${EXTRADISTRIBUTIONS}
178126430SnjlMTREEFILES=	${.CURDIR}/../etc/mtree
179197648SjhbSECRSRC=	src/secure src/eBones
180197648Sjhb
181197648Sjhbdistribute: 
182197648Sjhb	-mkdir ${RELEASEDIR}
183197648Sjhb	chflags -R noschg ${RELEASEDIR}/.
184133625Snjl	rm -rf ${RELEASEDIR}/*
185197648Sjhb	for i in ${DISTRIBUTIONS} ; \
186227293Sed	do \
187126430Snjl	mkdir ${RELEASEDIR}/$$i ; \
188126430Snjl	mtree -deU -f ${MTREEFILES}/BSD.root.dist -p ${RELEASEDIR}/$$i/ ; \
189126430Snjl	mtree -deU -f ${MTREEFILES}/BSD.var.dist -p ${RELEASEDIR}/$$i/var ; \
190126430Snjl	mtree -deU -f ${MTREEFILES}/BSD.usr.dist -p ${RELEASEDIR}/$$i/usr ; \
191137438Snjl	done 
192126430Snjl	( cd ${.CURDIR} ;  \
193137438Snjl		${MAKE} kernel DESTDIR=${RELEASEDIR}/filesys )
194126430Snjl	install ${COPY} -m 644 ${.CURDIR}/../sys/compile/GENERIC/kernel \
195126430Snjl		${RELEASEDIR}/bindist/kernel
196126430Snjl
197126430Snjlbeforetarballs:
198126430Snjl	rm -rf ${RELEASEDIR}/manpages/usr/share/man
199161184Sbruno	mv ${RELEASEDIR}/bindist/usr/share/man \
200161184Sbruno		${RELEASEDIR}/manpages/usr/share/man
201126430Snjl	rm -rf ${RELEASEDIR}/games/usr/games
202126430Snjl	mv ${RELEASEDIR}/bindist/usr/games \
203126430Snjl		${RELEASEDIR}/games/usr/games
204132256Snjl	rm -rf ${RELEASEDIR}/games/usr/share/games
205126430Snjl	mv ${RELEASEDIR}/bindist/usr/share/games \
206126430Snjl		${RELEASEDIR}/games/usr/share/games
207126430Snjl	rm -rf ${RELEASEDIR}/dict/usr/share/dict
208126430Snjl	mv ${RELEASEDIR}/bindist/usr/share/dict \
209126430Snjl		${RELEASEDIR}/dict/usr/share/dict
210126430Snjl	mv ${RELEASEDIR}/bindist/usr/share/misc/airport \
211126430Snjl	   ${RELEASEDIR}/bindist/usr/share/misc/birthtoken \
212126430Snjl	   ${RELEASEDIR}/bindist/usr/share/misc/flowers \
213126430Snjl	   ${RELEASEDIR}/bindist/usr/share/misc/na.phone \
214153578Sjhb	   ${RELEASEDIR}/bindist/usr/share/misc/zipcodes \
215153578Sjhb		${RELEASEDIR}/dict/usr/share/misc
216153578Sjhb	mv ${RELEASEDIR}/bindist/usr/lib/*_p.a \
217153578Sjhb		${RELEASEDIR}/proflibs/usr/lib
218153578Sjhb	-cd ${RELEASEDIR} ; \
219153578Sjhb	find ${EXTRADISTRIBUTIONS} -depth -type d -print | xargs rmdir
220153578Sjhb	mkdir -p ${RELEASEDIR}/secrdist/usr
221153578Sjhb	cd ${RELEASEDIR}/secrdist/usr ; cvs export -r ${RELEASETAG} ${SECRSRC}
222126430Snjl	mkdir -p ${RELEASEDIR}/srcdist/usr
223126430Snjl	cd ${RELEASEDIR}/srcdist/usr ; cvs export -r ${RELEASETAG} src
224126430Snjl	cd ${RELEASEDIR}/srcdist/usr/src ; rm -rf secure kerberosIV eBones
225132526Snjl
226132526Snjltarballs:
227126430Snjl	rm -rf ${RELEASEDIR}/tarballs
228132526Snjl	mkdir ${RELEASEDIR}/tarballs
229132526Snjl	@for i in ${DISTRIBUTIONS} ; \
230132526Snjl	do \
231132526Snjl		mkdir ${RELEASEDIR}/tarballs/$${i} ; \
232132526Snjl		( cd ${RELEASEDIR}/$${i}; \
233132526Snjl			tar cf - . | \
234132526Snjl			${ZIPNSPLIT} ${RELEASEDIR}/tarballs/$$i/$${i}.) ; \
235126430Snjl	( cd ${RELEASEDIR}/tarballs/$${i}; sh -e ${.CURDIR}/mkchecksums.sh ) ; \
236132526Snjl	cp ${.CURDIR}/extract.sh ${RELEASEDIR}/tarballs/$${i} ;\
237132526Snjl	echo "$${i} distribution is finished."; \
238126430Snjl	done
239126430Snjl
240126430Snjl.include <bsd.prog.mk>
241126430Snjl