Makefile revision 1.355
1#	$OpenBSD: Makefile,v 1.355 2014/04/23 09:56:56 ajacoutot 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 nfsd mountd lockd \
58		statd spamlogd sndiod tftpd tftpproxy ldomd unbound
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 mtree/special \
80	    ${DESTDIR}${MTREEDIR}
81	${INSTALL} -c -o root -g wheel -m 444 mtree/4.4BSD.dist \
82	    ${DESTDIR}${MTREEDIR}
83	${INSTALL} -c -o root -g wheel -m 444 mtree/BSD.local.dist \
84	    ${DESTDIR}${MTREEDIR}
85	${INSTALL} -c -o root -g wheel -m 444 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	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
108	${INSTALL} -c -o root -g crontab -m 600 crontab ${DESTDIR}/var/cron/tabs/root
109	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
110	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
111	${INSTALL} -c -o root -g wheel -m 600 bgpd.conf ${DESTDIR}/etc
112	${INSTALL} -c -o root -g wheel -m 600 ospfd.conf ${DESTDIR}/etc
113	${INSTALL} -c -o root -g wheel -m 600 ospf6d.conf ${DESTDIR}/etc
114	${INSTALL} -c -o root -g wheel -m 600 ripd.conf ${DESTDIR}/etc
115	${INSTALL} -c -o root -g wheel -m 600 dvmrpd.conf ${DESTDIR}/etc
116	${INSTALL} -c -o root -g wheel -m 600 ldpd.conf ${DESTDIR}/etc
117	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
118	${INSTALL} -c -o root -g operator -m 644 chio.conf ${DESTDIR}/etc
119	${INSTALL} -c -o root -g wheel -m 600 hostapd.conf ${DESTDIR}/etc
120	${INSTALL} -c -o root -g wheel -m 600 relayd.conf ${DESTDIR}/etc
121	${INSTALL} -c -o root -g wheel -m 600 iked.conf ${DESTDIR}/etc
122	${INSTALL} -c -o root -g wheel -m 600 ipsec.conf ${DESTDIR}/etc
123	${INSTALL} -c -o root -g wheel -m 600 sasyncd.conf ${DESTDIR}/etc
124	${INSTALL} -c -o root -g wheel -m 600 snmpd.conf ${DESTDIR}/etc
125	${INSTALL} -c -o root -g wheel -m 600 ldapd.conf ${DESTDIR}/etc
126	${INSTALL} -c -o root -g wheel -m 600 ypldap.conf ${DESTDIR}/etc
127	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/var/nsd/etc
128	${INSTALL} -c -o root -g wheel -m 644 unbound.conf ${DESTDIR}/var/unbound/etc
129	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
130	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
131	cd root; \
132		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
133		    ${DESTDIR}/root/.cshrc; \
134		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
135		    ${DESTDIR}/root/.klogin; \
136		${INSTALL} -c -o root -g wheel -m 644 dot.login \
137		    ${DESTDIR}/root/.login; \
138		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
139		    ${DESTDIR}/root/.profile; \
140		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
141		    ${DESTDIR}/root/.Xdefaults; \
142		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
143		    ${DESTDIR}/root/.cvsrc; \
144		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
145		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
146		    ${DESTDIR}/.cshrc; \
147		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
148		    ${DESTDIR}/.profile
149	cd skel; \
150		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
151		    ${DESTDIR}/etc/skel/.cshrc; \
152		${INSTALL} -c -o root -g wheel -m 644 dot.login \
153		    ${DESTDIR}/etc/skel/.login; \
154		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
155		    ${DESTDIR}/etc/skel/.mailrc; \
156		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
157		    ${DESTDIR}/etc/skel/.profile; \
158		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
159		    ${DESTDIR}/etc/skel/.Xdefaults; \
160		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
161		    ${DESTDIR}/etc/skel/.cvsrc; \
162		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
163		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
164	cd amd; \
165		${INSTALL} -c -o root -g wheel -m 644 master.sample \
166		    ${DESTDIR}/etc/amd
167	cd ppp; \
168		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
169		    ${DESTDIR}/etc/ppp; \
170		${INSTALL} -c -o root -g wheel -m 600 options \
171		    ${DESTDIR}/etc/ppp; \
172		${INSTALL} -c -o root -g wheel -m 600 options.sample \
173		    ${DESTDIR}/etc/ppp; \
174		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
175		    ${DESTDIR}/etc/ppp; \
176		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
177		    ${DESTDIR}/etc/ppp
178	cd signify; \
179		${INSTALL} -c -o root -g wheel -m 644 *.pub \
180		    ${DESTDIR}/etc/signify
181	cd systrace; \
182		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
183		    ${DESTDIR}/etc/systrace; \
184		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
185		    ${DESTDIR}/etc/systrace
186	cd bind; \
187		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
188		    ${DESTDIR}/var/named/etc/named.conf; \
189		${INSTALL} -c -o root -g named -m 640 named-*.conf \
190		    ${DESTDIR}/var/named/etc; \
191		${INSTALL} -c -o root -g wheel -m 644 root.hint \
192		    ${DESTDIR}/var/named/etc; \
193		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
194		    ${DESTDIR}/var/named/standard/localhost; \
195		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
196		    ${DESTDIR}/var/named/standard/loopback; \
197		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
198		    ${DESTDIR}/var/named/standard/loopback6.arpa
199	/bin/rm -f ${DESTDIR}/etc/localtime
200	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
201	/bin/rm -f ${DESTDIR}/etc/rmt
202	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
203	${INSTALL} -c -o root -g wheel -m 644 minfree \
204	    ${DESTDIR}/var/crash
205	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
206	    ${DESTDIR}/etc/dumpdates
207	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
208	    ${DESTDIR}/var/cron/at.deny
209	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
210	    ${DESTDIR}/var/cron/cron.deny
211	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
212	    ${DESTDIR}/var/cron/log
213	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
214	    ${DESTDIR}/var/db/locate.database
215	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
216	    ${DESTDIR}/var/log/authlog
217	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
218	    ${DESTDIR}/var/log/daemon
219	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
220	    ${DESTDIR}/var/log/failedlogin
221	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
222	    ${DESTDIR}/var/log/ftpd
223	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
224	    ${DESTDIR}/var/log/lastlog
225	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
226	    ${DESTDIR}/var/log/lpd-errs
227	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
228	    ${DESTDIR}/var/log/maillog
229	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
230	    ${DESTDIR}/var/log/messages
231	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
232	    ${DESTDIR}/var/log/secure
233	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
234	    ${DESTDIR}/var/log/sendmail.st
235	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
236	    ${DESTDIR}/var/log/wtmp
237	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
238	    ${DESTDIR}/var/log/xferlog
239	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
240	    ${DESTDIR}/var/run/utmp
241	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
242	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
243	cd ../usr.bin/ssh && exec ${MAKE} distribution
244	cd ../lib/libcrypto && exec ${MAKE} distribution
245	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
246	cd ../usr.bin/bgplg && exec ${MAKE} distribution
247	cd ../usr.bin/mail && exec ${MAKE} distribution
248	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
249	cd ../usr.sbin/nginx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
250	cd ../usr.sbin/npppd && exec ${MAKE} distribution
251	cd mail && exec ${MAKE} distribution
252	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
253	    ${DESTDIR}/var/mail/root
254	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
255	    ${DESTDIR}/etc/sudoers
256	cd rc.d; \
257		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
258		    ${DESTDIR}/etc/rc.d && \
259		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
260		    ${DESTDIR}/etc/rc.d
261
262distribution:
263	exec ${SUDO} ${MAKE} distribution-etc-root-var
264	cd .. && exec ${SUDO} ${MAKE} install
265	touch ${DESTDIR}/var/db/sysmerge/etcsum
266	TMPSUM=`mktemp /tmp/_etcsum.XXXXXXXXXX` || exit 1; \
267	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${TMPSUM}; \
268	cd ${DESTDIR} && \
269		xargs cksum < $${TMPSUM} > ${DESTDIR}/var/db/sysmerge/etcsum; \
270	rm -f $${TMPSUM}
271
272distrib-dirs:
273	if [ ! -d ${DESTDIR}/. ]; then \
274		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
275	fi
276	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
277	if [ ! -d ${DESTDIR}/usr/src ]; then \
278		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
279	fi
280	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
281
282.ifndef RELEASEDIR
283release:
284	@echo setenv RELEASEDIR before building a release.
285	@false
286.else
287
288release-sets:
289	cd ${RELEASEDIR} && rm -f SHA256
290	cd ../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
291
292sha:
293	-cd ${RELEASEDIR}; \
294	    cksum -a sha256 INSTALL.`arch -ks` \
295	    ${ALL_KERNELS} ${MDEXT} ${MISETS} | sort > SHA256
296
297release: sha
298sha: distrib
299distrib: release-sets kernels
300release-sets: distribution kernels
301
302.endif
303
304.endif	# DESTDIR check
305
306distrib:
307	cd ../distrib && \
308	    ${MAKE} && exec ${SUDO} ${MAKE} install
309
310.PHONY: distribution-etc-root-var distribution distrib-dirs \
311	release allarchs kernels release-sets m4 install-mtree \
312	bootblocks ${ALL_KERNELS}
313
314SUBDIR+= etc.alpha etc.amd64 etc.armish etc.armv7 etc.aviion
315SUBDIR+= etc.hppa etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
316SUBDIR+= etc.macppc etc.octeon
317SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
318
319.include <bsd.subdir.mk>
320.include <bsd.prog.mk>
321