Makefile revision 1.401
1#	$OpenBSD: Makefile,v 1.401 2015/03/27 18:49:50 schwarze 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 \
34	etc.${MACHINE}/disktab etc.${MACHINE}/login.conf ftpusers \
35	gettytab group ksh.kshrc locate.rc mailer.conf \
36	moduli monthly 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 dhclient.conf dhcpd.conf exports ftpchroot hosts.lpd \
41	httpd.conf ifstated.conf inetd.conf \
42	man.conf mixerctl.conf mrouted.conf \
43	ntpd.conf printcap rbootd.conf remote sensorsd.conf
44.if ${MACHINE} != "aviion" 
45EXAMPLES+= wsconsctl.conf
46.endif
47
48# -rw-------
49EXAMPLES_600=bgpd.conf dvmrpd.conf hostapd.conf iked.conf ipsec.conf \
50	ldapd.conf ldpd.conf ospf6d.conf ospfd.conf pf.conf rc.local \
51	rc.securelevel rc.shutdown relayd.conf ripd.conf \
52	sasyncd.conf snmpd.conf ypldap.conf 
53
54# -r-xr-xr-x
55RCDAEMONS=amd apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd ftpd ftpproxy \
56	hostapd hotplugd httpd identd ifstated iked inetd isakmpd iscsid \
57	ldapd ldattach ldomd ldpd lockd lpd mopd mountd mrouted nfsd \
58	npppd nsd ntpd ospf6d ospfd pflogd portmap rarpd rbootd relayd \
59	ripd route6d rtadvd sasyncd sensorsd slowcgi smtpd sndiod \
60	snmpd spamd spamlogd sshd statd syslogd tftpd tftpproxy unbound \
61	watchdogd wsmoused xdm ypbind ypldap yppasswdd ypserv
62
63MISETS=	base${OSrev}.tgz comp${OSrev}.tgz man${OSrev}.tgz game${OSrev}.tgz
64
65all clean cleandir depend etc install lint:
66
67install-mtree:
68	${INSTALL} -c -o root -g wheel -m 600 mtree/special \
69	    ${DESTDIR}${MTREEDIR}
70	${INSTALL} -c -o root -g wheel -m 444 mtree/4.4BSD.dist \
71	    ${DESTDIR}${MTREEDIR}
72	${INSTALL} -c -o root -g wheel -m 444 mtree/BSD.x11.dist \
73	    ${DESTDIR}${MTREEDIR}
74
75.ifndef DESTDIR
76distribution-etc-root-var distribution distrib-dirs release:
77	@echo setenv DESTDIR before doing that!
78	@false
79.else
80distribution-etc-root-var: distrib-dirs
81	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${MUTABLE} ${DESTDIR}/etc
82	sh ttys.pty | cat etc.${MACHINE}/ttys - > ${DESTDIR}/etc/ttys && \
83	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
84	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
85	    chmod 644 ${DESTDIR}/etc/ttys
86	cat examples/sysctl.conf etc.${MACHINE}/sysctl.conf > \
87	    ${DESTDIR}/etc/examples/sysctl.conf && \
88	    chown ${BINOWN} ${DESTDIR}/etc/examples/sysctl.conf && \
89	    chgrp ${BINGRP} ${DESTDIR}/etc/examples/sysctl.conf && \
90	    chmod 644 ${DESTDIR}/etc/examples/sysctl.conf
91	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
92	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
93	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
94	    chmod 644 ${DESTDIR}/etc/fbtab
95	${INSTALL} -c -o ${BINOWN} -g operator -m 664 motd ${DESTDIR}/etc
96	${INSTALL} -c -o root -g crontab -m 600 crontab ${DESTDIR}/var/cron/tabs/root
97	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
98	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
99	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
100	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/var/nsd/etc
101	${INSTALL} -c -o root -g wheel -m 644 unbound.conf ${DESTDIR}/var/unbound/etc
102	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
103	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
104	cd root; \
105		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
106		    ${DESTDIR}/root/.cshrc; \
107		${INSTALL} -c -o root -g wheel -m 644 dot.login \
108		    ${DESTDIR}/root/.login; \
109		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
110		    ${DESTDIR}/root/.profile; \
111		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
112		    ${DESTDIR}/root/.Xdefaults; \
113		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
114		    ${DESTDIR}/root/.cvsrc; \
115		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
116		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
117		    ${DESTDIR}/.cshrc; \
118		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
119		    ${DESTDIR}/.profile
120	cd skel; \
121		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
122		    ${DESTDIR}/etc/skel/.cshrc; \
123		${INSTALL} -c -o root -g wheel -m 644 dot.login \
124		    ${DESTDIR}/etc/skel/.login; \
125		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
126		    ${DESTDIR}/etc/skel/.mailrc; \
127		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
128		    ${DESTDIR}/etc/skel/.profile; \
129		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
130		    ${DESTDIR}/etc/skel/.Xdefaults; \
131		${INSTALL} -c -o root -g wheel -m 644 dot.cvsrc \
132		    ${DESTDIR}/etc/skel/.cvsrc; \
133		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
134		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
135	cd amd; \
136		${INSTALL} -c -o root -g wheel -m 644 master.sample \
137		    ${DESTDIR}/etc/amd
138	cd ppp; \
139		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
140		    ${DESTDIR}/etc/ppp; \
141		${INSTALL} -c -o root -g wheel -m 600 options \
142		    ${DESTDIR}/etc/ppp; \
143		${INSTALL} -c -o root -g wheel -m 600 options.sample \
144		    ${DESTDIR}/etc/ppp; \
145		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
146		    ${DESTDIR}/etc/ppp; \
147		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
148		    ${DESTDIR}/etc/ppp
149	cd examples; \
150		${INSTALL} -c -o root -g wheel -m 644 ${EXAMPLES} \
151		    ${DESTDIR}/etc/examples; \
152		${INSTALL} -c -o root -g wheel -m 600 ${EXAMPLES_600} \
153		    ${DESTDIR}/etc/examples; \
154		chgrp operator ${DESTDIR}/etc/examples/chio.conf
155	cd signify; \
156		${INSTALL} -c -o root -g wheel -m 644 *.pub \
157		    ${DESTDIR}/etc/signify
158	cd systrace; \
159		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
160		    ${DESTDIR}/etc/systrace; \
161	ln -fs ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
162	ln -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
163	${INSTALL} -c -o root -g wheel -m 644 minfree \
164	    ${DESTDIR}/var/crash
165	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
166	    ${DESTDIR}/etc/dumpdates
167	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
168	    ${DESTDIR}/var/cron/at.deny
169	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
170	    ${DESTDIR}/var/cron/cron.deny
171	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
172	    ${DESTDIR}/var/cron/log
173	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
174	    ${DESTDIR}/var/db/locate.database
175	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
176	    ${DESTDIR}/var/log/authlog
177	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
178	    ${DESTDIR}/var/log/daemon
179	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
180	    ${DESTDIR}/var/log/failedlogin
181	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
182	    ${DESTDIR}/var/log/ftpd
183	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
184	    ${DESTDIR}/var/log/lastlog
185	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
186	    ${DESTDIR}/var/log/lpd-errs
187	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
188	    ${DESTDIR}/var/log/maillog
189	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
190	    ${DESTDIR}/var/log/messages
191	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
192	    ${DESTDIR}/var/log/secure
193	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
194	    ${DESTDIR}/var/log/wtmp
195	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
196	    ${DESTDIR}/var/log/xferlog
197	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
198	cd ../usr.bin/ssh && exec ${MAKE} distribution
199	cd ../lib/libcrypto && exec ${MAKE} distribution
200	cd ../usr.bin/bgplg && exec ${MAKE} distribution
201	cd ../usr.bin/mail && exec ${MAKE} distribution
202	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
203	cd ../usr.sbin/npppd && exec ${MAKE} distribution
204	cd mail && exec ${MAKE} distribution
205	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
206	    ${DESTDIR}/var/mail/root
207	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
208	    ${DESTDIR}/etc/sudoers
209	cd rc.d; \
210		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
211		    ${DESTDIR}/etc/rc.d && \
212		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
213		    ${DESTDIR}/etc/rc.d
214	cd ${DESTDIR}/var; ln -fs ../tmp
215	touch ${DESTDIR}/usr/share/sysmerge/etcsum
216	touch ${DESTDIR}/usr/share/sysmerge/examplessum
217	cd ${DESTDIR}/ && \
218		sort ${.CURDIR}/../distrib/sets/lists/etc/{mi,md.${MACHINE}} | \
219		xargs sha256 -h ${DESTDIR}/usr/share/sysmerge/etcsum || true
220	cd ${DESTDIR}/ && \
221		grep -h '/etc/examples/' \
222		    ${.CURDIR}/../distrib/sets/lists/base/{mi,md.${MACHINE}} | \
223		sort | \
224		xargs sha256 -h ${DESTDIR}/usr/share/sysmerge/examplessum || true
225	cd ${DESTDIR}/ && \
226		sort ${.CURDIR}/../distrib/sets/lists/etc/{mi,md.${MACHINE}} | \
227	    	pax -w -d | gzip -9 > ${DESTDIR}/usr/share/sysmerge/etc.tgz
228
229distribution:
230	exec ${SUDO} ${MAKE} distribution-etc-root-var
231	cd .. && exec ${SUDO} ${MAKE} install
232
233distrib-dirs:
234	if [ ! -d ${DESTDIR}/. ]; then \
235		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
236	fi
237	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
238	if [ ! -d ${DESTDIR}/usr/src ]; then \
239		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
240	fi
241	cd ${DESTDIR}/; ln -fhs usr/src/sys sys
242
243.ifndef RELEASEDIR
244release:
245	@echo setenv RELEASEDIR before building a release.
246	@false
247.else
248
249release-sets:
250	cd ${RELEASEDIR} && rm -f SHA256
251	cd ../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
252
253sha:
254	-cd ${RELEASEDIR}; \
255	    cksum -a sha256 INSTALL.`arch -ks` \
256	    ${ALL_KERNELS} ${MDEXT} ${MISETS} | sort > SHA256
257
258release: sha
259sha: distrib
260distrib: release-sets kernels
261release-sets: distribution kernels
262
263.endif
264
265.endif	# DESTDIR check
266
267distrib:
268	cd ../distrib && \
269	    ${MAKE} && exec ${SUDO} ${MAKE} install
270
271.PHONY: distribution-etc-root-var distribution distrib-dirs \
272	release allarchs kernels release-sets m4 install-mtree \
273	bootblocks ${ALL_KERNELS}
274
275SUBDIR+= etc.alpha etc.amd64 etc.armish etc.armv7 etc.aviion
276SUBDIR+= etc.hppa etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
277SUBDIR+= etc.macppc etc.octeon
278SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
279
280.include <bsd.subdir.mk>
281.include <bsd.prog.mk>
282