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