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