Makefile revision 1.369
1#	$OpenBSD: Makefile,v 1.369 2014/07/13 13:01:48 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 \
34	ftpusers gettytab group hosts ksh.kshrc locate.rc \
35	man.conf monthly motd myname netstart networks \
36	newsyslog.conf protocols rc rc.conf rc.local \
37	rc.securelevel rc.shutdown rpc services shells syslog.conf \
38	weekly etc.${MACHINE}/login.conf etc.${MACHINE}/disktab \
39	dhclient.conf mailer.conf ntpd.conf moduli pf.os mixerctl.conf
40
41EXAMPLES=chio.conf dhcpd.conf exports ftpchroot hosts.lpd ifstated.conf \
42	inetd.conf mrouted.conf printcap rbootd.conf remote sensorsd.conf
43
44EXAMPLES_600=bgpd.conf dvmrpd.conf hostapd.conf iked.conf ipsec.conf \
45	ldapd.conf ldpd.conf ospf6d.conf ospfd.conf relayd.conf ripd.conf \
46	sasyncd.conf snmpd.conf ypldap.conf
47
48.if ${MACHINE} != "aviion" 
49BIN1+=	wsconsctl.conf
50.endif
51
52# -rw-rw-r--
53BIN2=	motd
54
55# -r-xr-xr-x
56RCDAEMONS=	amd apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd \
57		ftpd ftpproxy hostapd hotplugd identd ifstated iked \
58		inetd isakmpd ldapd npppd ldattach ldpd lpd mopd mrouted \
59		named nginx nsd ntpd ospfd ospf6d portmap pflogd rarpd rbootd \
60		relayd ripd route6d rtadvd rtsold sasyncd sendmail \
61		sensorsd slowcgi smtpd snmpd spamd sshd syslogd watchdogd \
62		wsmoused xdm ypbind ypldap yppasswdd ypserv nfsd mountd lockd \
63		statd spamlogd sndiod tftpd tftpproxy ldomd unbound iscsid
64
65MISETS=	base${OSrev}.tgz comp${OSrev}.tgz \
66	man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz
67
68# Use NOGZIP on architectures where the gzip'ing would take too much time
69# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
70# gzip them on a faster machine
71.ifndef NOGZIP
72GZIPCMD?=	gzip
73GZIPFLAGS?=	-9
74GZIPEXT?=	.gz
75.else
76GZIPCMD=	cat
77GZIPFLAGS=
78GZIPEXT=
79.endif
80
81all clean cleandir depend etc install lint:
82
83install-mtree:
84	${INSTALL} -c -o root -g wheel -m 600 mtree/special \
85	    ${DESTDIR}${MTREEDIR}
86	${INSTALL} -c -o root -g wheel -m 444 mtree/4.4BSD.dist \
87	    ${DESTDIR}${MTREEDIR}
88	${INSTALL} -c -o root -g wheel -m 444 mtree/BSD.local.dist \
89	    ${DESTDIR}${MTREEDIR}
90	${INSTALL} -c -o root -g wheel -m 444 mtree/BSD.x11.dist \
91	    ${DESTDIR}${MTREEDIR}
92
93.ifndef DESTDIR
94distribution-etc-root-var distribution distrib-dirs release:
95	@echo setenv DESTDIR before doing that!
96	@false
97.else
98distribution-etc-root-var: distrib-dirs
99	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
100	ksh ttys.pty | cat etc.${MACHINE}/ttys - > ${DESTDIR}/etc/ttys && \
101	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
102	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
103	    chmod 644 ${DESTDIR}/etc/ttys
104	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
105	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
106	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
107	    chmod 644 ${DESTDIR}/etc/sysctl.conf
108	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
109	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
110	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
111	    chmod 644 ${DESTDIR}/etc/fbtab
112	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${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 pf.conf ${DESTDIR}/etc
117	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/var/nsd/etc
118	${INSTALL} -c -o root -g wheel -m 644 unbound.conf ${DESTDIR}/var/unbound/etc
119	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
120	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
121	cd root; \
122		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
123		    ${DESTDIR}/root/.cshrc; \
124		${INSTALL} -c -o root -g wheel -m 644 dot.login \
125		    ${DESTDIR}/root/.login; \
126		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
127		    ${DESTDIR}/root/.profile; \
128		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
129		    ${DESTDIR}/root/.Xdefaults; \
130		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
131		    ${DESTDIR}/root/.cvsrc; \
132		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
133		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
134		    ${DESTDIR}/.cshrc; \
135		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
136		    ${DESTDIR}/.profile
137	cd skel; \
138		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
139		    ${DESTDIR}/etc/skel/.cshrc; \
140		${INSTALL} -c -o root -g wheel -m 644 dot.login \
141		    ${DESTDIR}/etc/skel/.login; \
142		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
143		    ${DESTDIR}/etc/skel/.mailrc; \
144		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
145		    ${DESTDIR}/etc/skel/.profile; \
146		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
147		    ${DESTDIR}/etc/skel/.Xdefaults; \
148		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
149		    ${DESTDIR}/etc/skel/.cvsrc; \
150		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
151		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
152	cd amd; \
153		${INSTALL} -c -o root -g wheel -m 644 master.sample \
154		    ${DESTDIR}/etc/amd
155	cd ppp; \
156		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
157		    ${DESTDIR}/etc/ppp; \
158		${INSTALL} -c -o root -g wheel -m 600 options \
159		    ${DESTDIR}/etc/ppp; \
160		${INSTALL} -c -o root -g wheel -m 600 options.sample \
161		    ${DESTDIR}/etc/ppp; \
162		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
163		    ${DESTDIR}/etc/ppp; \
164		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
165		    ${DESTDIR}/etc/ppp
166	cd examples; \
167		${INSTALL} -c -o root -g wheel -m 644 ${EXAMPLES} \
168		    ${DESTDIR}/etc/examples; \
169		${INSTALL} -c -o root -g wheel -m 600 ${EXAMPLES_600} \
170		    ${DESTDIR}/etc/examples
171	cd signify; \
172		${INSTALL} -c -o root -g wheel -m 644 *.pub \
173		    ${DESTDIR}/etc/signify
174	cd systrace; \
175		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
176		    ${DESTDIR}/etc/systrace; \
177		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
178		    ${DESTDIR}/etc/systrace
179	cd bind; \
180		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
181		    ${DESTDIR}/var/named/etc/named.conf; \
182		${INSTALL} -c -o root -g named -m 640 named-*.conf \
183		    ${DESTDIR}/var/named/etc; \
184		${INSTALL} -c -o root -g wheel -m 644 root.hint \
185		    ${DESTDIR}/var/named/etc; \
186		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
187		    ${DESTDIR}/var/named/standard/localhost; \
188		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
189		    ${DESTDIR}/var/named/standard/loopback; \
190		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
191		    ${DESTDIR}/var/named/standard/loopback6.arpa
192	/bin/rm -f ${DESTDIR}/etc/localtime
193	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
194	/bin/rm -f ${DESTDIR}/etc/rmt
195	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
196	${INSTALL} -c -o root -g wheel -m 644 minfree \
197	    ${DESTDIR}/var/crash
198	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
199	    ${DESTDIR}/etc/dumpdates
200	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
201	    ${DESTDIR}/var/cron/at.deny
202	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
203	    ${DESTDIR}/var/cron/cron.deny
204	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
205	    ${DESTDIR}/var/cron/log
206	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
207	    ${DESTDIR}/var/db/locate.database
208	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
209	    ${DESTDIR}/var/log/authlog
210	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
211	    ${DESTDIR}/var/log/daemon
212	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
213	    ${DESTDIR}/var/log/failedlogin
214	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
215	    ${DESTDIR}/var/log/ftpd
216	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
217	    ${DESTDIR}/var/log/lastlog
218	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
219	    ${DESTDIR}/var/log/lpd-errs
220	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
221	    ${DESTDIR}/var/log/maillog
222	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
223	    ${DESTDIR}/var/log/messages
224	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
225	    ${DESTDIR}/var/log/secure
226	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
227	    ${DESTDIR}/var/log/sendmail.st
228	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
229	    ${DESTDIR}/var/log/wtmp
230	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
231	    ${DESTDIR}/var/log/xferlog
232	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
233	    ${DESTDIR}/var/run/utmp
234	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
235	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
236	cd ../usr.bin/ssh && exec ${MAKE} distribution
237	cd ../lib/libcrypto && exec ${MAKE} distribution
238	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
239	cd ../usr.bin/bgplg && exec ${MAKE} distribution
240	cd ../usr.bin/mail && exec ${MAKE} distribution
241	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
242	cd ../usr.sbin/nginx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
243	cd ../usr.sbin/npppd && exec ${MAKE} distribution
244	cd mail && exec ${MAKE} distribution
245	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
246	    ${DESTDIR}/var/mail/root
247	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
248	    ${DESTDIR}/etc/sudoers
249	cd rc.d; \
250		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
251		    ${DESTDIR}/etc/rc.d && \
252		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
253		    ${DESTDIR}/etc/rc.d
254
255distribution:
256	exec ${SUDO} ${MAKE} distribution-etc-root-var
257	cd .. && exec ${SUDO} ${MAKE} install
258	touch ${DESTDIR}/var/db/sysmerge/etcsum
259	touch ${DESTDIR}/var/db/sysmerge/examplessum
260	ETCLIST=`mktemp /tmp/_etclist.XXXXXXXXXX` || exit 1; \
261	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${ETCLIST}; \
262	cd ${DESTDIR} && \
263		xargs sha256 -h ${DESTDIR}/var/db/sysmerge/etcsum < $${ETCLIST} || true; \
264	rm -f $${ETCLIST}
265	EGLIST=`mktemp /tmp/_eglist.XXXXXXXXXX` || exit 1; \
266	grep -h '/etc/examples/' ../distrib/sets/lists/base/{mi,md.${MACHINE}} | sort > $${EGLIST}; \
267	cd ${DESTDIR} && \
268		xargs sha256 -h ${DESTDIR}/var/db/sysmerge/examplessum < $${EGLIST} || true; \
269	rm -f $${EGLIST}
270
271distrib-dirs:
272	if [ ! -d ${DESTDIR}/. ]; then \
273		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
274	fi
275	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
276	if [ ! -d ${DESTDIR}/usr/src ]; then \
277		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
278	fi
279	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
280
281.ifndef RELEASEDIR
282release:
283	@echo setenv RELEASEDIR before building a release.
284	@false
285.else
286
287release-sets:
288	cd ${RELEASEDIR} && rm -f SHA256
289	cd ../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
290
291sha:
292	-cd ${RELEASEDIR}; \
293	    cksum -a sha256 INSTALL.`arch -ks` \
294	    ${ALL_KERNELS} ${MDEXT} ${MISETS} | sort > SHA256
295
296release: sha
297sha: distrib
298distrib: release-sets kernels
299release-sets: distribution kernels
300
301.endif
302
303.endif	# DESTDIR check
304
305distrib:
306	cd ../distrib && \
307	    ${MAKE} && exec ${SUDO} ${MAKE} install
308
309.PHONY: distribution-etc-root-var distribution distrib-dirs \
310	release allarchs kernels release-sets m4 install-mtree \
311	bootblocks ${ALL_KERNELS}
312
313SUBDIR+= etc.alpha etc.amd64 etc.armish etc.armv7 etc.aviion
314SUBDIR+= etc.hppa etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
315SUBDIR+= etc.macppc etc.octeon
316SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
317
318.include <bsd.subdir.mk>
319.include <bsd.prog.mk>
320