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