Makefile revision 4734
1#	$Id: Makefile,v 1.55 1994/11/20 23:31:36 wollman Exp $
2#
3
4# Evil floppies are, of course, 1.2MB floppies.
5FLOPPY=		fd0
6#EVIL_FLOPPY=	yes
7
8.if defined(EVIL_FLOPPY)
9FDLABEL=	fd1200
10DDBS=		15k
11DDCOUNT=	80
12.else
13FDLABEL=	fd1440
14DDBS=		18k
15DDCOUNT=	80
16.endif
17
18MNT=		/mnt
19
20CPIO1= basename cat chmod cksum cp cu date dd df dmesg echo ed expr hostname 
21CPIO1+= kill ln ls mkdir mt mv rcp rm rmdir sh sleep stty sync tar test tip [ 
22CPIO1+= -sh badsect chown clri disklabel dump dmesg fdisk fsck getopt ifconfig 
23CPIO1+= init mknod mount mount_cd9660 mount_msdos mount_nfs ncftp newfs ping pwd
24CPIO1+= reboot restore slattach swapon umount route
25CPIO1+= rdump rrestore halt ft
26CPIO1+= ftp rsh sed telnet rlogin grep
27
28CPIO2=  etc/services etc/protocols
29
30# bininst MUST be the last file on the cpio floppy.  It's used to detect
31# a successful extraction.
32CPIO3=	miscfuncs.sh instdist.sh netinst.sh adduser.sh bininst
33
34CPIO4=	/usr/sbin/tzsetup
35
36# Somewhat on the rough side...
37CLEANFILES+=	*.o *.c *.cache *.mk *.lo ${CPIO1} *.flp *.gz 
38CLEANFILES+=	boot_flp boot.flp cpio_flp_1
39
40MTREE_DIR=	${.CURDIR}/../etc/mtree
41
42ZIPNSPLIT=	gzip --no-name -9 -c | split -b 240640 -
43
44hierarchy:
45	mtree -deU -f ${MTREE_DIR}/BSD.root.dist  -p ${DESTDIR}/
46	mtree -deU -f ${MTREE_DIR}/BSD.var.dist   -p ${DESTDIR}/var
47	mtree -deU -f ${MTREE_DIR}/BSD.usr.dist   -p ${DESTDIR}/usr
48.if defined(MAKE_LOCAL)
49	mtree -deU -f ${MTREE_DIR}/BSD.local.dist -p ${DESTDIR}/usr/local
50.endif
51	rm -f ${DESTDIR}/sys
52	ln -s usr/src/sys ${DESTDIR}/sys
53
54kernel:	${.CURDIR}/../sys/i386/conf/GENERIC
55	(cd ${.CURDIR}/../sys/i386/conf; config GENERIC)
56	(cd ${.CURDIR}/../sys/compile/GENERIC; ${MAKE} depend; ${MAKE} all; )
57
58boot.flp: 
59	crunchgen ${.CURDIR}/boot_flp.conf
60	${MAKE} -f boot_flp.mk objs exe
61	-umount ${MNT}
62	-umount /dev/${FLOPPY}
63	# echo y | fdformat ${FLOPPY}
64	disklabel -w -B \
65		-b ${DESTDIR}/usr/mdec/fdboot -s ${DESTDIR}/usr/mdec/bootfd \
66		/dev/r${FLOPPY} ${FDLABEL}
67	newfs -c 80 -b 4096 -f 512 -i 8192 -m 0 -o space /dev/r${FLOPPY}
68	mount -o async /dev/${FLOPPY} ${MNT}
69	mkdir ${MNT}/dev ${MNT}/stand ${MNT}/mnt
70	strip -x ${.CURDIR}/../sys/compile/GENERIC/kernel
71	cp ${.CURDIR}/../sys/compile/GENERIC/kernel ${MNT}/kernel
72	cp ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/bootsd ${MNT}/stand
73	( cd ${DESTDIR}/dev ; \
74		ls console tty ttyv1 null zero \
75		sd[0123][a-h] wd[0123][a-h] fd[01] \
76		rsd[0123][a-h] rwd[0123][a-h] rfd[01] \
77	| cpio -dumpv ${MNT}/dev \
78	)
79	gzip -9 < boot_flp > ${MNT}/stand/sysinstall
80	chmod 755 ${MNT}/stand/sysinstall
81	ln ${MNT}/stand/sysinstall ${MNT}/stand/newfs
82	ln ${MNT}/stand/sysinstall ${MNT}/stand/gzip
83	ln ${MNT}/stand/sysinstall ${MNT}/stand/fsck
84	install -m 400 -c ${.CURDIR}/../COPYRIGHT ${MNT}/COPYRIGHT
85	install -m 400 -c ${.CURDIR}/../share/FAQ/README-2.0 ${MNT}/README
86	install -m 400 -c ${.CURDIR}/../share/FAQ/TROUBLESHOOTING \
87		${MNT}/TROUBLESHOOTING
88	install -m 400 -c ${.CURDIR}/../share/FAQ/DISKSPACE.FAQ \
89		${MNT}/DISKSPACE.FAQ
90	install -m 400 -c ${.CURDIR}/../share/FAQ/RELNOTES.FreeBSD \
91		${MNT}/RELNOTES.FreeBSD
92	touch ${MNT}/this_is_boot_flp
93	-umount ${MNT}
94	fsck /dev/r${FLOPPY}
95	dd if=/dev/r${FLOPPY} bs=${DDBS} count=${DDCOUNT} of=boot.flp
96	gzip -9 -v < boot.flp > boot.flp.gz
97	df -k /dev/r${FLOPPY}
98
99cpio.flp:
100	crunchgen ${.CURDIR}/cpio_flp_1.conf
101	${MAKE} -f cpio_flp_1.mk objs exe
102	for i in ${CPIO1} ; do rm -f ./$$i ; ln cpio_flp_1 ./$$i ; done
103	( cd /${DESTDIR} ; ls ${CPIO2} | cpio -H newc -oa ) | cpio -ivd
104	( cd ${.CURDIR} ; ls ${CPIO3} | cpio -H newc -oa ) | cpio -ivd
105	cp ${CPIO4} .
106	ls ${CPIO1} ${CPIO2} ${CPIO3} ${CPIO4} | \
107		cpio -H newc -oa | gzip -9 | \
108		dd conv=osync > cpio.flp
109	gzip -9 -v < cpio.flp > cpio.flp.gz
110	ls -l cpio.flp*
111
112crunch:
113	crunchgen ${.CURDIR}/boot_flp.conf
114	${MAKE} -f boot_flp.mk objs exe
115	crunchgen ${.CURDIR}/cpio_flp_1.conf
116	${MAKE} -f cpio_flp_1.mk objs exe
117
118floppies: crunch boot.flp cpio.flp
119
120release20: 
121	( cd ${.CURDIR} ; ${MAKE} clean)
122	-mkdir ${RELEASEDIR}
123	chflags -R noschg ${RELEASEDIR}/.
124	rm -rf ${RELEASEDIR}/*
125	( cd ${.CURDIR}/.. ;  \
126		${MAKE} world NOCRYPT=yes)
127	( cd ${.CURDIR}/../etc ;  \
128		${MAKE} release-dirs )
129	( cd ${.CURDIR} ; ${MAKE} obj)
130	( cd ${.CURDIR} ;  \
131		${MAKE} kernel DESTDIR=${RELEASEDIR}/filesys )
132	install ${COPY} -m 644 ${.CURDIR}/../sys/compile/GENERIC/kernel \
133		${RELEASEDIR}/filesys/kernel
134	( cd ${.CURDIR} ;  \
135		${MAKE} hierarchy DESTDIR=${RELEASEDIR}/filesys )
136	( cd ${.CURDIR}/../etc ; \
137		${MAKE} distribution DESTDIR=${RELEASEDIR}/filesys \
138			NOCRYPT=yes SHARED=copies)
139	( cd ${RELEASEDIR}/filesys; \
140		tar cf - . | \
141		${ZIPNSPLIT} ${RELEASEDIR}/tarballs/bindist/bindist.)
142	cp ${.CURDIR}/extract.sh ${RELEASEDIR}/tarballs/bindist
143	( cd ${RELEASEDIR}/tarballs/bindist; ${.CURDIR}/mkchecksums.sh )
144	( cd ${.CURDIR} ;  \
145		${MAKE} floppies )
146foo:
147	( cd ${.CURDIR}/../etc ; \
148		${MAKE} srcebones-tarball \
149			DESTDIR=${RELEASEDIR}/filesys \
150			NOCRYPT=yes SHARED=copies )
151		
152bar:
153	( cd ${.CURDIR}/../etc ; \
154		${MAKE} des-tarball \
155			DESTDIR=${RELEASEDIR}/filesys \
156			SHARED=copies )
157
158EXTRADISTRIBUTIONS=	des games manpages proflibs dict krb
159DISTRIBUTIONS=	bindist ${EXTRADISTRIBUTIONS}
160MTREEFILES=	${.CURDIR}/../etc/mtree
161
162distribute: 
163	-mkdir ${RELEASEDIR}
164	chflags -R noschg ${RELEASEDIR}/.
165	rm -rf ${RELEASEDIR}/*
166	for i in ${DISTRIBUTIONS} ; \
167	do \
168	mkdir ${RELEASEDIR}/$$i ; \
169	mtree -deU -f ${MTREEFILES}/BSD.root.dist -p ${RELEASEDIR}/$$i/ ; \
170	mtree -deU -f ${MTREEFILES}/BSD.var.dist -p ${RELEASEDIR}/$$i/var ; \
171	mtree -deU -f ${MTREEFILES}/BSD.usr.dist -p ${RELEASEDIR}/$$i/usr ; \
172	done 
173	( cd ${.CURDIR} ;  \
174		${MAKE} kernel DESTDIR=${RELEASEDIR}/filesys )
175	install ${COPY} -m 644 ${.CURDIR}/../sys/compile/GENERIC/kernel \
176		${RELEASEDIR}/bindist/kernel
177
178tarballs:
179	rm -rf ${RELEASEDIR}/manpages/usr/share/man
180	mv ${RELEASEDIR}/bindist/usr/share/man \
181		${RELEASEDIR}/manpages/usr/share/man
182	rm -rf ${RELEASEDIR}/games/usr/games
183	mv ${RELEASEDIR}/bindist/usr/games \
184		${RELEASEDIR}/games/usr/games
185	rm -rf ${RELEASEDIR}/games/usr/share/games
186	mv ${RELEASEDIR}/bindist/usr/share/games \
187		${RELEASEDIR}/games/usr/share/games
188	rm -rf ${RELEASEDIR}/dict/usr/share/dict
189	mv ${RELEASEDIR}/bindist/usr/share/dict \
190		${RELEASEDIR}/dict/usr/share/dict
191	mv ${RELEASEDIR}/bindist/usr/lib/*_p.a \
192		${RELEASEDIR}/proflibs/usr/lib
193	-cd ${RELEASEDIR} ; \
194	find ${EXTRADISTRIBUTIONS} -depth -type d -print | xargs rmdir
195	rm -rf ${RELEASEDIR}/tarballs
196	mkdir ${RELEASEDIR}/tarballs
197	for i in ${DISTRIBUTIONS} ; \
198	do \
199		mkdir ${RELEASEDIR}/tarballs/$${i} ; \
200		( cd ${RELEASEDIR}/$${i}; \
201			tar cf - . | \
202			${ZIPNSPLIT} ${RELEASEDIR}/tarballs/$$i/$${i}.) ; \
203	( cd ${RELEASEDIR}/tarballs/$${i}; sh -e ${.CURDIR}/mkchecksums.sh ) ; \
204	cp ${.CURDIR}/extract.sh cd ${RELEASEDIR}/tarballs/$${i} ;\
205	done
206
207.include <bsd.prog.mk>
208