xref: /openbsd/etc/Makefile (revision dfaf603e)
1#	$OpenBSD: Makefile,v 1.299 2011/07/07 02:22:11 ajacoutot 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 wheel -m 600 ypldap.conf ${DESTDIR}/etc
113	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/etc
114	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
115	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
116	cd root; \
117		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
118		    ${DESTDIR}/root/.cshrc; \
119		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
120		    ${DESTDIR}/root/.klogin; \
121		${INSTALL} -c -o root -g wheel -m 644 dot.login \
122		    ${DESTDIR}/root/.login; \
123		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
124		    ${DESTDIR}/root/.profile; \
125		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
126		    ${DESTDIR}/root/.Xdefaults; \
127		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
128		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
129		    ${DESTDIR}/.cshrc; \
130		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
131		    ${DESTDIR}/.profile
132	cd skel; \
133		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
134		    ${DESTDIR}/etc/skel/.cshrc; \
135		${INSTALL} -c -o root -g wheel -m 644 dot.login \
136		    ${DESTDIR}/etc/skel/.login; \
137		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
138		    ${DESTDIR}/etc/skel/.mailrc; \
139		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
140		    ${DESTDIR}/etc/skel/.profile; \
141		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
142		    ${DESTDIR}/etc/skel/.Xdefaults; \
143		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
144		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
145	cd kerberosV; \
146		${INSTALL} -c -o root -g wheel -m 644 README \
147		    ${DESTDIR}/etc/kerberosV; \
148		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
149		    ${DESTDIR}/etc/kerberosV
150	cd amd; \
151		${INSTALL} -c -o root -g wheel -m 644 master.sample \
152		    ${DESTDIR}/etc/amd
153	cd ppp; \
154		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
155		    ${DESTDIR}/etc/ppp; \
156		${INSTALL} -c -o root -g wheel -m 600 options \
157		    ${DESTDIR}/etc/ppp; \
158		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
159		    ${DESTDIR}/etc/ppp; \
160		${INSTALL} -c -o root -g wheel -m 600 options.sample \
161		    ${DESTDIR}/etc/ppp; \
162		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
163		    ${DESTDIR}/etc/ppp; \
164		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
165		    ${DESTDIR}/etc/ppp; \
166		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
167		    ${DESTDIR}/etc/ppp; \
168		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
169		    ${DESTDIR}/etc/ppp; \
170		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
171		    ${DESTDIR}/etc/ppp; \
172		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
173		    ${DESTDIR}/etc/ppp
174	cd afs; \
175		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
176		    ${DESTDIR}/etc/afs; \
177		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
178		    ${DESTDIR}/etc/afs; \
179		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
180		    ${DESTDIR}/etc/afs; \
181		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
182		    ${DESTDIR}/etc/afs; \
183		${INSTALL} -c -o root -g wheel -m 644 README \
184		    ${DESTDIR}/etc/afs
185	cd systrace; \
186		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
187		    ${DESTDIR}/etc/systrace; \
188		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
189		    ${DESTDIR}/etc/systrace
190	cd bind; \
191		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
192		    ${DESTDIR}/var/named/etc/named.conf; \
193		${INSTALL} -c -o root -g named -m 640 named-*.conf \
194		    ${DESTDIR}/var/named/etc; \
195		${INSTALL} -c -o root -g wheel -m 644 root.hint \
196		    ${DESTDIR}/var/named/etc; \
197		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
198		    ${DESTDIR}/var/named/standard/localhost; \
199		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
200		    ${DESTDIR}/var/named/standard/loopback; \
201		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
202		    ${DESTDIR}/var/named/standard/loopback6.arpa
203	/bin/rm -f ${DESTDIR}/etc/localtime
204	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
205	/bin/rm -f ${DESTDIR}/etc/rmt
206	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
207	${INSTALL} -c -o root -g wheel -m 644 minfree \
208	    ${DESTDIR}/var/crash
209	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
210	    ${DESTDIR}/etc/dumpdates
211	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
212	    ${DESTDIR}/var/cron/at.deny
213	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
214	    ${DESTDIR}/var/cron/cron.deny
215	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
216	    ${DESTDIR}/var/cron/log
217	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
218	    ${DESTDIR}/var/db/locate.database
219	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
220	    ${DESTDIR}/var/log/authlog
221	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
222	    ${DESTDIR}/var/log/daemon
223	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
224	    ${DESTDIR}/var/log/failedlogin
225	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
226	    ${DESTDIR}/var/log/ftpd
227	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
228	    ${DESTDIR}/var/log/lastlog
229	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
230	    ${DESTDIR}/var/log/lpd-errs
231	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
232	    ${DESTDIR}/var/log/maillog
233	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
234	    ${DESTDIR}/var/log/messages
235	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
236	    ${DESTDIR}/var/log/secure
237	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
238	    ${DESTDIR}/var/log/sendmail.st
239	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
240	    ${DESTDIR}/var/log/wtmp
241	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
242	    ${DESTDIR}/var/log/xferlog
243	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
244	    ${DESTDIR}/var/run/utmp
245	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
246	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
247	cd ../usr.bin/ssh && exec ${MAKE} distribution
248	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
249	cd ../lib/libssl && exec ${MAKE} distribution
250	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
251	cd ../usr.bin/bgplg && exec ${MAKE} distribution
252	cd ../usr.bin/mail && exec ${MAKE} distribution
253	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
254	cd mail && exec ${MAKE} distribution
255	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
256	    ${DESTDIR}/var/mail/root
257	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
258	    ${DESTDIR}/etc/sudoers
259	cd rc.d; \
260		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
261		    ${DESTDIR}/etc/rc.d && \
262		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
263		    ${DESTDIR}/etc/rc.d
264
265distribution:
266	exec ${SUDO} ${MAKE} distribution-etc-root-var
267	cd .. && exec ${SUDO} ${MAKE} install
268	touch ${DESTDIR}/var/db/sysmerge/etcsum
269	TMPSUM=`mktemp /tmp/_etcsum.XXXXXXXXXX` || exit 1; \
270	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${TMPSUM}; \
271	cd ${DESTDIR} && \
272		xargs cksum < $${TMPSUM} > ${DESTDIR}/var/db/sysmerge/etcsum; \
273	rm -f $${TMPSUM}
274
275distrib-dirs:
276	if [ ! -d ${DESTDIR}/. ]; then \
277		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
278	fi
279	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
280	if [ ! -d ${DESTDIR}/usr/src ]; then \
281		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
282	fi
283	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
284
285.ifndef RELEASEDIR
286release:
287	@echo setenv RELEASEDIR before building a release.
288	@false
289.else
290
291release-sets:
292	cd ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
293
294sha:
295	-cd ${RELEASEDIR}; \
296	    sum -a sha256 INSTALL.`arch -ks` ${MDEXT} ${MISETS} > SHA256
297
298release: distribution kernels release-sets distrib sha
299
300.endif
301
302.endif	# DESTDIR check
303
304distrib:
305	cd ${.CURDIR}/../distrib && \
306	    ${MAKE} && exec ${SUDO} ${MAKE} install
307
308DHSIZE=1024 1536 2048 3072 4096
309update-moduli:
310	( \
311		echo -n '#    $$Open'; echo 'BSD$$'; \
312		echo '# Time Type Tests Tries Size Generator Modulus'; \
313		( for i in ${DHSIZE}; do \
314			ssh-keygen -b $$i -G /dev/stdout; \
315		done) | \
316		ssh-keygen -T /dev/stdout \
317	) > moduli
318
319.PHONY: distribution-etc-root-var distribution distrib-dirs \
320	release allarchs kernels release-sets m4 install-mtree
321
322SUBDIR+= etc.alpha etc.amd64 etc.armish etc.aviion etc.hp300 etc.hppa
323SUBDIR+= etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
324SUBDIR+= etc.mac68k etc.macppc etc.mvme68k etc.mvme88k etc.palm
325SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
326
327.include <bsd.subdir.mk>
328.include <bsd.prog.mk>
329