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