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