Makefile revision 5149
1#	$Id: Makefile,v 1.63 1994/12/17 12:38:09 jkh Exp $
2#
3
4FLOPPY=		fd0
5
6
7# Evil floppies are, of course, 1.2MB floppies.
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
35CPIO4B=	tzsetup
36
37# Somewhat on the rough side...
38CLEANFILES+=	*.o *.c *.cache *.mk *.lo ${CPIO1} *.flp *.gz 
39CLEANFILES+=	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_12.flp: 
60	(cd ${.CURDIR}; EVIL_FLOPPY=yes ${MAKE} boot.flp)
61	mv boot.flp boot_12.flp
62	gzip -9 -c < boot_12.flp > boot_12.flp.gz
63
64boot_144.flp:
65	(cd ${.CURDIR}; ${MAKE} boot.flp)
66	mv boot.flp boot_144.flp
67	gzip -9 -c < boot_144.flp > boot_144.flp.gz
68
69boot.flp: 
70	crunchgen ${.CURDIR}/boot_flp.conf
71	${MAKE} -f boot_flp.mk objs exe
72	-umount ${MNT}
73	-umount /dev/${FLOPPY}
74	# echo y | fdformat ${FLOPPY}
75	disklabel -w -B \
76		-b ${DESTDIR}/usr/mdec/fdboot -s ${DESTDIR}/usr/mdec/bootfd \
77		/dev/r${FLOPPY} ${FDLABEL}
78	newfs -c 80 -b 4096 -f 512 -i 8192 -m 0 -o space /dev/r${FLOPPY}
79	mount -o async /dev/${FLOPPY} ${MNT}
80	mkdir ${MNT}/dev ${MNT}/stand ${MNT}/mnt
81	strip -x ${.CURDIR}/../sys/compile/GENERIC/kernel
82	cp ${.CURDIR}/../sys/compile/GENERIC/kernel ${MNT}/kernel
83	cp ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/bootsd ${MNT}/stand
84	( cd ${DESTDIR}/dev ; \
85		ls console tty ttyv1 null zero \
86		sd[0123][a-h] wd[0123][a-h] fd[01] \
87		rsd[0123][a-h] rwd[0123][a-h] rfd[01] \
88	| cpio -dumpv ${MNT}/dev \
89	)
90	gzip -9 < boot_flp > ${MNT}/stand/sysinstall
91	chmod 755 ${MNT}/stand/sysinstall
92	ln ${MNT}/stand/sysinstall ${MNT}/stand/newfs
93	ln ${MNT}/stand/sysinstall ${MNT}/stand/gzip
94	ln ${MNT}/stand/sysinstall ${MNT}/stand/fsck
95.if !defined(EVIL_FLOPPY)
96	install -m 400 -c ${.CURDIR}/../COPYRIGHT ${MNT}/COPYRIGHT
97	install -m 400 -c ${.CURDIR}/../share/FAQ/DISKSPACE.FAQ \
98		${MNT}/DISKSPACE.FAQ
99	install -m 400 -c ${.CURDIR}/../share/FAQ/RELNOTES.FreeBSD \
100		${MNT}/RELNOTES.FreeBSD
101.endif
102	install -m 400 -c ${.CURDIR}/../share/FAQ/TROUBLESHOOTING \
103		${MNT}/TROUBLESHOOTING
104	install -m 400 -c ${.CURDIR}/../share/FAQ/README-2.0 ${MNT}/README
105	touch ${MNT}/this_is_boot_flp
106	-umount ${MNT}
107	fsck /dev/r${FLOPPY}
108	dd if=/dev/r${FLOPPY} bs=${DDBS} count=${DDCOUNT} of=boot.flp
109	df -k /dev/r${FLOPPY}
110
111cpio.flp:
112	crunchgen ${.CURDIR}/cpio_flp_1.conf
113	${MAKE} -f cpio_flp_1.mk objs exe
114	for i in ${CPIO1} ; do rm -f ./$$i ; ln cpio_flp_1 ./$$i ; done
115	( cd /${DESTDIR} ; ls ${CPIO2} | cpio -H newc -oa ) | cpio -ivd
116	( cd ${.CURDIR} ; ls ${CPIO3} | cpio -H newc -oa ) | cpio -ivd
117	cp ${CPIO4} .
118	ls ${CPIO1} ${CPIO2} ${CPIO3} ${CPIO4B} | \
119		cpio -H newc -oa | gzip -9 | \
120		dd conv=osync > cpio.flp
121	gzip -9 -v < cpio.flp > cpio.flp.gz
122	ls -l cpio.flp*
123
124crunch:
125	crunchgen ${.CURDIR}/boot_flp.conf
126	${MAKE} -f boot_flp.mk objs exe
127	crunchgen ${.CURDIR}/cpio_flp_1.conf
128	${MAKE} -f cpio_flp_1.mk objs exe
129
130floppies: crunch boot_144.flp boot_12.flp cpio.flp
131
132release20: 
133.if !defined(RELEASEDIR)
134	@echo "Do NOT invoke this target without a RELEASEDIR defined."
135	@echo "It will otherwise blow away your root directory!"
136	@exit 1
137.endif
138	( cd ${.CURDIR} ; ${MAKE} clean)
139	-mkdir ${RELEASEDIR}
140	chflags -R noschg ${RELEASEDIR}/.
141	rm -rf ${RELEASEDIR}/*
142	( cd ${.CURDIR}/.. ;  \
143		${MAKE} world NOCRYPT=yes)
144	( cd ${.CURDIR}/../etc ;  \
145		${MAKE} release-dirs )
146	( cd ${.CURDIR} ; ${MAKE} obj)
147	( cd ${.CURDIR} ;  \
148		${MAKE} kernel DESTDIR=${RELEASEDIR}/filesys )
149	install ${COPY} -m 644 ${.CURDIR}/../sys/compile/GENERIC/kernel \
150		${RELEASEDIR}/filesys/kernel
151	( cd ${.CURDIR} ;  \
152		${MAKE} hierarchy DESTDIR=${RELEASEDIR}/filesys )
153	( cd ${.CURDIR}/../etc ; \
154		${MAKE} distribution DESTDIR=${RELEASEDIR}/filesys \
155			NOCRYPT=yes SHARED=copies)
156	( cd ${RELEASEDIR}/filesys; \
157		tar cf - . | \
158		${ZIPNSPLIT} ${RELEASEDIR}/tarballs/bindist/bindist.)
159	cp ${.CURDIR}/extract.sh ${RELEASEDIR}/tarballs/bindist
160	( cd ${RELEASEDIR}/tarballs/bindist; ${.CURDIR}/mkchecksums.sh )
161	( cd ${.CURDIR} ;  \
162		${MAKE} floppies )
163foo:
164	( cd ${.CURDIR}/../etc ; \
165		${MAKE} srcebones-tarball \
166			DESTDIR=${RELEASEDIR}/filesys \
167			NOCRYPT=yes SHARED=copies )
168		
169bar:
170	( cd ${.CURDIR}/../etc ; \
171		${MAKE} des-tarball \
172			DESTDIR=${RELEASEDIR}/filesys \
173			SHARED=copies )
174
175EXTRADISTRIBUTIONS=	secrdist games manpages proflibs dict krb srcdist
176DISTRIBUTIONS=	bindist ${EXTRADISTRIBUTIONS}
177MTREEFILES=	${.CURDIR}/../etc/mtree
178SECRSRC=	src/secure src/eBones
179
180distribute: 
181	-mkdir ${RELEASEDIR}
182	chflags -R noschg ${RELEASEDIR}/.
183	rm -rf ${RELEASEDIR}/*
184	for i in ${DISTRIBUTIONS} ; \
185	do \
186	mkdir ${RELEASEDIR}/$$i ; \
187	mtree -deU -f ${MTREEFILES}/BSD.root.dist -p ${RELEASEDIR}/$$i/ ; \
188	mtree -deU -f ${MTREEFILES}/BSD.var.dist -p ${RELEASEDIR}/$$i/var ; \
189	mtree -deU -f ${MTREEFILES}/BSD.usr.dist -p ${RELEASEDIR}/$$i/usr ; \
190	done 
191	( cd ${.CURDIR} ;  \
192		${MAKE} kernel DESTDIR=${RELEASEDIR}/filesys )
193	install ${COPY} -m 644 ${.CURDIR}/../sys/compile/GENERIC/kernel \
194		${RELEASEDIR}/bindist/kernel
195
196beforetarballs:
197	rm -rf ${RELEASEDIR}/manpages/usr/share/man
198	mv ${RELEASEDIR}/bindist/usr/share/man \
199		${RELEASEDIR}/manpages/usr/share/man
200	rm -rf ${RELEASEDIR}/games/usr/games
201	mv ${RELEASEDIR}/bindist/usr/games \
202		${RELEASEDIR}/games/usr/games
203	rm -rf ${RELEASEDIR}/games/usr/share/games
204	mv ${RELEASEDIR}/bindist/usr/share/games \
205		${RELEASEDIR}/games/usr/share/games
206	rm -rf ${RELEASEDIR}/dict/usr/share/dict
207	mv ${RELEASEDIR}/bindist/usr/share/dict \
208		${RELEASEDIR}/dict/usr/share/dict
209	mv ${RELEASEDIR}/bindist/usr/share/misc/airport \
210	   ${RELEASEDIR}/bindist/usr/share/misc/birthtoken \
211	   ${RELEASEDIR}/bindist/usr/share/misc/flowers \
212	   ${RELEASEDIR}/bindist/usr/share/misc/na.phone \
213	   ${RELEASEDIR}/bindist/usr/share/misc/zipcodes \
214		${RELEASEDIR}/dict/usr/share/misc
215	mv ${RELEASEDIR}/bindist/usr/lib/*_p.a \
216		${RELEASEDIR}/proflibs/usr/lib
217	-cd ${RELEASEDIR} ; \
218	find ${EXTRADISTRIBUTIONS} -depth -type d -print | xargs rmdir
219	cd ${RELEASEDIR}/secrdist/usr ; cvs export -r ${RELEASETAG} ${SECRSRC}
220	cd ${RELEASEDIR}/srcdist/usr ; cvs export -r ${RELEASETAG} src
221	cd ${RELEASEDIR}/srcdist/usr/src ; rm -rf secure kerberosIV eBones
222
223tarballs:
224	rm -rf ${RELEASEDIR}/tarballs
225	mkdir ${RELEASEDIR}/tarballs
226	for i in ${DISTRIBUTIONS} ; \
227	do \
228		mkdir ${RELEASEDIR}/tarballs/$${i} ; \
229		( cd ${RELEASEDIR}/$${i}; \
230			tar cf - . | \
231			${ZIPNSPLIT} ${RELEASEDIR}/tarballs/$$i/$${i}.) ; \
232	( cd ${RELEASEDIR}/tarballs/$${i}; sh -e ${.CURDIR}/mkchecksums.sh ) ; \
233	cp ${.CURDIR}/extract.sh ${RELEASEDIR}/tarballs/$${i} ;\
234	done
235
236.include <bsd.prog.mk>
237