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