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