Makefile revision 1.367
1#	$OpenBSD: Makefile,v 1.367 2014/07/13 12:07:40 claudio 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=bgpd.conf chio.conf dhcpd.conf dvmrpd.conf exports ftpchroot \
42	hostapd.conf hosts.lpd ifstated.conf iked.conf \
43	inetd.conf ipsec.conf ldapd.conf ldpd.conf mrouted.conf \
44	ospf6d.conf ospfd.conf printcap rbootd.conf relayd.conf \
45	remote ripd.conf sasyncd.conf sensorsd.conf snmpd.conf \
46	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	cd signify; \
170		${INSTALL} -c -o root -g wheel -m 644 *.pub \
171		    ${DESTDIR}/etc/signify
172	cd systrace; \
173		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
174		    ${DESTDIR}/etc/systrace; \
175		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
176		    ${DESTDIR}/etc/systrace
177	cd bind; \
178		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
179		    ${DESTDIR}/var/named/etc/named.conf; \
180		${INSTALL} -c -o root -g named -m 640 named-*.conf \
181		    ${DESTDIR}/var/named/etc; \
182		${INSTALL} -c -o root -g wheel -m 644 root.hint \
183		    ${DESTDIR}/var/named/etc; \
184		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
185		    ${DESTDIR}/var/named/standard/localhost; \
186		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
187		    ${DESTDIR}/var/named/standard/loopback; \
188		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
189		    ${DESTDIR}/var/named/standard/loopback6.arpa
190	/bin/rm -f ${DESTDIR}/etc/localtime
191	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
192	/bin/rm -f ${DESTDIR}/etc/rmt
193	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
194	${INSTALL} -c -o root -g wheel -m 644 minfree \
195	    ${DESTDIR}/var/crash
196	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
197	    ${DESTDIR}/etc/dumpdates
198	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
199	    ${DESTDIR}/var/cron/at.deny
200	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
201	    ${DESTDIR}/var/cron/cron.deny
202	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
203	    ${DESTDIR}/var/cron/log
204	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
205	    ${DESTDIR}/var/db/locate.database
206	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
207	    ${DESTDIR}/var/log/authlog
208	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
209	    ${DESTDIR}/var/log/daemon
210	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
211	    ${DESTDIR}/var/log/failedlogin
212	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
213	    ${DESTDIR}/var/log/ftpd
214	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
215	    ${DESTDIR}/var/log/lastlog
216	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
217	    ${DESTDIR}/var/log/lpd-errs
218	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
219	    ${DESTDIR}/var/log/maillog
220	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
221	    ${DESTDIR}/var/log/messages
222	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
223	    ${DESTDIR}/var/log/secure
224	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
225	    ${DESTDIR}/var/log/sendmail.st
226	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
227	    ${DESTDIR}/var/log/wtmp
228	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
229	    ${DESTDIR}/var/log/xferlog
230	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
231	    ${DESTDIR}/var/run/utmp
232	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
233	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
234	cd ../usr.bin/ssh && exec ${MAKE} distribution
235	cd ../lib/libcrypto && exec ${MAKE} distribution
236	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
237	cd ../usr.bin/bgplg && exec ${MAKE} distribution
238	cd ../usr.bin/mail && exec ${MAKE} distribution
239	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
240	cd ../usr.sbin/nginx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
241	cd ../usr.sbin/npppd && exec ${MAKE} distribution
242	cd mail && exec ${MAKE} distribution
243	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
244	    ${DESTDIR}/var/mail/root
245	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
246	    ${DESTDIR}/etc/sudoers
247	cd rc.d; \
248		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
249		    ${DESTDIR}/etc/rc.d && \
250		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
251		    ${DESTDIR}/etc/rc.d
252
253distribution:
254	exec ${SUDO} ${MAKE} distribution-etc-root-var
255	cd .. && exec ${SUDO} ${MAKE} install
256	touch ${DESTDIR}/var/db/sysmerge/etcsum
257	touch ${DESTDIR}/var/db/sysmerge/examplessum
258	ETCLIST=`mktemp /tmp/_etclist.XXXXXXXXXX` || exit 1; \
259	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${ETCLIST}; \
260	cd ${DESTDIR} && \
261		xargs sha256 -h ${DESTDIR}/var/db/sysmerge/etcsum < $${ETCLIST}
262	rm -f $${ETCLIST}
263	EGLIST=`mktemp /tmp/_eglist.XXXXXXXXXX` || exit 1; \
264	grep -h '/etc/examples/' ../distrib/sets/lists/base/{mi,md.${MACHINE}} | sort > $${EGLIST}; \
265	cd ${DESTDIR} && \
266		xargs sha256 -h ${DESTDIR}/var/db/sysmerge/examplessum < $${EGLIST}; \
267	rm -f $${EGLIST}
268
269distrib-dirs:
270	if [ ! -d ${DESTDIR}/. ]; then \
271		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
272	fi
273	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
274	if [ ! -d ${DESTDIR}/usr/src ]; then \
275		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
276	fi
277	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
278
279.ifndef RELEASEDIR
280release:
281	@echo setenv RELEASEDIR before building a release.
282	@false
283.else
284
285release-sets:
286	cd ${RELEASEDIR} && rm -f SHA256
287	cd ../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
288
289sha:
290	-cd ${RELEASEDIR}; \
291	    cksum -a sha256 INSTALL.`arch -ks` \
292	    ${ALL_KERNELS} ${MDEXT} ${MISETS} | sort > SHA256
293
294release: sha
295sha: distrib
296distrib: release-sets kernels
297release-sets: distribution kernels
298
299.endif
300
301.endif	# DESTDIR check
302
303distrib:
304	cd ../distrib && \
305	    ${MAKE} && exec ${SUDO} ${MAKE} install
306
307.PHONY: distribution-etc-root-var distribution distrib-dirs \
308	release allarchs kernels release-sets m4 install-mtree \
309	bootblocks ${ALL_KERNELS}
310
311SUBDIR+= etc.alpha etc.amd64 etc.armish etc.armv7 etc.aviion
312SUBDIR+= etc.hppa etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
313SUBDIR+= etc.macppc etc.octeon
314SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
315
316.include <bsd.subdir.mk>
317.include <bsd.prog.mk>
318