Makefile revision 4690
1#	$Id: Makefile,v 1.49 1994/11/18 01:05:05 phk 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 date dd df dmesg echo ed expr hostname kill
21CPIO1+= ln ls mkdir mt mv rcp rm rmdir sh sleep stty sync tar test tip [ -sh
22CPIO1+= badsect chown clri disklabel dump dmesg fdisk fsck ifconfig init
23CPIO1+= 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 bininst
33
34# Somewhat on the rough side...
35CLEANFILES+=	*.o *.c *.cache *.mk *.lo ${CPIO1} *.flp *.gz 
36CLEANFILES+=	boot_flp boot.flp cpio_flp_1
37
38MTREE_DIR=	${.CURDIR}/../etc/mtree
39
40ZIPNSPLIT=	gzip --no-name -9 -c | split -b 240640 -
41
42hierarchy:
43	mtree -deU -f ${MTREE_DIR}/BSD.root.dist  -p ${DESTDIR}/
44	mtree -deU -f ${MTREE_DIR}/BSD.var.dist   -p ${DESTDIR}/var
45	mtree -deU -f ${MTREE_DIR}/BSD.usr.dist   -p ${DESTDIR}/usr
46.if defined(MAKE_LOCAL)
47	mtree -deU -f ${MTREE_DIR}/BSD.local.dist -p ${DESTDIR}/usr/local
48.endif
49	rm -f ${DESTDIR}/sys
50	ln -s usr/src/sys ${DESTDIR}/sys
51
52kernel:	${.CURDIR}/../sys/i386/conf/GENERIC
53	(cd ${.CURDIR}/../sys/i386/conf; config GENERIC)
54	(cd ${.CURDIR}/../sys/compile/GENERIC; ${MAKE} depend; ${MAKE} all; )
55
56boot.flp: 
57	crunchgen ${.CURDIR}/boot_flp.conf
58	${MAKE} -f boot_flp.mk objs exe
59	-umount ${MNT}
60	-umount /dev/${FLOPPY}
61	# echo y | fdformat ${FLOPPY}
62	disklabel -w -B \
63		-b ${DESTDIR}/usr/mdec/fdboot -s ${DESTDIR}/usr/mdec/bootfd \
64		/dev/r${FLOPPY} ${FDLABEL}
65	newfs -c 80 -b 4096 -f 512 -i 8192 -m 0 -o space /dev/r${FLOPPY}
66	mount -o async /dev/${FLOPPY} ${MNT}
67	mkdir ${MNT}/dev ${MNT}/stand ${MNT}/mnt
68	strip -x ${.CURDIR}/../sys/compile/GENERIC/kernel
69	cp ${.CURDIR}/../sys/compile/GENERIC/kernel ${MNT}/kernel
70	cp ${DESTDIR}/usr/mdec/sdboot ${DESTDIR}/usr/mdec/bootsd ${MNT}/stand
71	( cd ${DESTDIR}/dev ; \
72		ls console tty ttyv1 null zero \
73		sd[0123][a-h] wd[0123][a-h] fd[01] \
74		rsd[0123][a-h] rwd[0123][a-h] rfd[01] \
75	| cpio -dumpv ${MNT}/dev \
76	)
77	gzip -9 < boot_flp > ${MNT}/stand/sysinstall
78	chmod 755 ${MNT}/stand/sysinstall
79	ln ${MNT}/stand/sysinstall ${MNT}/stand/newfs
80	ln ${MNT}/stand/sysinstall ${MNT}/stand/gzip
81	install -m 400 -c ${.CURDIR}/../COPYRIGHT ${MNT}/COPYRIGHT
82	install -m 400 -c ${.CURDIR}/../share/FAQ/README-2.0 ${MNT}/README
83	install -m 400 -c ${.CURDIR}/../share/FAQ/TROUBLESHOOTING \
84		${MNT}/TROUBLESHOOTING
85	install -m 400 -c ${.CURDIR}/../share/FAQ/DISKSPACE.FAQ \
86		${MNT}/DISKSPACE.FAQ
87	install -m 400 -c ${.CURDIR}/../share/FAQ/RELNOTES.FreeBSD \
88		${MNT}/RELNOTES.FreeBSD
89	touch ${MNT}/this_is_boot_flp
90	-umount ${MNT}
91	fsck /dev/r${FLOPPY}
92	dd if=/dev/r${FLOPPY} bs=${DDBS} count=${DDCOUNT} of=boot.flp
93	gzip -9 -v < boot.flp > boot.flp.gz
94	df -k /dev/r${FLOPPY}
95
96cpio.flp:
97	for i in ${CPIO1} ; do rm -f ./$$i ; ln cpio_flp_1 ./$$i ; done
98	( cd /${DESTDIR} ; ls ${CPIO2} | cpio -H newc -oa ) | cpio -ivd
99	( cd ${.CURDIR} ; ls ${CPIO3} | cpio -H newc -oa ) | cpio -ivd
100	ls ${CPIO1} ${CPIO2} ${CPIO3} | cpio -H newc -oa | gzip -9 | \
101		dd conv=osync > cpio.flp
102	gzip -9 -v < cpio.flp > cpio.flp.gz
103	ls -l cpio.flp*
104
105crunch:
106	crunchgen ${.CURDIR}/boot_flp.conf
107	${MAKE} -f boot_flp.mk objs exe
108	crunchgen ${.CURDIR}/cpio_flp_1.conf
109	${MAKE} -f cpio_flp_1.mk objs exe
110
111floppies: crunch boot.flp cpio.flp
112
113release20: 
114	( cd ${.CURDIR} ; ${MAKE} clean)
115	-mkdir ${RELEASEDIR}
116	chflags -R noschg ${RELEASEDIR}/.
117	rm -rf ${RELEASEDIR}/*
118	( cd ${.CURDIR}/.. ;  \
119		${MAKE} world NOCRYPT=yes)
120	( cd ${.CURDIR}/../etc ;  \
121		${MAKE} release-dirs )
122	( cd ${.CURDIR} ; ${MAKE} obj)
123	( cd ${.CURDIR} ;  \
124		${MAKE} kernel DESTDIR=${RELEASEDIR}/filesys )
125	install ${COPY} -m 644 ${.CURDIR}/../sys/compile/GENERIC/kernel \
126		${RELEASEDIR}/filesys/kernel
127	( cd ${.CURDIR} ;  \
128		${MAKE} hierarchy DESTDIR=${RELEASEDIR}/filesys )
129	( cd ${.CURDIR}/../etc ; \
130		${MAKE} distribution DESTDIR=${RELEASEDIR}/filesys \
131			NOCRYPT=yes SHARED=copies)
132	( cd ${RELEASEDIR}/filesys; \
133		tar cf - . | \
134		${ZIPNSPLIT} ${RELEASEDIR}/tarballs/bindist/bin_tgz.)
135	cp ${.CURDIR}/extract.sh ${RELEASEDIR}/tarballs/bindist
136	( cd ${RELEASEDIR}/tarballs/bindist; ${.CURDIR}/mkchecksums.sh )
137	( cd ${.CURDIR} ;  \
138		${MAKE} floppies )
139foo:
140	( cd ${.CURDIR}/../etc ; \
141		${MAKE} srcebones-tarball \
142			DESTDIR=${RELEASEDIR}/filesys \
143			NOCRYPT=yes SHARED=copies )
144		
145bar:
146	( cd ${.CURDIR}/../etc ; \
147		${MAKE} des-tarball \
148			DESTDIR=${RELEASEDIR}/filesys \
149			SHARED=copies )
150
151EXTRADISTRIBUTIONS=	des games manpages proflibs dict
152DISTRIBUTIONS=	bindist ${EXTRADISTRIBUTIONS}
153MTREEFILES=	${.CURDIR}/../etc/mtree
154
155distribute: 
156	-mkdir ${RELEASEDIR}
157	chflags -R noschg ${RELEASEDIR}/.
158	rm -rf ${RELEASEDIR}/*
159	for i in ${DISTRIBUTIONS} ; \
160	do \
161	mkdir ${RELEASEDIR}/$$i ; \
162	mtree -deU -f ${MTREEFILES}/BSD.root.dist -p ${RELEASEDIR}/$$i/ ; \
163	mtree -deU -f ${MTREEFILES}/BSD.var.dist -p ${RELEASEDIR}/$$i/var ; \
164	mtree -deU -f ${MTREEFILES}/BSD.usr.dist -p ${RELEASEDIR}/$$i/usr ; \
165	done 
166	( cd ${.CURDIR} ;  \
167		${MAKE} kernel DESTDIR=${RELEASEDIR}/filesys )
168	install ${COPY} -m 644 ${.CURDIR}/../sys/compile/GENERIC/kernel \
169		${RELEASEDIR}/bindist/kernel
170
171tarballs:
172	rm -rf ${RELEASEDIR}/manpages/usr/share/man
173	mv ${RELEASEDIR}/bindist/usr/share/man \
174		${RELEASEDIR}/manpages/usr/share/man
175	rm -rf ${RELEASEDIR}/dict/usr/share/dict
176	mv ${RELEASEDIR}/bindist/usr/share/dict \
177		${RELEASEDIR}/dict/usr/share/dict
178	mv ${RELEASEDIR}/bindist/usr/lib/*_p.a \
179		${RELEASEDIR}/proflibs/usr/lib
180	-cd ${RELEASEDIR} ; \
181	find ${EXTRADISTRIBUTIONS} -depth -type d -print | xargs rmdir
182	rm -rf ${RELEASEDIR}/tarballs
183	mkdir ${RELEASEDIR}/tarballs
184	for i in ${DISTRIBUTIONS} ; \
185	do \
186		mkdir ${RELEASEDIR}/tarballs/$${i} ; \
187		( cd ${RELEASEDIR}/$${i}; \
188			tar cf - . | \
189			${ZIPNSPLIT} ${RELEASEDIR}/tarballs/$$i/$${i}_tgz.) ; \
190	( cd ${RELEASEDIR}/tarballs/$${i}; sh -e ${.CURDIR}/mkchecksums.sh ) ; \
191	done
192
193.include <bsd.prog.mk>
194