xref: /openbsd/etc/Makefile (revision bdfabe49)
1#	$OpenBSD: Makefile,v 1.298 2011/07/07 01:52:57 robert Exp $
2
3TZDIR=		/usr/share/zoneinfo
4LOCALTIME=	Canada/Mountain
5MTREEDIR=	/etc/mtree
6
7NOOBJ=
8
9.if exists(etc.${MACHINE}/Makefile.inc)
10.include "etc.${MACHINE}/Makefile.inc"
11.endif
12
13# -rw-r--r--
14BINOWN= root
15BINGRP= wheel
16BIN1=	changelist ccd.conf csh.cshrc csh.login csh.logout daily dhcpd.conf \
17	exports ftpusers ftpchroot gettytab group hosts hosts.lpd inetd.conf \
18	ksh.kshrc locate.rc man.conf monthly motd mrouted.conf myname \
19	netstart networks newsyslog.conf printcap protocols \
20	rbootd.conf rc rc.conf rc.local rc.securelevel rc.shutdown \
21	remote rpc services shells syslog.conf weekly \
22	etc.${MACHINE}/disktab dhclient.conf mailer.conf ntpd.conf \
23	moduli pf.os sensorsd.conf ifstated.conf
24
25.if ${MACHINE} != "aviion" && ${MACHINE} != "mvme68k" && \
26    ${MACHINE} != "mvme88k"
27BIN1+=	wsconsctl.conf
28.endif
29
30# -rw-rw-r--
31BIN2=	motd
32
33# -r-xr-xr-x
34RCDAEMONS=	apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd ftpd ftpproxy \
35		hostapd hotplugd httpd identd ifstated iked inetd isakmpd ldapd \
36		ldattach ldpd lpd mopd mrouted named nsd ntpd portmap rarpd \
37		rbootd relayd  ripd route6d rtadvd rtsold rwhod sasyncd sendmail \
38		sensorsd smtpd snmpd sshd syslogd timed watchdogd ypbind ypldap \
39		yppasswdd ypserv
40
41MISETS=	base${OSrev}.tgz comp${OSrev}.tgz \
42	man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz
43
44# Use NOGZIP on architectures where the gzip'ing would take too much time
45# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
46# gzip them on a faster machine
47.ifndef NOGZIP
48GZIPCMD?=	gzip
49GZIPFLAGS?=	-9
50GZIPEXT?=	.gz
51.else
52GZIPCMD=	cat
53GZIPFLAGS=
54GZIPEXT=
55.endif
56
57all clean cleandir depend etc install lint:
58
59install-mtree:
60	${INSTALL} -c -o root -g wheel -m 600 ${.CURDIR}/mtree/special \
61	    ${DESTDIR}${MTREEDIR}
62	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/4.4BSD.dist \
63	    ${DESTDIR}${MTREEDIR}
64	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/BSD.local.dist \
65	    ${DESTDIR}${MTREEDIR}
66	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/BSD.x11.dist \
67	    ${DESTDIR}${MTREEDIR}
68
69.ifndef DESTDIR
70distribution-etc-root-var distribution distrib-dirs release:
71	@echo setenv DESTDIR before doing that!
72	@false
73.else
74distribution-etc-root-var: distrib-dirs
75	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
76	ksh ttys.pty | cat etc.${MACHINE}/ttys - > ${DESTDIR}/etc/ttys && \
77	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
78	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
79	    chmod 644 ${DESTDIR}/etc/ttys
80	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
81	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
82	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
83	    chmod 644 ${DESTDIR}/etc/sysctl.conf
84	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
85	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
86	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
87	    chmod 644 ${DESTDIR}/etc/fbtab
88	awk -f ${.CURDIR}/mklogin.conf `test -f etc.${MACHINE}/login.conf.overrides && echo etc.${MACHINE}/login.conf.overrides` < ${.CURDIR}/login.conf.in > \
89	    ${DESTDIR}/etc/login.conf && \
90	    chown ${BINOWN}:${BINGRP} ${DESTDIR}/etc/login.conf && \
91	    chmod 644 ${DESTDIR}/etc/login.conf
92	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
93	${INSTALL} -c -o root -g wheel -m 600 hosts.equiv ${DESTDIR}/etc
94	${INSTALL} -c -o root -g crontab -m 600 crontab ${DESTDIR}/var/cron/tabs/root
95	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
96	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
97	${INSTALL} -c -o root -g wheel -m 600 bgpd.conf ${DESTDIR}/etc
98	${INSTALL} -c -o root -g wheel -m 600 ospfd.conf ${DESTDIR}/etc
99	${INSTALL} -c -o root -g wheel -m 600 ospf6d.conf ${DESTDIR}/etc
100	${INSTALL} -c -o root -g wheel -m 600 ripd.conf ${DESTDIR}/etc
101	${INSTALL} -c -o root -g wheel -m 600 dvmrpd.conf ${DESTDIR}/etc
102	${INSTALL} -c -o root -g wheel -m 600 ldpd.conf ${DESTDIR}/etc
103	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
104	${INSTALL} -c -o root -g operator -m 644 chio.conf ${DESTDIR}/etc
105	${INSTALL} -c -o root -g wheel -m 600 hostapd.conf ${DESTDIR}/etc
106	${INSTALL} -c -o root -g wheel -m 600 relayd.conf ${DESTDIR}/etc
107	${INSTALL} -c -o root -g wheel -m 600 iked.conf ${DESTDIR}/etc
108	${INSTALL} -c -o root -g wheel -m 600 ipsec.conf ${DESTDIR}/etc
109	${INSTALL} -c -o root -g wheel -m 600 sasyncd.conf ${DESTDIR}/etc
110	${INSTALL} -c -o root -g wheel -m 600 snmpd.conf ${DESTDIR}/etc
111	${INSTALL} -c -o root -g wheel -m 600 ldapd.conf ${DESTDIR}/etc
112	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/etc
113	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
114	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
115	cd root; \
116		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
117		    ${DESTDIR}/root/.cshrc; \
118		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
119		    ${DESTDIR}/root/.klogin; \
120		${INSTALL} -c -o root -g wheel -m 644 dot.login \
121		    ${DESTDIR}/root/.login; \
122		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
123		    ${DESTDIR}/root/.profile; \
124		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
125		    ${DESTDIR}/root/.Xdefaults; \
126		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
127		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
128		    ${DESTDIR}/.cshrc; \
129		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
130		    ${DESTDIR}/.profile
131	cd skel; \
132		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
133		    ${DESTDIR}/etc/skel/.cshrc; \
134		${INSTALL} -c -o root -g wheel -m 644 dot.login \
135		    ${DESTDIR}/etc/skel/.login; \
136		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
137		    ${DESTDIR}/etc/skel/.mailrc; \
138		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
139		    ${DESTDIR}/etc/skel/.profile; \
140		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
141		    ${DESTDIR}/etc/skel/.Xdefaults; \
142		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
143		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
144	cd kerberosV; \
145		${INSTALL} -c -o root -g wheel -m 644 README \
146		    ${DESTDIR}/etc/kerberosV; \
147		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
148		    ${DESTDIR}/etc/kerberosV
149	cd amd; \
150		${INSTALL} -c -o root -g wheel -m 644 master.sample \
151		    ${DESTDIR}/etc/amd
152	cd ppp; \
153		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
154		    ${DESTDIR}/etc/ppp; \
155		${INSTALL} -c -o root -g wheel -m 600 options \
156		    ${DESTDIR}/etc/ppp; \
157		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
158		    ${DESTDIR}/etc/ppp; \
159		${INSTALL} -c -o root -g wheel -m 600 options.sample \
160		    ${DESTDIR}/etc/ppp; \
161		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
162		    ${DESTDIR}/etc/ppp; \
163		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
164		    ${DESTDIR}/etc/ppp; \
165		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
166		    ${DESTDIR}/etc/ppp; \
167		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
168		    ${DESTDIR}/etc/ppp; \
169		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
170		    ${DESTDIR}/etc/ppp; \
171		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
172		    ${DESTDIR}/etc/ppp
173	cd afs; \
174		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
175		    ${DESTDIR}/etc/afs; \
176		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
177		    ${DESTDIR}/etc/afs; \
178		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
179		    ${DESTDIR}/etc/afs; \
180		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
181		    ${DESTDIR}/etc/afs; \
182		${INSTALL} -c -o root -g wheel -m 644 README \
183		    ${DESTDIR}/etc/afs
184	cd systrace; \
185		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
186		    ${DESTDIR}/etc/systrace; \
187		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
188		    ${DESTDIR}/etc/systrace
189	cd bind; \
190		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
191		    ${DESTDIR}/var/named/etc/named.conf; \
192		${INSTALL} -c -o root -g named -m 640 named-*.conf \
193		    ${DESTDIR}/var/named/etc; \
194		${INSTALL} -c -o root -g wheel -m 644 root.hint \
195		    ${DESTDIR}/var/named/etc; \
196		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
197		    ${DESTDIR}/var/named/standard/localhost; \
198		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
199		    ${DESTDIR}/var/named/standard/loopback; \
200		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
201		    ${DESTDIR}/var/named/standard/loopback6.arpa
202	/bin/rm -f ${DESTDIR}/etc/localtime
203	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
204	/bin/rm -f ${DESTDIR}/etc/rmt
205	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
206	${INSTALL} -c -o root -g wheel -m 644 minfree \
207	    ${DESTDIR}/var/crash
208	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
209	    ${DESTDIR}/etc/dumpdates
210	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
211	    ${DESTDIR}/var/cron/at.deny
212	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
213	    ${DESTDIR}/var/cron/cron.deny
214	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
215	    ${DESTDIR}/var/cron/log
216	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
217	    ${DESTDIR}/var/db/locate.database
218	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
219	    ${DESTDIR}/var/log/authlog
220	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
221	    ${DESTDIR}/var/log/daemon
222	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
223	    ${DESTDIR}/var/log/failedlogin
224	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
225	    ${DESTDIR}/var/log/ftpd
226	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
227	    ${DESTDIR}/var/log/lastlog
228	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
229	    ${DESTDIR}/var/log/lpd-errs
230	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
231	    ${DESTDIR}/var/log/maillog
232	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
233	    ${DESTDIR}/var/log/messages
234	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
235	    ${DESTDIR}/var/log/secure
236	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
237	    ${DESTDIR}/var/log/sendmail.st
238	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
239	    ${DESTDIR}/var/log/wtmp
240	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
241	    ${DESTDIR}/var/log/xferlog
242	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
243	    ${DESTDIR}/var/run/utmp
244	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
245	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
246	cd ../usr.bin/ssh && exec ${MAKE} distribution
247	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
248	cd ../lib/libssl && exec ${MAKE} distribution
249	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
250	cd ../usr.bin/bgplg && exec ${MAKE} distribution
251	cd ../usr.bin/mail && exec ${MAKE} distribution
252	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
253	cd mail && exec ${MAKE} distribution
254	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
255	    ${DESTDIR}/var/mail/root
256	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
257	    ${DESTDIR}/etc/sudoers
258	cd rc.d; \
259		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
260		    ${DESTDIR}/etc/rc.d && \
261		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
262		    ${DESTDIR}/etc/rc.d
263
264distribution:
265	exec ${SUDO} ${MAKE} distribution-etc-root-var
266	cd .. && exec ${SUDO} ${MAKE} install
267	touch ${DESTDIR}/var/db/sysmerge/etcsum
268	TMPSUM=`mktemp /tmp/_etcsum.XXXXXXXXXX` || exit 1; \
269	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${TMPSUM}; \
270	cd ${DESTDIR} && \
271		xargs cksum < $${TMPSUM} > ${DESTDIR}/var/db/sysmerge/etcsum; \
272	rm -f $${TMPSUM}
273
274distrib-dirs:
275	if [ ! -d ${DESTDIR}/. ]; then \
276		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
277	fi
278	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
279	if [ ! -d ${DESTDIR}/usr/src ]; then \
280		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
281	fi
282	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
283
284.ifndef RELEASEDIR
285release:
286	@echo setenv RELEASEDIR before building a release.
287	@false
288.else
289
290release-sets:
291	cd ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
292
293sha:
294	-cd ${RELEASEDIR}; \
295	    sum -a sha256 INSTALL.`arch -ks` ${MDEXT} ${MISETS} > SHA256
296
297release: distribution kernels release-sets distrib sha
298
299.endif
300
301.endif	# DESTDIR check
302
303distrib:
304	cd ${.CURDIR}/../distrib && \
305	    ${MAKE} && exec ${SUDO} ${MAKE} install
306
307DHSIZE=1024 1536 2048 3072 4096
308update-moduli:
309	( \
310		echo -n '#    $$Open'; echo 'BSD$$'; \
311		echo '# Time Type Tests Tries Size Generator Modulus'; \
312		( for i in ${DHSIZE}; do \
313			ssh-keygen -b $$i -G /dev/stdout; \
314		done) | \
315		ssh-keygen -T /dev/stdout \
316	) > moduli
317
318.PHONY: distribution-etc-root-var distribution distrib-dirs \
319	release allarchs kernels release-sets m4 install-mtree
320
321SUBDIR+= etc.alpha etc.amd64 etc.armish etc.aviion etc.hp300 etc.hppa
322SUBDIR+= etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
323SUBDIR+= etc.mac68k etc.macppc etc.mvme68k etc.mvme88k etc.palm
324SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
325
326.include <bsd.subdir.mk>
327.include <bsd.prog.mk>
328