xref: /openbsd/etc/Makefile (revision 2feb0676)
1#	$OpenBSD: Makefile,v 1.290 2010/06/29 17:17:53 nicm 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 daemon -g staff -m 664 /dev/null \
236	    ${DESTDIR}/var/msgs/bounds
237	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
238	    ${DESTDIR}/var/run/utmp
239.if ${MACHINE} == "vax"
240	uudecode -p etc.vax/${PCS}.uu > ${DESTDIR}/${PCS} && \
241	    chown ${BINOWN} ${DESTDIR}/${PCS} && \
242	    chgrp ${BINGRP} ${DESTDIR}/${PCS} && \
243	    chmod 644 ${DESTDIR}/${PCS}
244.endif
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
260distribution:
261	exec ${SUDO} ${MAKE} distribution-etc-root-var
262	cd .. && exec ${SUDO} ${MAKE} install
263	touch ${DESTDIR}/var/db/sysmerge/etcsum
264	TMPSUM=`mktemp /tmp/_etcsum.XXXXXXXXXX` || exit 1; \
265	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${TMPSUM}; \
266	cd ${DESTDIR} && \
267		xargs cksum < $${TMPSUM} > ${DESTDIR}/var/db/sysmerge/etcsum; \
268	rm -f $${TMPSUM}
269
270distrib-dirs:
271	if [ ! -d ${DESTDIR}/. ]; then \
272		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
273	fi
274	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
275	if [ ! -d ${DESTDIR}/usr/src ]; then \
276		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
277	fi
278	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
279
280.ifndef RELEASEDIR
281release:
282	@echo setenv RELEASEDIR before building a release.
283	@false
284.else
285
286release-sets:
287	cd ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
288
289sha:
290	-cd ${RELEASEDIR}; \
291	    sum -a sha256 INSTALL.`arch -ks` ${MDEXT} ${MISETS} > SHA256
292
293release: distribution kernels release-sets distrib sha
294
295.endif
296
297.endif	# DESTDIR check
298
299distrib:
300	cd ${.CURDIR}/../distrib && \
301	    ${MAKE} && exec ${SUDO} ${MAKE} install
302
303DHSIZE=1024 1536 2048 3072 4096
304update-moduli:
305	( \
306		echo -n '#    $$Open'; echo 'BSD$$'; \
307		echo '# Time Type Tests Tries Size Generator Modulus'; \
308		( for i in ${DHSIZE}; do \
309			ssh-keygen -b $$i -G /dev/stdout; \
310		done) | \
311		ssh-keygen -T /dev/stdout \
312	) > moduli
313
314.PHONY: distribution-etc-root-var distribution distrib-dirs \
315	release allarchs kernels release-sets m4 install-mtree
316
317SUBDIR+= etc.alpha etc.amd64 etc.armish etc.aviion etc.hp300 etc.hppa
318SUBDIR+= etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
319SUBDIR+= etc.mac68k etc.macppc etc.mvme68k etc.mvme88k etc.palm
320SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
321
322.include <bsd.subdir.mk>
323.include <bsd.prog.mk>
324