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