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