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