Makefile revision 1.374
1#	$OpenBSD: Makefile,v 1.374 2014/07/15 09:11:18 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
33BIN1=	changelist csh.cshrc csh.login csh.logout daily dhclient.conf \
34	etc.${MACHINE}/disktab etc.${MACHINE}/login.conf \
35	ftpusers gettytab group hosts ksh.kshrc locate.rc \
36	mailer.conf man.conf mixerctl.conf moduli monthly motd \
37	myname netstart networks newsyslog.conf pf.os protocols \
38	rc rc.conf rpc services shells syslog.conf weekly
39.if ${MACHINE} != "aviion" 
40BIN1+=	wsconsctl.conf
41.endif
42
43EXAMPLES=chio.conf dhcpd.conf exports ftpchroot hosts.lpd ifstated.conf \
44	inetd.conf mrouted.conf ntpd.conf printcap rbootd.conf remote \
45	sensorsd.conf
46
47EXAMPLES_600=bgpd.conf dvmrpd.conf hostapd.conf iked.conf ipsec.conf \
48	ldapd.conf ldpd.conf ospf6d.conf ospfd.conf rc.local \
49	rc.securelevel rc.shutdown relayd.conf ripd.conf \
50	sasyncd.conf snmpd.conf ypldap.conf 
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 examples/sysctl.conf etc.${MACHINE}/sysctl.conf > \
105	    ${DESTDIR}/etc/examples/sysctl.conf && \
106	    chown ${BINOWN} ${DESTDIR}/etc/examples/sysctl.conf && \
107	    chgrp ${BINGRP} ${DESTDIR}/etc/examples/sysctl.conf && \
108	    chmod 644 ${DESTDIR}/etc/examples/sysctl.conf
109	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
110	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
111	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
112	    chmod 644 ${DESTDIR}/etc/fbtab
113	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
114	${INSTALL} -c -o root -g crontab -m 600 crontab ${DESTDIR}/var/cron/tabs/root
115	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
116	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
117	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
118	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/var/nsd/etc
119	${INSTALL} -c -o root -g wheel -m 644 unbound.conf ${DESTDIR}/var/unbound/etc
120	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
121	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
122	cd root; \
123		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
124		    ${DESTDIR}/root/.cshrc; \
125		${INSTALL} -c -o root -g wheel -m 644 dot.login \
126		    ${DESTDIR}/root/.login; \
127		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
128		    ${DESTDIR}/root/.profile; \
129		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
130		    ${DESTDIR}/root/.Xdefaults; \
131		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
132		    ${DESTDIR}/root/.cvsrc; \
133		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
134		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
135		    ${DESTDIR}/.cshrc; \
136		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
137		    ${DESTDIR}/.profile
138	cd skel; \
139		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
140		    ${DESTDIR}/etc/skel/.cshrc; \
141		${INSTALL} -c -o root -g wheel -m 644 dot.login \
142		    ${DESTDIR}/etc/skel/.login; \
143		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
144		    ${DESTDIR}/etc/skel/.mailrc; \
145		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
146		    ${DESTDIR}/etc/skel/.profile; \
147		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
148		    ${DESTDIR}/etc/skel/.Xdefaults; \
149		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
150		    ${DESTDIR}/etc/skel/.cvsrc; \
151		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
152		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
153	cd amd; \
154		${INSTALL} -c -o root -g wheel -m 644 master.sample \
155		    ${DESTDIR}/etc/amd
156	cd ppp; \
157		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
158		    ${DESTDIR}/etc/ppp; \
159		${INSTALL} -c -o root -g wheel -m 600 options \
160		    ${DESTDIR}/etc/ppp; \
161		${INSTALL} -c -o root -g wheel -m 600 options.sample \
162		    ${DESTDIR}/etc/ppp; \
163		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
164		    ${DESTDIR}/etc/ppp; \
165		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
166		    ${DESTDIR}/etc/ppp
167	cd examples; \
168		${INSTALL} -c -o root -g wheel -m 644 ${EXAMPLES} \
169		    ${DESTDIR}/etc/examples; \
170		${INSTALL} -c -o root -g wheel -m 600 ${EXAMPLES_600} \
171		    ${DESTDIR}/etc/examples
172	cd signify; \
173		${INSTALL} -c -o root -g wheel -m 644 *.pub \
174		    ${DESTDIR}/etc/signify
175	cd systrace; \
176		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
177		    ${DESTDIR}/etc/systrace; \
178		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
179		    ${DESTDIR}/etc/systrace
180	cd bind; \
181		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
182		    ${DESTDIR}/var/named/etc/named.conf; \
183		${INSTALL} -c -o root -g named -m 640 named-*.conf \
184		    ${DESTDIR}/var/named/etc; \
185		${INSTALL} -c -o root -g wheel -m 644 root.hint \
186		    ${DESTDIR}/var/named/etc; \
187		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
188		    ${DESTDIR}/var/named/standard/localhost; \
189		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
190		    ${DESTDIR}/var/named/standard/loopback; \
191		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
192		    ${DESTDIR}/var/named/standard/loopback6.arpa
193	/bin/rm -f ${DESTDIR}/etc/localtime
194	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
195	/bin/rm -f ${DESTDIR}/etc/rmt
196	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
197	${INSTALL} -c -o root -g wheel -m 644 minfree \
198	    ${DESTDIR}/var/crash
199	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
200	    ${DESTDIR}/etc/dumpdates
201	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
202	    ${DESTDIR}/var/cron/at.deny
203	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
204	    ${DESTDIR}/var/cron/cron.deny
205	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
206	    ${DESTDIR}/var/cron/log
207	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
208	    ${DESTDIR}/var/db/locate.database
209	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
210	    ${DESTDIR}/var/log/authlog
211	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
212	    ${DESTDIR}/var/log/daemon
213	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
214	    ${DESTDIR}/var/log/failedlogin
215	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
216	    ${DESTDIR}/var/log/ftpd
217	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
218	    ${DESTDIR}/var/log/lastlog
219	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
220	    ${DESTDIR}/var/log/lpd-errs
221	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
222	    ${DESTDIR}/var/log/maillog
223	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
224	    ${DESTDIR}/var/log/messages
225	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
226	    ${DESTDIR}/var/log/secure
227	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
228	    ${DESTDIR}/var/log/sendmail.st
229	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
230	    ${DESTDIR}/var/log/wtmp
231	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
232	    ${DESTDIR}/var/log/xferlog
233	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
234	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
235	cd ../usr.bin/ssh && exec ${MAKE} distribution
236	cd ../lib/libcrypto && exec ${MAKE} distribution
237	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
238	cd ../usr.bin/bgplg && exec ${MAKE} distribution
239	cd ../usr.bin/mail && exec ${MAKE} distribution
240	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
241	cd ../usr.sbin/nginx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
242	cd ../usr.sbin/npppd && exec ${MAKE} distribution
243	cd mail && exec ${MAKE} distribution
244	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
245	    ${DESTDIR}/var/mail/root
246	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
247	    ${DESTDIR}/etc/sudoers
248	cd rc.d; \
249		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
250		    ${DESTDIR}/etc/rc.d && \
251		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
252		    ${DESTDIR}/etc/rc.d
253
254distribution:
255	exec ${SUDO} ${MAKE} distribution-etc-root-var
256	cd .. && exec ${SUDO} ${MAKE} install
257	touch ${DESTDIR}/var/db/sysmerge/etcsum
258	touch ${DESTDIR}/var/db/sysmerge/examplessum
259	ETCLIST=`mktemp /tmp/_etclist.XXXXXXXXXX` || exit 1; \
260	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${ETCLIST}; \
261	cd ${DESTDIR} && \
262		xargs sha256 -h ${DESTDIR}/var/db/sysmerge/etcsum < $${ETCLIST} || true; \
263	rm -f $${ETCLIST}
264	EGLIST=`mktemp /tmp/_eglist.XXXXXXXXXX` || exit 1; \
265	grep -h '/etc/examples/' ../distrib/sets/lists/base/{mi,md.${MACHINE}} | sort > $${EGLIST}; \
266	cd ${DESTDIR} && \
267		xargs sha256 -h ${DESTDIR}/var/db/sysmerge/examplessum < $${EGLIST} || true; \
268	rm -f $${EGLIST}
269
270distrib-dirs:
271	if [ ! -d ${DESTDIR}/. ]; then \
272		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
273	fi
274	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
275	if [ ! -d ${DESTDIR}/usr/src ]; then \
276		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
277	fi
278	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
279
280.ifndef RELEASEDIR
281release:
282	@echo setenv RELEASEDIR before building a release.
283	@false
284.else
285
286release-sets:
287	cd ${RELEASEDIR} && rm -f SHA256
288	cd ../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
289
290sha:
291	-cd ${RELEASEDIR}; \
292	    cksum -a sha256 INSTALL.`arch -ks` \
293	    ${ALL_KERNELS} ${MDEXT} ${MISETS} | sort > SHA256
294
295release: sha
296sha: distrib
297distrib: release-sets kernels
298release-sets: distribution kernels
299
300.endif
301
302.endif	# DESTDIR check
303
304distrib:
305	cd ../distrib && \
306	    ${MAKE} && exec ${SUDO} ${MAKE} install
307
308.PHONY: distribution-etc-root-var distribution distrib-dirs \
309	release allarchs kernels release-sets m4 install-mtree \
310	bootblocks ${ALL_KERNELS}
311
312SUBDIR+= etc.alpha etc.amd64 etc.armish etc.armv7 etc.aviion
313SUBDIR+= etc.hppa etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
314SUBDIR+= etc.macppc etc.octeon
315SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
316
317.include <bsd.subdir.mk>
318.include <bsd.prog.mk>
319