Makefile revision 1.248
1#	$OpenBSD: Makefile,v 1.248 2007/02/22 16:55:32 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 \
22	moduli pf.os sensorsd.conf ifstated.conf
23
24.if ${MACHINE} != "aviion" && ${MACHINE} != "mvme68k" && \
25    ${MACHINE} != "mvme88k" && ${MACHINE} != "landisk"
26BIN1+=	wsconsctl.conf
27.endif
28
29# -rw-rw-r--
30BIN2=	motd
31
32PCS=	pcs750.bin
33
34# Use NOGZIP on architectures where the gzip'ing would take too much time
35# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
36# gzip them on a faster machine
37.ifndef NOGZIP
38GZIPCMD?=	gzip
39GZIPFLAGS?=	-9
40GZIPEXT?=	.gz
41.else
42GZIPCMD=	cat
43GZIPFLAGS=
44GZIPEXT=
45.endif
46
47all clean cleandir depend etc install lint:
48
49.ifndef DESTDIR
50distribution-etc-root-var distribution distrib-dirs release:
51	@echo setenv DESTDIR before doing that!
52	@false
53.else
54distribution-etc-root-var: distrib-dirs
55	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
56	ksh ttys.pty | cat etc.${MACHINE}/ttys - > ${DESTDIR}/etc/ttys && \
57	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
58	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
59	    chmod 644 ${DESTDIR}/etc/ttys
60	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
61	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
62	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
63	    chmod 644 ${DESTDIR}/etc/sysctl.conf
64	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
65	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
66	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
67	    chmod 644 ${DESTDIR}/etc/fbtab
68	awk -f ${.CURDIR}/mklogin.conf `test -f etc.${MACHINE}/login.conf.overrides && echo etc.${MACHINE}/login.conf.overrides` < ${.CURDIR}/login.conf.in > \
69	    ${DESTDIR}/etc/login.conf && \
70	    chown ${BINOWN}:${BINGRP} ${DESTDIR}/etc/login.conf && \
71	    chmod 644 ${DESTDIR}/etc/login.conf
72	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
73	${INSTALL} -c -o root -g wheel -m 600 hosts.equiv ${DESTDIR}/etc
74	${INSTALL} -c -o root -g wheel -m 600 crontab ${DESTDIR}/var/cron/tabs/root
75	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
76	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
77	${INSTALL} -c -o root -g wheel -m 600 bgpd.conf ${DESTDIR}/etc
78	${INSTALL} -c -o root -g wheel -m 600 ospfd.conf ${DESTDIR}/etc
79	${INSTALL} -c -o root -g wheel -m 600 ripd.conf ${DESTDIR}/etc
80	${INSTALL} -c -o root -g wheel -m 600 dvmrpd.conf ${DESTDIR}/etc
81	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
82	${INSTALL} -c -o root -g wheel -m 600 chio.conf ${DESTDIR}/etc
83	${INSTALL} -c -o root -g wheel -m 600 hostapd.conf ${DESTDIR}/etc
84	${INSTALL} -c -o root -g wheel -m 600 hoststated.conf ${DESTDIR}/etc
85	${INSTALL} -c -o root -g wheel -m 600 ipsec.conf ${DESTDIR}/etc
86	${INSTALL} -c -o root -g wheel -m 600 sasyncd.conf ${DESTDIR}/etc
87	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
88	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
89	cd root; \
90		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
91		    ${DESTDIR}/root/.cshrc; \
92		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
93		    ${DESTDIR}/root/.klogin; \
94		${INSTALL} -c -o root -g wheel -m 644 dot.login \
95		    ${DESTDIR}/root/.login; \
96		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
97		    ${DESTDIR}/root/.profile; \
98		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
99		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
100		    ${DESTDIR}/.cshrc; \
101		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
102		    ${DESTDIR}/.profile;
103	cd skel; \
104		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
105		    ${DESTDIR}/etc/skel/.cshrc; \
106		${INSTALL} -c -o root -g wheel -m 644 dot.login \
107		    ${DESTDIR}/etc/skel/.login; \
108		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
109		    ${DESTDIR}/etc/skel/.mailrc; \
110		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
111		    ${DESTDIR}/etc/skel/.profile
112	cd kerberosV; \
113		${INSTALL} -c -o root -g wheel -m 644 README \
114		    ${DESTDIR}/etc/kerberosV; \
115		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
116		    ${DESTDIR}/etc/kerberosV
117	cd amd; \
118		${INSTALL} -c -o root -g wheel -m 644 master.sample \
119		    ${DESTDIR}/etc/amd
120	cd mtree; \
121		${INSTALL} -c -o root -g wheel -m 600 special \
122		    ${DESTDIR}/etc/mtree; \
123		${INSTALL} -c -o root -g wheel -m 444 4.4BSD.dist \
124		    ${DESTDIR}/etc/mtree; \
125		${INSTALL} -c -o root -g wheel -m 444 BSD.local.dist \
126		    ${DESTDIR}/etc/mtree; \
127		${INSTALL} -c -o root -g wheel -m 444 BSD.x11.dist \
128		    ${DESTDIR}/etc/mtree
129	cd ppp; \
130		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
131		    ${DESTDIR}/etc/ppp; \
132		${INSTALL} -c -o root -g wheel -m 600 options \
133		    ${DESTDIR}/etc/ppp; \
134		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
135		    ${DESTDIR}/etc/ppp; \
136		${INSTALL} -c -o root -g wheel -m 600 options.sample \
137		    ${DESTDIR}/etc/ppp; \
138		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
139		    ${DESTDIR}/etc/ppp; \
140		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
141		    ${DESTDIR}/etc/ppp; \
142		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
143		    ${DESTDIR}/etc/ppp; \
144		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
145		    ${DESTDIR}/etc/ppp; \
146		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
147		    ${DESTDIR}/etc/ppp; \
148		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
149		    ${DESTDIR}/etc/ppp
150	cd afs; \
151		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
152		    ${DESTDIR}/etc/afs; \
153		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
154		    ${DESTDIR}/etc/afs; \
155		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
156		    ${DESTDIR}/etc/afs; \
157		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
158		    ${DESTDIR}/etc/afs; \
159		${INSTALL} -c -o root -g wheel -m 644 README \
160		    ${DESTDIR}/etc/afs
161	cd systrace; \
162		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
163		    ${DESTDIR}/etc/systrace; \
164		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
165		    ${DESTDIR}/etc/systrace;
166	cd bind; \
167		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
168		    ${DESTDIR}/var/named/etc/named.conf; \
169		${INSTALL} -c -o root -g named -m 640 named-*.conf \
170		    ${DESTDIR}/var/named/etc; \
171		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
172		    ${DESTDIR}/var/named/standard/localhost; \
173		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
174		    ${DESTDIR}/var/named/standard/loopback; \
175		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
176		    ${DESTDIR}/var/named/standard/loopback6.arpa; \
177		${INSTALL} -c -o root -g wheel -m 644 root.hint \
178		    ${DESTDIR}/var/named/standard; \
179	/bin/rm -f ${DESTDIR}/etc/localtime
180	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
181	/bin/rm -f ${DESTDIR}/etc/rmt
182	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
183	${INSTALL} -c -o root -g wheel -m 644 minfree \
184		${DESTDIR}/var/crash
185	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
186		${DESTDIR}/etc/dumpdates
187	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
188		${DESTDIR}/var/cron/at.deny
189	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
190		${DESTDIR}/var/cron/cron.deny
191	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
192		${DESTDIR}/var/cron/log
193	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
194		${DESTDIR}/var/db/locate.database
195	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
196		${DESTDIR}/var/log/authlog
197	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
198		${DESTDIR}/var/log/daemon
199	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
200		${DESTDIR}/var/log/failedlogin
201	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
202		${DESTDIR}/var/log/ftpd
203	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
204		${DESTDIR}/var/log/lastlog
205	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
206		${DESTDIR}/var/log/lpd-errs
207	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
208		${DESTDIR}/var/log/maillog
209	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
210		${DESTDIR}/var/log/messages
211	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
212		${DESTDIR}/var/log/secure
213	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
214		${DESTDIR}/var/log/sendmail.st
215	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
216		${DESTDIR}/var/log/wtmp
217	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
218		${DESTDIR}/var/log/xferlog
219	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
220		${DESTDIR}/var/msgs/bounds
221	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
222		${DESTDIR}/var/run/utmp
223.if ${MACHINE} == "vax"
224	uudecode -p etc.vax/${PCS}.uu > ${DESTDIR}/${PCS} && \
225	    chown ${BINOWN} ${DESTDIR}/${PCS} && \
226	    chgrp ${BINGRP} ${DESTDIR}/${PCS} && \
227	    chmod 644 ${DESTDIR}/${PCS}
228.endif
229	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
230	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
231	cd ../usr.bin/ssh && exec ${MAKE} distribution
232	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
233	cd ../lib/libssl && exec ${MAKE} distribution
234	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
235	cd ../usr.bin/bgplg && exec ${MAKE} 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/cdbr ${RELEASEDIR}
268	-cp ${DESTDIR}/snapshot/*BOOT* ${RELEASEDIR}
269	-cp ${DESTDIR}/snapshot/cd*.iso ${RELEASEDIR}
270	-cp ${DESTDIR}/snapshot/Packages ${RELEASEDIR}
271	-cp ${DESTDIR}/snapshot/INSTALL.* ${RELEASEDIR}
272	-cp ${DESTDIR}/snapshot/*.fs ${DESTDIR}/snapshot/*.fs.gz ${RELEASEDIR}
273	-cd ${RELEASEDIR}; \
274		md5 *bsd!(*.gz) *boot* cdbr *BOOT* INSTALL.* Packages *.fs \
275		*.iso *.gz *.tgz > MD5
276	-cd ${RELEASEDIR}; \
277		cksum *bsd!(*.gz) *boot* cdbr *BOOT* INSTALL.* Packages *.fs \
278		*.iso *.gz *.tgz > CKSUM
279	-cd ${RELEASEDIR} && sort -o MD5 MD5
280	-cd ${RELEASEDIR} && sort -o CKSUM -k 3 CKSUM
281
282snap_pre:
283	${SUDO} /bin/rm -rf ${DESTDIR}/snapshot
284	${SUDO} ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/snapshot
285
286.endif
287
288.endif	# DESTDIR check
289
290MAKEDEVARCHS+= alpha
291MAKEDEVARCHS+= amd64
292MAKEDEVARCHS+= armish
293MAKEDEVARCHS+= cats
294MAKEDEVARCHS+= hp300
295MAKEDEVARCHS+= hppa
296MAKEDEVARCHS+= hppa64
297MAKEDEVARCHS+= i386
298MAKEDEVARCHS+= landisk
299MAKEDEVARCHS+= luna88k
300MAKEDEVARCHS+= mac68k
301MAKEDEVARCHS+= macppc
302MAKEDEVARCHS+= mvme68k
303MAKEDEVARCHS+= mvme88k
304#MAKEDEVARCHS+= mvmeppc
305MAKEDEVARCHS+= sgi
306MAKEDEVARCHS+= sparc
307MAKEDEVARCHS+= sparc64
308MAKEDEVARCHS+= vax
309MAKEDEVARCHS+= zaurus
310
311clean:
312	rm -f etc.${MACHINE}/MAKEDEV
313
314cleandir:
315	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
316	    ${MAKE} MACHINE=$$m clean; done
317
318MAKEDEVSRC=	MAKEDEV.mi MAKEDEV.sub MAKEDEV.common
319MAKEDEVDOC=	MAKEDEV.man MAKEDEV.mansub MAKEDEV.common
320m4: etc.${M}/MAKEDEV
321man: ${.CURDIR}/../share/man/man8/man.${M}/MAKEDEV.8
322
323etc.${M}/MAKEDEV: ${MAKEDEVSRC} etc.${M}/MAKEDEV.md
324	@echo "==> etc.${M}/MAKEDEV"
325	m4 -DMACHINE=${M} MAKEDEV.mi > etc.${M}/.MAKEDEV.tmp && \
326	    mv etc.${M}/.MAKEDEV.tmp etc.${M}/MAKEDEV || \
327	    rm etc.${M}/.MAKEDEV.tmp
328
329${.CURDIR}/../share/man/man8/man.${M}/MAKEDEV.8: ${MAKEDEVDOC} etc.${M}/MAKEDEV.md
330	m4 -DMACHINE=${M} MAKEDEV.man > \
331	    ${.CURDIR}/../share/man/man8/man8.${M}/MAKEDEV.8
332
333allarchs: ${MAKEDEVSRC} ${MAKEDEVDOC}
334	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
335	    ${MAKE} M=$$m m4 man; done
336
337distrib:
338	cd ${.CURDIR}/../distrib && \
339	    ${MAKE} && exec ${SUDO} ${MAKE} install
340
341DHSIZE=1024 1536 2048 3072 4096
342update-moduli:
343	( \
344		echo '#    $$OpenBSD: Makefile,v 1.248 2007/02/22 16:55:32 henning Exp $$'; \
345		echo '# Time Type Tests Tries Size Generator Modulus'; \
346		( for i in ${DHSIZE}; do \
347			ssh-keygen -b $$i -G /dev/stdout; \
348		done) | \
349		ssh-keygen -T /dev/stdout \
350	) > moduli
351
352.PHONY: distribution-etc-root-var distribution distrib-dirs \
353	release allarchs snap_md m4 snap_pre
354.include <bsd.prog.mk>
355