Makefile revision 1.198
1#	$OpenBSD: Makefile,v 1.198 2004/02/13 14:14:52 miod Exp $
2
3TZDIR=		/usr/share/zoneinfo
4LOCALTIME=	Canada/Mountain
5
6NOOBJ=	oobj
7
8.if exists(etc.${MACHINE}/Makefile.inc)
9.include "etc.${MACHINE}/Makefile.inc"
10.endif
11
12# -rw-r--r--
13BINOWN= root
14BINGRP= wheel
15BIN1=	bootptab changelist ccd.conf csh.cshrc csh.login csh.logout \
16	daily dhcpd.conf dhcpd.interfaces exports ftpusers \
17	ftpchroot gettytab group hosts hosts.lpd inetd.conf \
18	ksh.kshrc locate.rc man.conf monthly motd mrouted.conf \
19	myname netstart networks newsyslog.conf \
20	phones printcap protocols rbootd.conf rc rc.conf rc.local \
21	rc.securelevel rc.shutdown remote rpc security services \
22	shells spamd.conf syslog.conf weekly etc.${MACHINE}/disktab \
23	dhclient.conf mailer.conf
24
25.if ${MACHINE} == "alpha" || ${MACHINE} == "hppa" || \
26    ${MACHINE} == "i386" || ${MACHINE} == "macppc" || \
27    ${MACHINE} == "pegasos" || ${MACHINE} == "sparc" || \
28    ${MACHINE} == "sparc64" || ${MACHINE_ARCH} == "x86_64" || \
29    ${MACHINE} == "cats"
30BIN1+=	wsconsctl.conf
31.endif
32
33# -rw-rw-r--
34BIN2=	motd
35
36NAMEDB=	localhost.rev localhost.v6.rev localhost.zone root.cache
37PCS=	pcs750.bin
38WCS1=	wcs fppwcs poc poc1 poc2 fppoc
39WCS2=	fpevent fppwcs fppwcs_dual hdcwcs load_diags start_fpp wcs wcs_dual
40
41# Use NOGZIP on architectures where the gzip'ing would take too much time
42# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
43# gzip them on a faster machine
44.ifndef NOGZIP
45GZIP?=		gzip
46GZIPFLAGS?=	-9
47GZIPEXT?=	.gz
48.else
49GZIP=		cat
50GZIPFLAGS=
51GZIPEXT=
52.endif
53
54all clean cleandir depend etc install lint:
55
56.ifndef DESTDIR
57distribution-etc-root-var distribution distrib-dirs release snapshot:
58	@echo setenv DESTDIR before doing that!
59	@false
60.else
61distribution-etc-root-var: distrib-dirs
62	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
63	cat etc.${MACHINE}/ttys ttys.pty > ${DESTDIR}/etc/ttys && \
64	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
65	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
66	    chmod 644 ${DESTDIR}/etc/ttys
67	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
68	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
69	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
70	    chmod 644 ${DESTDIR}/etc/sysctl.conf
71	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
72	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
73	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
74	    chmod 644 ${DESTDIR}/etc/fbtab
75	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
76	${INSTALL} -c -o root -g wheel -m 600 hosts.equiv ${DESTDIR}/etc
77	${INSTALL} -c -o root -g wheel -m 600 crontab ${DESTDIR}/var/cron/tabs/root
78	${INSTALL} -c -o root -g wheel -m 644 login.conf ${DESTDIR}/etc
79	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
80	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
81	${INSTALL} -c -o root -g wheel -m 644 moduli ${DESTDIR}/etc
82	${INSTALL} -c -o root -g wheel -m 600 bgpd.conf ${DESTDIR}/etc
83	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
84	${INSTALL} -c -o root -g wheel -m 644 pf.os ${DESTDIR}/etc
85	${INSTALL} -c -o root -g wheel -m 644 sensorsd.conf ${DESTDIR}/etc
86	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
87	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
88	cd root; \
89		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
90		    ${DESTDIR}/root/.cshrc; \
91		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
92		    ${DESTDIR}/root/.klogin; \
93		${INSTALL} -c -o root -g wheel -m 644 dot.login \
94		    ${DESTDIR}/root/.login; \
95		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
96		    ${DESTDIR}/root/.profile; \
97		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
98		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
99		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
100	cd skel; \
101		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
102		    ${DESTDIR}/etc/skel/.cshrc; \
103		${INSTALL} -c -o root -g wheel -m 644 dot.login \
104		    ${DESTDIR}/etc/skel/.login; \
105		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
106		    ${DESTDIR}/etc/skel/.mailrc; \
107		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
108		    ${DESTDIR}/etc/skel/.profile; \
109		${INSTALL} -c -o root -g wheel -m 600 dot.rhosts \
110		    ${DESTDIR}/etc/skel/.rhosts
111	cd kerberosV; \
112		${INSTALL} -c -o root -g wheel -m 644 README \
113		    ${DESTDIR}/etc/kerberosV; \
114		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
115		    ${DESTDIR}/etc/kerberosV
116	cd amd; \
117		${INSTALL} -c -o root -g wheel -m 644 master.sample \
118		    ${DESTDIR}/etc/amd
119	cd mtree; \
120		${INSTALL} -c -o root -g wheel -m 600 special \
121		    ${DESTDIR}/etc/mtree; \
122		${INSTALL} -c -o root -g wheel -m 444 4.4BSD.dist \
123		    ${DESTDIR}/etc/mtree; \
124		${INSTALL} -c -o root -g wheel -m 444 BSD.local.dist \
125		    ${DESTDIR}/etc/mtree; \
126		${INSTALL} -c -o root -g wheel -m 444 BSD.x11.dist \
127		    ${DESTDIR}/etc/mtree
128	cd ppp; \
129		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
130		    ${DESTDIR}/etc/ppp; \
131		${INSTALL} -c -o root -g wheel -m 600 options \
132		    ${DESTDIR}/etc/ppp; \
133		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
134		    ${DESTDIR}/etc/ppp; \
135		${INSTALL} -c -o root -g wheel -m 600 options.sample \
136		    ${DESTDIR}/etc/ppp; \
137		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
138		    ${DESTDIR}/etc/ppp; \
139		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
140		    ${DESTDIR}/etc/ppp; \
141		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
142		    ${DESTDIR}/etc/ppp; \
143		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
144		    ${DESTDIR}/etc/ppp; \
145		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
146		    ${DESTDIR}/etc/ppp; \
147		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
148		    ${DESTDIR}/etc/ppp
149	cd afs; \
150		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
151		    ${DESTDIR}/etc/afs; \
152		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
153		    ${DESTDIR}/etc/afs; \
154		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
155		    ${DESTDIR}/etc/afs; \
156		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
157		    ${DESTDIR}/etc/afs; \
158		${INSTALL} -c -o root -g wheel -m 644 README \
159		    ${DESTDIR}/etc/afs
160	cd systrace; \
161		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
162		    ${DESTDIR}/etc/systrace; \
163		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
164		    ${DESTDIR}/etc/systrace;
165	cd bind; \
166		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
167		    ${DESTDIR}/var/named/etc/named.conf; \
168		${INSTALL} -c -o root -g named -m 640 named-*.conf \
169		    ${DESTDIR}/var/named/etc; \
170		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
171		    ${DESTDIR}/var/named/standard/localhost; \
172		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
173		    ${DESTDIR}/var/named/standard/loopback; \
174		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
175		    ${DESTDIR}/var/named/standard/loopback6.arpa; \
176		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.int \
177		    ${DESTDIR}/var/named/standard/loopback6.int; \
178		${INSTALL} -c -o root -g wheel -m 644 root.hint \
179		    ${DESTDIR}/var/named/standard; \
180	/bin/rm -f ${DESTDIR}/etc/localtime
181	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
182	/bin/rm -f ${DESTDIR}/etc/rmt
183	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
184	${INSTALL} -c -o root -g wheel -m 644 minfree \
185		${DESTDIR}/var/crash
186	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
187		${DESTDIR}/etc/dumpdates
188	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
189		${DESTDIR}/var/cron/at.deny
190	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
191		${DESTDIR}/var/cron/cron.deny
192	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
193		${DESTDIR}/var/cron/log
194	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
195		${DESTDIR}/var/db/locate.database
196	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
197		${DESTDIR}/var/log/authlog
198	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
199		${DESTDIR}/var/log/daemon
200	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
201		${DESTDIR}/var/log/failedlogin
202	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
203		${DESTDIR}/var/log/ftpd
204	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
205		${DESTDIR}/var/log/lastlog
206	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
207		${DESTDIR}/var/log/lpd-errs
208	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
209		${DESTDIR}/var/log/maillog
210	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
211		${DESTDIR}/var/log/messages
212	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
213		${DESTDIR}/var/log/secure
214	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
215		${DESTDIR}/var/log/sendmail.st
216	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
217		${DESTDIR}/var/log/wtmp
218	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
219		${DESTDIR}/var/log/xferlog
220	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
221		${DESTDIR}/var/msgs/bounds
222	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
223		${DESTDIR}/var/run/utmp
224.if ${MACHINE} == "vax"
225	uudecode -p etc.vax/${PCS}.uu > ${DESTDIR}/${PCS} && \
226	    chown ${BINOWN} ${DESTDIR}/${PCS} && \
227	    chgrp ${BINGRP} ${DESTDIR}/${PCS} && \
228	    chmod 644 ${DESTDIR}/${PCS}
229.endif
230	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
231	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
232	cd ../usr.bin/ssh && exec ${MAKE} distribution
233	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
234	cd ../lib/libssl && exec ${MAKE} distribution
235	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
236	cd ../usr.bin/mail && exec ${MAKE} distribution
237	cd mail && exec ${MAKE} distribution
238	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
239		${DESTDIR}/var/mail/root
240	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
241		${DESTDIR}/etc/sudoers
242
243distribution:
244	exec ${SUDO} ${MAKE} distribution-etc-root-var
245	cd .. && exec ${SUDO} ${MAKE} install
246
247distrib-dirs:
248	if [ ! -d ${DESTDIR}/. ]; then \
249		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
250	fi
251	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
252	if [ ! -d ${DESTDIR}/usr/src ]; then \
253		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
254	fi
255	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
256
257.ifndef RELEASEDIR
258release:
259	@echo setenv RELEASEDIR before building a release.
260	@false
261.else
262release: distribution snap_pre snap_md
263	cd ${.CURDIR}/../distrib/notes && ${MAKE} && exec ${SUDO} ${MAKE} install
264	cd ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
265	-cp ${DESTDIR}/snapshot/bsd* ${RELEASEDIR}
266	-cp ${DESTDIR}/snapshot/*boot* ${RELEASEDIR}
267	-cp ${DESTDIR}/snapshot/*BOOT* ${RELEASEDIR}
268	-cp ${DESTDIR}/snapshot/cd*.iso ${RELEASEDIR}
269	-cp ${DESTDIR}/snapshot/INSTALL.* ${RELEASEDIR}
270	-cp ${DESTDIR}/snapshot/*.fs ${DESTDIR}/snapshot/*.fs.gz ${RELEASEDIR}
271	-cd ${RELEASEDIR}; \
272		md5 bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.iso *.gz *.tgz \
273		    > MD5
274	-cd ${RELEASEDIR}; \
275		cksum bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.iso *.gz *.tgz \
276		    > CKSUM
277.if defined(MACHINE_HAS_TOOLS)
278	mkdir -p ${RELEASEDIR}/tools
279	cp ${DESTDIR}/snapshot/tools/* ${RELEASEDIR}/tools
280	cd ${RELEASEDIR} && md5 tools/* >>MD5
281	cd ${RELEASEDIR} && cksum tools/* >>CKSUM
282.endif
283	-cd ${RELEASEDIR} && sort -o MD5 MD5
284	-cd ${RELEASEDIR} && sort -o CKSUM -k 3 CKSUM
285.endif
286
287snapshot: distribution snap_pre snap_tar snap_md
288	cd ${DESTDIR}/snapshot && cksum * > CKSUMS
289	cd ${DESTDIR}/snapshot && md5 * > MD5
290
291snap_pre:
292	${SUDO} /bin/rm -rf ${DESTDIR}/snapshot
293	${SUDO} ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/snapshot
294
295snap_tar:
296	cd ${DESTDIR} && tar cf - bin \
297	    | ${GZIP} ${GZIPFLAGS} > snapshot/bin.tar${GZIPEXT}
298	cd ${DESTDIR} && tar cf - dev \
299	    | ${GZIP} ${GZIPFLAGS} > snapshot/dev.tar${GZIPEXT}
300	cd ${DESTDIR} && tar cf - .profile .cshrc altroot etc home mnt \
301	    root stand sys tmp | ${GZIP} ${GZIPFLAGS} \
302	    > snapshot/etc.tar${GZIPEXT}
303	cd ${DESTDIR} && tar cf - sbin \
304	    | ${GZIP} ${GZIPFLAGS} > snapshot/sbin.tar${GZIPEXT}
305	cd ${DESTDIR} && tar cf - usr/bin \
306	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.bin.tar${GZIPEXT}
307	cd ${DESTDIR} && tar cf - usr/games \
308	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.games.tar${GZIPEXT}
309	cd ${DESTDIR} && tar cf - usr/include \
310	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.include.tar${GZIPEXT}
311	cd ${DESTDIR} && tar cf - usr/lib \
312	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.lib.tar${GZIPEXT}
313	cd ${DESTDIR} && tar cf - usr/libexec \
314	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.libexec.tar${GZIPEXT}
315	cd ${DESTDIR} && tar cf - usr/mdec usr/libdata usr/lkm usr/local \
316	    usr/src usr/obj | ${GZIP} ${GZIPFLAGS} \
317	    > snapshot/usr.misc.tar${GZIPEXT}
318	cd ${DESTDIR} && tar cf - usr/sbin \
319	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.sbin.tar${GZIPEXT}
320	cd ${DESTDIR} && tar cf - usr/share \
321	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.share.tar${GZIPEXT}
322	cd ${DESTDIR} && tar cf - var \
323	    | ${GZIP} ${GZIPFLAGS} > snapshot/var.tar${GZIPEXT}
324	cd ../distrib/notes; ${MAKE}; ${MAKE} install
325
326snap_md:
327# nothing here -- look in the machine-dependent Makefile.inc
328
329.endif	# DESTDIR check
330
331MAKEDEVARCHS+= alpha
332MAKEDEVARCHS+= amd64
333MAKEDEVARCHS+= cats
334MAKEDEVARCHS+= hp300
335MAKEDEVARCHS+= hppa
336MAKEDEVARCHS+= i386
337MAKEDEVARCHS+= mac68k
338MAKEDEVARCHS+= macppc
339MAKEDEVARCHS+= mvme68k
340MAKEDEVARCHS+= mvme88k
341#MAKEDEVARCHS+= mvmeppc
342MAKEDEVARCHS+= pegasos
343MAKEDEVARCHS+= sparc
344MAKEDEVARCHS+= sparc64
345MAKEDEVARCHS+= vax
346
347clean:
348	rm -f etc.${MACHINE}/MAKEDEV
349
350cleandir:
351	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
352	    ${MAKE} MACHINE=$$m clean; done
353
354m4: etc.${M}/MAKEDEV
355
356etc.${M}/MAKEDEV: MAKEDEV.sub MAKEDEV.mi etc.${M}/MAKEDEV.md
357	echo "==> etc.${M}/MAKEDEV"
358	m4 -DMACHINE=${M} MAKEDEV.mi > etc.${M}/.MAKEDEV.tmp && \
359	    mv etc.${M}/.MAKEDEV.tmp etc.${M}/MAKEDEV || \
360	    rm etc.${M}/.MAKEDEV.tmp
361
362allarchs: MAKEDEV.sub MAKEDEV.mi
363	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
364	    ${MAKE} M=$$m m4; done
365
366distrib:
367	cd ${.CURDIR}/../distrib && \
368	    ${MAKE} cleandir && ${MAKE} && exec ${SUDO} ${MAKE} install
369
370DHSIZE=1024 1536 2048 3072 4096
371update-moduli:
372	( \
373		echo '#    $$OpenBSD: Makefile,v 1.198 2004/02/13 14:14:52 miod Exp $$'; \
374		echo '# Time Type Tests Tries Size Generator Modulus'; \
375		( for i in ${DHSIZE}; do \
376			ssh-keygen -b $$i -G /dev/stdout; \
377		done) | \
378		ssh-keygen -T /dev/stdout \
379	) > moduli
380
381.PHONY: distribution-etc-root-var distribution distrib-dirs \
382	release snapshot allarchs snap_pre snap_tar snap_md m4
383.include <bsd.prog.mk>
384