Makefile revision 1.245
1#	$OpenBSD: Makefile,v 1.245 2006/12/14 18:49:44 kettenis 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
38GZIP?=		gzip
39GZIPFLAGS?=	-9
40GZIPEXT?=	.gz
41.else
42GZIP=		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 ipsec.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		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
98		    ${DESTDIR}/.cshrc; \
99		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
100		    ${DESTDIR}/.profile;
101	cd skel; \
102		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
103		    ${DESTDIR}/etc/skel/.cshrc; \
104		${INSTALL} -c -o root -g wheel -m 644 dot.login \
105		    ${DESTDIR}/etc/skel/.login; \
106		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
107		    ${DESTDIR}/etc/skel/.mailrc; \
108		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
109		    ${DESTDIR}/etc/skel/.profile
110	cd kerberosV; \
111		${INSTALL} -c -o root -g wheel -m 644 README \
112		    ${DESTDIR}/etc/kerberosV; \
113		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
114		    ${DESTDIR}/etc/kerberosV
115	cd amd; \
116		${INSTALL} -c -o root -g wheel -m 644 master.sample \
117		    ${DESTDIR}/etc/amd
118	cd mtree; \
119		${INSTALL} -c -o root -g wheel -m 600 special \
120		    ${DESTDIR}/etc/mtree; \
121		${INSTALL} -c -o root -g wheel -m 444 4.4BSD.dist \
122		    ${DESTDIR}/etc/mtree; \
123		${INSTALL} -c -o root -g wheel -m 444 BSD.local.dist \
124		    ${DESTDIR}/etc/mtree; \
125		${INSTALL} -c -o root -g wheel -m 444 BSD.x11.dist \
126		    ${DESTDIR}/etc/mtree
127	cd ppp; \
128		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
129		    ${DESTDIR}/etc/ppp; \
130		${INSTALL} -c -o root -g wheel -m 600 options \
131		    ${DESTDIR}/etc/ppp; \
132		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
133		    ${DESTDIR}/etc/ppp; \
134		${INSTALL} -c -o root -g wheel -m 600 options.sample \
135		    ${DESTDIR}/etc/ppp; \
136		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
137		    ${DESTDIR}/etc/ppp; \
138		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
139		    ${DESTDIR}/etc/ppp; \
140		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
141		    ${DESTDIR}/etc/ppp; \
142		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
143		    ${DESTDIR}/etc/ppp; \
144		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
145		    ${DESTDIR}/etc/ppp; \
146		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
147		    ${DESTDIR}/etc/ppp
148	cd afs; \
149		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
150		    ${DESTDIR}/etc/afs; \
151		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
152		    ${DESTDIR}/etc/afs; \
153		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
154		    ${DESTDIR}/etc/afs; \
155		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
156		    ${DESTDIR}/etc/afs; \
157		${INSTALL} -c -o root -g wheel -m 644 README \
158		    ${DESTDIR}/etc/afs
159	cd systrace; \
160		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
161		    ${DESTDIR}/etc/systrace; \
162		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
163		    ${DESTDIR}/etc/systrace;
164	cd bind; \
165		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
166		    ${DESTDIR}/var/named/etc/named.conf; \
167		${INSTALL} -c -o root -g named -m 640 named-*.conf \
168		    ${DESTDIR}/var/named/etc; \
169		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
170		    ${DESTDIR}/var/named/standard/localhost; \
171		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
172		    ${DESTDIR}/var/named/standard/loopback; \
173		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
174		    ${DESTDIR}/var/named/standard/loopback6.arpa; \
175		${INSTALL} -c -o root -g wheel -m 644 root.hint \
176		    ${DESTDIR}/var/named/standard; \
177	/bin/rm -f ${DESTDIR}/etc/localtime
178	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
179	/bin/rm -f ${DESTDIR}/etc/rmt
180	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
181	${INSTALL} -c -o root -g wheel -m 644 minfree \
182		${DESTDIR}/var/crash
183	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
184		${DESTDIR}/etc/dumpdates
185	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
186		${DESTDIR}/var/cron/at.deny
187	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
188		${DESTDIR}/var/cron/cron.deny
189	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
190		${DESTDIR}/var/cron/log
191	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
192		${DESTDIR}/var/db/locate.database
193	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
194		${DESTDIR}/var/log/authlog
195	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
196		${DESTDIR}/var/log/daemon
197	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
198		${DESTDIR}/var/log/failedlogin
199	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
200		${DESTDIR}/var/log/ftpd
201	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
202		${DESTDIR}/var/log/lastlog
203	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
204		${DESTDIR}/var/log/lpd-errs
205	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
206		${DESTDIR}/var/log/maillog
207	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
208		${DESTDIR}/var/log/messages
209	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
210		${DESTDIR}/var/log/secure
211	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
212		${DESTDIR}/var/log/sendmail.st
213	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
214		${DESTDIR}/var/log/wtmp
215	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
216		${DESTDIR}/var/log/xferlog
217	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
218		${DESTDIR}/var/msgs/bounds
219	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
220		${DESTDIR}/var/run/utmp
221.if ${MACHINE} == "vax"
222	uudecode -p etc.vax/${PCS}.uu > ${DESTDIR}/${PCS} && \
223	    chown ${BINOWN} ${DESTDIR}/${PCS} && \
224	    chgrp ${BINGRP} ${DESTDIR}/${PCS} && \
225	    chmod 644 ${DESTDIR}/${PCS}
226.endif
227	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
228	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
229	cd ../usr.bin/ssh && exec ${MAKE} distribution
230	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
231	cd ../lib/libssl && exec ${MAKE} distribution
232	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
233	cd ../usr.bin/bgplg && exec ${MAKE} distribution
234	cd ../usr.bin/mail && exec ${MAKE} distribution
235	cd mail && exec ${MAKE} distribution
236	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
237		${DESTDIR}/var/mail/root
238	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
239		${DESTDIR}/etc/sudoers
240
241distribution:
242	exec ${SUDO} ${MAKE} distribution-etc-root-var
243	cd .. && exec ${SUDO} ${MAKE} install
244
245distrib-dirs:
246	if [ ! -d ${DESTDIR}/. ]; then \
247		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
248	fi
249	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
250	if [ ! -d ${DESTDIR}/usr/src ]; then \
251		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
252	fi
253	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
254
255.ifndef RELEASEDIR
256release:
257	@echo setenv RELEASEDIR before building a release.
258	@false
259.else
260release: distribution snap_pre snap_md
261	cd ${.CURDIR}/../distrib/notes && ${MAKE} && exec ${SUDO} ${MAKE} install
262	cd ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
263	-cp ${DESTDIR}/snapshot/*bsd* ${RELEASEDIR}
264	-cp ${DESTDIR}/snapshot/*boot* ${RELEASEDIR}
265	-cp ${DESTDIR}/snapshot/cdbr ${RELEASEDIR}
266	-cp ${DESTDIR}/snapshot/*BOOT* ${RELEASEDIR}
267	-cp ${DESTDIR}/snapshot/cd*.iso ${RELEASEDIR}
268	-cp ${DESTDIR}/snapshot/Packages ${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* cdbr *BOOT* INSTALL.* Packages *.fs \
273		*.iso *.gz *.tgz > MD5
274	-cd ${RELEASEDIR}; \
275		cksum *bsd!(*.gz) *boot* cdbr *BOOT* INSTALL.* Packages *.fs \
276		*.iso *.gz *.tgz > CKSUM
277	-cd ${RELEASEDIR} && sort -o MD5 MD5
278	-cd ${RELEASEDIR} && sort -o CKSUM -k 3 CKSUM
279
280snap_pre:
281	${SUDO} /bin/rm -rf ${DESTDIR}/snapshot
282	${SUDO} ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/snapshot
283
284.endif
285
286.endif	# DESTDIR check
287
288MAKEDEVARCHS+= alpha
289MAKEDEVARCHS+= amd64
290MAKEDEVARCHS+= armish
291MAKEDEVARCHS+= cats
292MAKEDEVARCHS+= hp300
293MAKEDEVARCHS+= hppa
294MAKEDEVARCHS+= hppa64
295MAKEDEVARCHS+= i386
296MAKEDEVARCHS+= landisk
297MAKEDEVARCHS+= luna88k
298MAKEDEVARCHS+= mac68k
299MAKEDEVARCHS+= macppc
300MAKEDEVARCHS+= mvme68k
301MAKEDEVARCHS+= mvme88k
302#MAKEDEVARCHS+= mvmeppc
303MAKEDEVARCHS+= sgi
304MAKEDEVARCHS+= sparc
305MAKEDEVARCHS+= sparc64
306MAKEDEVARCHS+= vax
307MAKEDEVARCHS+= zaurus
308
309clean:
310	rm -f etc.${MACHINE}/MAKEDEV
311
312cleandir:
313	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
314	    ${MAKE} MACHINE=$$m clean; done
315
316MAKEDEVSRC=	MAKEDEV.mi MAKEDEV.sub MAKEDEV.common
317MAKEDEVDOC=	MAKEDEV.man MAKEDEV.mansub MAKEDEV.common
318m4: etc.${M}/MAKEDEV
319man: ${.CURDIR}/../share/man/man8/man.${M}/MAKEDEV.8
320
321etc.${M}/MAKEDEV: ${MAKEDEVSRC} etc.${M}/MAKEDEV.md
322	@echo "==> etc.${M}/MAKEDEV"
323	m4 -DMACHINE=${M} MAKEDEV.mi > etc.${M}/.MAKEDEV.tmp && \
324	    mv etc.${M}/.MAKEDEV.tmp etc.${M}/MAKEDEV || \
325	    rm etc.${M}/.MAKEDEV.tmp
326
327${.CURDIR}/../share/man/man8/man.${M}/MAKEDEV.8: ${MAKEDEVDOC} etc.${M}/MAKEDEV.md
328	m4 -DMACHINE=${M} MAKEDEV.man > \
329	    ${.CURDIR}/../share/man/man8/man8.${M}/MAKEDEV.8
330
331allarchs: ${MAKEDEVSRC} ${MAKEDEVDOC}
332	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
333	    ${MAKE} M=$$m m4 man; done
334
335distrib:
336	cd ${.CURDIR}/../distrib && \
337	    ${MAKE} && exec ${SUDO} ${MAKE} install
338
339DHSIZE=1024 1536 2048 3072 4096
340update-moduli:
341	( \
342		echo '#    $$OpenBSD: Makefile,v 1.245 2006/12/14 18:49:44 kettenis Exp $$'; \
343		echo '# Time Type Tests Tries Size Generator Modulus'; \
344		( for i in ${DHSIZE}; do \
345			ssh-keygen -b $$i -G /dev/stdout; \
346		done) | \
347		ssh-keygen -T /dev/stdout \
348	) > moduli
349
350.PHONY: distribution-etc-root-var distribution distrib-dirs \
351	release allarchs snap_md m4 snap_pre
352.include <bsd.prog.mk>
353