Makefile revision 1.353
1#	$OpenBSD: Makefile,v 1.353 2014/04/20 18:06:37 tedu 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}/login.conf \
40	etc.${MACHINE}/disktab dhclient.conf mailer.conf ntpd.conf \
41	moduli pf.os sensorsd.conf ifstated.conf mixerctl.conf
42
43.if ${MACHINE} != "aviion" 
44BIN1+=	wsconsctl.conf
45.endif
46
47# -rw-rw-r--
48BIN2=	motd
49
50# -r-xr-xr-x
51RCDAEMONS=	amd apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd \
52		ftpd ftpproxy hostapd hotplugd identd ifstated iked \
53		inetd isakmpd ldapd npppd ldattach ldpd lpd mopd mrouted \
54		named nginx nsd ntpd ospfd ospf6d portmap pflogd rarpd rbootd \
55		relayd ripd route6d rtadvd rtsold rwhod sasyncd sendmail \
56		sensorsd slowcgi smtpd snmpd spamd sshd syslogd watchdogd \
57		wsmoused xdm ypbind ypldap yppasswdd ypserv kdc kadmind \
58		kpasswdd nfsd mountd lockd statd spamlogd sndiod \
59		tftpd tftpproxy ldomd ipropd_master ipropd_slave unbound
60
61MISETS=	base${OSrev}.tgz comp${OSrev}.tgz \
62	man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz
63
64# Use NOGZIP on architectures where the gzip'ing would take too much time
65# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
66# gzip them on a faster machine
67.ifndef NOGZIP
68GZIPCMD?=	gzip
69GZIPFLAGS?=	-9
70GZIPEXT?=	.gz
71.else
72GZIPCMD=	cat
73GZIPFLAGS=
74GZIPEXT=
75.endif
76
77all clean cleandir depend etc install lint:
78
79install-mtree:
80	${INSTALL} -c -o root -g wheel -m 600 mtree/special \
81	    ${DESTDIR}${MTREEDIR}
82	${INSTALL} -c -o root -g wheel -m 444 mtree/4.4BSD.dist \
83	    ${DESTDIR}${MTREEDIR}
84	${INSTALL} -c -o root -g wheel -m 444 mtree/BSD.local.dist \
85	    ${DESTDIR}${MTREEDIR}
86	${INSTALL} -c -o root -g wheel -m 444 mtree/BSD.x11.dist \
87	    ${DESTDIR}${MTREEDIR}
88
89.ifndef DESTDIR
90distribution-etc-root-var distribution distrib-dirs release:
91	@echo setenv DESTDIR before doing that!
92	@false
93.else
94distribution-etc-root-var: distrib-dirs
95	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
96	ksh ttys.pty | cat etc.${MACHINE}/ttys - > ${DESTDIR}/etc/ttys && \
97	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
98	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
99	    chmod 644 ${DESTDIR}/etc/ttys
100	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
101	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
102	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
103	    chmod 644 ${DESTDIR}/etc/sysctl.conf
104	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
105	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
106	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
107	    chmod 644 ${DESTDIR}/etc/fbtab
108	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
109	${INSTALL} -c -o root -g crontab -m 600 crontab ${DESTDIR}/var/cron/tabs/root
110	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
111	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
112	${INSTALL} -c -o root -g wheel -m 600 bgpd.conf ${DESTDIR}/etc
113	${INSTALL} -c -o root -g wheel -m 600 ospfd.conf ${DESTDIR}/etc
114	${INSTALL} -c -o root -g wheel -m 600 ospf6d.conf ${DESTDIR}/etc
115	${INSTALL} -c -o root -g wheel -m 600 ripd.conf ${DESTDIR}/etc
116	${INSTALL} -c -o root -g wheel -m 600 dvmrpd.conf ${DESTDIR}/etc
117	${INSTALL} -c -o root -g wheel -m 600 ldpd.conf ${DESTDIR}/etc
118	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
119	${INSTALL} -c -o root -g operator -m 644 chio.conf ${DESTDIR}/etc
120	${INSTALL} -c -o root -g wheel -m 600 hostapd.conf ${DESTDIR}/etc
121	${INSTALL} -c -o root -g wheel -m 600 relayd.conf ${DESTDIR}/etc
122	${INSTALL} -c -o root -g wheel -m 600 iked.conf ${DESTDIR}/etc
123	${INSTALL} -c -o root -g wheel -m 600 ipsec.conf ${DESTDIR}/etc
124	${INSTALL} -c -o root -g wheel -m 600 sasyncd.conf ${DESTDIR}/etc
125	${INSTALL} -c -o root -g wheel -m 600 snmpd.conf ${DESTDIR}/etc
126	${INSTALL} -c -o root -g wheel -m 600 ldapd.conf ${DESTDIR}/etc
127	${INSTALL} -c -o root -g wheel -m 600 ypldap.conf ${DESTDIR}/etc
128	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/var/nsd/etc
129	${INSTALL} -c -o root -g wheel -m 644 unbound.conf ${DESTDIR}/var/unbound/etc
130	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
131	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
132	cd root; \
133		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
134		    ${DESTDIR}/root/.cshrc; \
135		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
136		    ${DESTDIR}/root/.klogin; \
137		${INSTALL} -c -o root -g wheel -m 644 dot.login \
138		    ${DESTDIR}/root/.login; \
139		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
140		    ${DESTDIR}/root/.profile; \
141		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
142		    ${DESTDIR}/root/.Xdefaults; \
143		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
144		    ${DESTDIR}/root/.cvsrc; \
145		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
146		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
147		    ${DESTDIR}/.cshrc; \
148		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
149		    ${DESTDIR}/.profile
150	cd skel; \
151		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
152		    ${DESTDIR}/etc/skel/.cshrc; \
153		${INSTALL} -c -o root -g wheel -m 644 dot.login \
154		    ${DESTDIR}/etc/skel/.login; \
155		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
156		    ${DESTDIR}/etc/skel/.mailrc; \
157		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
158		    ${DESTDIR}/etc/skel/.profile; \
159		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
160		    ${DESTDIR}/etc/skel/.Xdefaults; \
161		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
162		    ${DESTDIR}/etc/skel/.cvsrc; \
163		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
164		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
165	cd kerberosV; \
166		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
167		    ${DESTDIR}/etc/kerberosV
168	cd amd; \
169		${INSTALL} -c -o root -g wheel -m 644 master.sample \
170		    ${DESTDIR}/etc/amd
171	cd ppp; \
172		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
173		    ${DESTDIR}/etc/ppp; \
174		${INSTALL} -c -o root -g wheel -m 600 options \
175		    ${DESTDIR}/etc/ppp; \
176		${INSTALL} -c -o root -g wheel -m 600 options.sample \
177		    ${DESTDIR}/etc/ppp; \
178		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
179		    ${DESTDIR}/etc/ppp; \
180		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
181		    ${DESTDIR}/etc/ppp
182	cd signify; \
183		${INSTALL} -c -o root -g wheel -m 644 *.pub \
184		    ${DESTDIR}/etc/signify
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 ../lib/libcrypto && exec ${MAKE} distribution
249	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
250	cd ../usr.bin/bgplg && exec ${MAKE} distribution
251	cd ../usr.bin/mail && exec ${MAKE} distribution
252	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
253	cd ../usr.sbin/nginx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
254	cd ../usr.sbin/npppd && exec ${MAKE} distribution
255	cd mail && exec ${MAKE} distribution
256	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
257	    ${DESTDIR}/var/mail/root
258	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
259	    ${DESTDIR}/etc/sudoers
260	cd rc.d; \
261		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
262		    ${DESTDIR}/etc/rc.d && \
263		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
264		    ${DESTDIR}/etc/rc.d
265
266distribution:
267	exec ${SUDO} ${MAKE} distribution-etc-root-var
268	cd .. && exec ${SUDO} ${MAKE} install
269	touch ${DESTDIR}/var/db/sysmerge/etcsum
270	TMPSUM=`mktemp /tmp/_etcsum.XXXXXXXXXX` || exit 1; \
271	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${TMPSUM}; \
272	cd ${DESTDIR} && \
273		xargs cksum < $${TMPSUM} > ${DESTDIR}/var/db/sysmerge/etcsum; \
274	rm -f $${TMPSUM}
275
276distrib-dirs:
277	if [ ! -d ${DESTDIR}/. ]; then \
278		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
279	fi
280	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
281	if [ ! -d ${DESTDIR}/usr/src ]; then \
282		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
283	fi
284	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
285
286.ifndef RELEASEDIR
287release:
288	@echo setenv RELEASEDIR before building a release.
289	@false
290.else
291
292release-sets:
293	cd ${RELEASEDIR} && rm -f SHA256
294	cd ../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
295
296sha:
297	-cd ${RELEASEDIR}; \
298	    cksum -a sha256 INSTALL.`arch -ks` \
299	    ${ALL_KERNELS} ${MDEXT} ${MISETS} | sort > SHA256
300
301release: sha
302sha: distrib
303distrib: release-sets kernels
304release-sets: distribution kernels
305
306.endif
307
308.endif	# DESTDIR check
309
310distrib:
311	cd ../distrib && \
312	    ${MAKE} && exec ${SUDO} ${MAKE} install
313
314.PHONY: distribution-etc-root-var distribution distrib-dirs \
315	release allarchs kernels release-sets m4 install-mtree \
316	bootblocks ${ALL_KERNELS}
317
318SUBDIR+= etc.alpha etc.amd64 etc.armish etc.armv7 etc.aviion
319SUBDIR+= etc.hppa etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
320SUBDIR+= etc.macppc etc.octeon
321SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
322
323.include <bsd.subdir.mk>
324.include <bsd.prog.mk>
325