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