Makefile revision 1.326
1#	$OpenBSD: Makefile,v 1.326 2012/11/04 17:12:36 kettenis 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 dhcpd.conf \
34	exports ftpusers ftpchroot gettytab group hosts hosts.lpd inetd.conf \
35	ksh.kshrc locate.rc man.conf monthly motd mrouted.conf myname \
36	netstart networks newsyslog.conf printcap protocols \
37	rbootd.conf rc rc.conf rc.local rc.securelevel rc.shutdown \
38	remote rpc services shells syslog.conf weekly \
39	etc.${MACHINE}/disktab dhclient.conf mailer.conf ntpd.conf \
40	moduli pf.os sensorsd.conf ifstated.conf mixerctl.conf
41
42.if ${MACHINE} != "aviion" && ${MACHINE} != "mvme68k" && \
43    ${MACHINE} != "mvme88k"
44BIN1+=	wsconsctl.conf
45.endif
46
47# -rw-rw-r--
48BIN2=	motd
49
50# -r-xr-xr-x
51RCDAEMONS=	amd apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd \
52		ftpd ftpproxy hostapd hotplugd httpd identd ifstated iked \
53		inetd isakmpd ldapd npppd ldattach ldpd lpd mopd mrouted \
54		named nginx nsd ntpd ospfd ospf6d portmap pflogd rarpd rbootd \
55		relayd ripd route6d rtadvd rtsold rwhod sasyncd sendmail \
56		sensorsd smtpd snmpd spamd sshd syslogd watchdogd wsmoused \
57		xdm ypbind ypldap yppasswdd ypserv kdc kadmind kpasswdd nfsd \
58		mountd lockd statd spamlogd sndiod popa3d tftpd tftpproxy \
59		ldomd
60
61MISETS=	base${OSrev}.tgz comp${OSrev}.tgz \
62	man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz
63
64# Use NOGZIP on architectures where the gzip'ing would take too much time
65# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
66# gzip them on a faster machine
67.ifndef NOGZIP
68GZIPCMD?=	gzip
69GZIPFLAGS?=	-9
70GZIPEXT?=	.gz
71.else
72GZIPCMD=	cat
73GZIPFLAGS=
74GZIPEXT=
75.endif
76
77all clean cleandir depend etc install lint:
78
79install-mtree:
80	${INSTALL} -c -o root -g wheel -m 600 mtree/special \
81	    ${DESTDIR}${MTREEDIR}
82	${INSTALL} -c -o root -g wheel -m 444 mtree/4.4BSD.dist \
83	    ${DESTDIR}${MTREEDIR}
84	${INSTALL} -c -o root -g wheel -m 444 mtree/BSD.local.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 ${BIN1} ${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 sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
101	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
102	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
103	    chmod 644 ${DESTDIR}/etc/sysctl.conf
104	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
105	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
106	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
107	    chmod 644 ${DESTDIR}/etc/fbtab
108	awk -f mklogin.conf `test -f etc.${MACHINE}/login.conf.overrides && echo etc.${MACHINE}/login.conf.overrides` < login.conf.in > \
109	    ${DESTDIR}/etc/login.conf && \
110	    chown ${BINOWN}:${BINGRP} ${DESTDIR}/etc/login.conf && \
111	    chmod 644 ${DESTDIR}/etc/login.conf
112	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
113	${INSTALL} -c -o root -g wheel -m 600 hosts.equiv ${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 bgpd.conf ${DESTDIR}/etc
118	${INSTALL} -c -o root -g wheel -m 600 ospfd.conf ${DESTDIR}/etc
119	${INSTALL} -c -o root -g wheel -m 600 ospf6d.conf ${DESTDIR}/etc
120	${INSTALL} -c -o root -g wheel -m 600 ripd.conf ${DESTDIR}/etc
121	${INSTALL} -c -o root -g wheel -m 600 dvmrpd.conf ${DESTDIR}/etc
122	${INSTALL} -c -o root -g wheel -m 600 ldpd.conf ${DESTDIR}/etc
123	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
124	${INSTALL} -c -o root -g operator -m 644 chio.conf ${DESTDIR}/etc
125	${INSTALL} -c -o root -g wheel -m 600 hostapd.conf ${DESTDIR}/etc
126	${INSTALL} -c -o root -g wheel -m 600 relayd.conf ${DESTDIR}/etc
127	${INSTALL} -c -o root -g wheel -m 600 iked.conf ${DESTDIR}/etc
128	${INSTALL} -c -o root -g wheel -m 600 ipsec.conf ${DESTDIR}/etc
129	${INSTALL} -c -o root -g wheel -m 600 sasyncd.conf ${DESTDIR}/etc
130	${INSTALL} -c -o root -g wheel -m 600 snmpd.conf ${DESTDIR}/etc
131	${INSTALL} -c -o root -g wheel -m 600 ldapd.conf ${DESTDIR}/etc
132	${INSTALL} -c -o root -g wheel -m 600 ypldap.conf ${DESTDIR}/etc
133	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/etc
134	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
135	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
136	cd root; \
137		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
138		    ${DESTDIR}/root/.cshrc; \
139		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
140		    ${DESTDIR}/root/.klogin; \
141		${INSTALL} -c -o root -g wheel -m 644 dot.login \
142		    ${DESTDIR}/root/.login; \
143		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
144		    ${DESTDIR}/root/.profile; \
145		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
146		    ${DESTDIR}/root/.Xdefaults; \
147		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
148		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
149		    ${DESTDIR}/.cshrc; \
150		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
151		    ${DESTDIR}/.profile
152	cd skel; \
153		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
154		    ${DESTDIR}/etc/skel/.cshrc; \
155		${INSTALL} -c -o root -g wheel -m 644 dot.login \
156		    ${DESTDIR}/etc/skel/.login; \
157		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
158		    ${DESTDIR}/etc/skel/.mailrc; \
159		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
160		    ${DESTDIR}/etc/skel/.profile; \
161		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
162		    ${DESTDIR}/etc/skel/.Xdefaults; \
163		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
164		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
165	cd kerberosV; \
166		${INSTALL} -c -o root -g wheel -m 644 README \
167		    ${DESTDIR}/etc/kerberosV; \
168		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
169		    ${DESTDIR}/etc/kerberosV
170	cd amd; \
171		${INSTALL} -c -o root -g wheel -m 644 master.sample \
172		    ${DESTDIR}/etc/amd
173	cd ppp; \
174		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
175		    ${DESTDIR}/etc/ppp; \
176		${INSTALL} -c -o root -g wheel -m 600 options \
177		    ${DESTDIR}/etc/ppp; \
178		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
179		    ${DESTDIR}/etc/ppp; \
180		${INSTALL} -c -o root -g wheel -m 600 options.sample \
181		    ${DESTDIR}/etc/ppp; \
182		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
183		    ${DESTDIR}/etc/ppp; \
184		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
185		    ${DESTDIR}/etc/ppp; \
186		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
187		    ${DESTDIR}/etc/ppp; \
188		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
189		    ${DESTDIR}/etc/ppp; \
190		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
191		    ${DESTDIR}/etc/ppp; \
192		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
193		    ${DESTDIR}/etc/ppp
194	cd systrace; \
195		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
196		    ${DESTDIR}/etc/systrace; \
197		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
198		    ${DESTDIR}/etc/systrace
199	cd bind; \
200		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
201		    ${DESTDIR}/var/named/etc/named.conf; \
202		${INSTALL} -c -o root -g named -m 640 named-*.conf \
203		    ${DESTDIR}/var/named/etc; \
204		${INSTALL} -c -o root -g wheel -m 644 root.hint \
205		    ${DESTDIR}/var/named/etc; \
206		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
207		    ${DESTDIR}/var/named/standard/localhost; \
208		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
209		    ${DESTDIR}/var/named/standard/loopback; \
210		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
211		    ${DESTDIR}/var/named/standard/loopback6.arpa
212	/bin/rm -f ${DESTDIR}/etc/localtime
213	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
214	/bin/rm -f ${DESTDIR}/etc/rmt
215	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
216	${INSTALL} -c -o root -g wheel -m 644 minfree \
217	    ${DESTDIR}/var/crash
218	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
219	    ${DESTDIR}/etc/dumpdates
220	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
221	    ${DESTDIR}/var/cron/at.deny
222	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
223	    ${DESTDIR}/var/cron/cron.deny
224	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
225	    ${DESTDIR}/var/cron/log
226	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
227	    ${DESTDIR}/var/db/locate.database
228	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
229	    ${DESTDIR}/var/log/authlog
230	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
231	    ${DESTDIR}/var/log/daemon
232	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
233	    ${DESTDIR}/var/log/failedlogin
234	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
235	    ${DESTDIR}/var/log/ftpd
236	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
237	    ${DESTDIR}/var/log/lastlog
238	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
239	    ${DESTDIR}/var/log/lpd-errs
240	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
241	    ${DESTDIR}/var/log/maillog
242	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
243	    ${DESTDIR}/var/log/messages
244	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
245	    ${DESTDIR}/var/log/secure
246	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
247	    ${DESTDIR}/var/log/sendmail.st
248	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
249	    ${DESTDIR}/var/log/wtmp
250	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
251	    ${DESTDIR}/var/log/xferlog
252	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
253	    ${DESTDIR}/var/run/utmp
254	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
255	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
256	cd ../usr.bin/ssh && exec ${MAKE} distribution
257	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
258	cd ../lib/libssl && exec ${MAKE} distribution
259	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
260	cd ../usr.bin/bgplg && exec ${MAKE} distribution
261	cd ../usr.bin/mail && exec ${MAKE} distribution
262	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
263	cd ../usr.sbin/nginx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
264	cd ../usr.sbin/npppd && exec ${MAKE} distribution
265	cd mail && exec ${MAKE} distribution
266	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
267	    ${DESTDIR}/var/mail/root
268	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
269	    ${DESTDIR}/etc/sudoers
270	cd rc.d; \
271		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
272		    ${DESTDIR}/etc/rc.d && \
273		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
274		    ${DESTDIR}/etc/rc.d
275
276distribution:
277	exec ${SUDO} ${MAKE} distribution-etc-root-var
278	cd .. && exec ${SUDO} ${MAKE} install
279	touch ${DESTDIR}/var/db/sysmerge/etcsum
280	TMPSUM=`mktemp /tmp/_etcsum.XXXXXXXXXX` || exit 1; \
281	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${TMPSUM}; \
282	cd ${DESTDIR} && \
283		xargs cksum < $${TMPSUM} > ${DESTDIR}/var/db/sysmerge/etcsum; \
284	rm -f $${TMPSUM}
285
286distrib-dirs:
287	if [ ! -d ${DESTDIR}/. ]; then \
288		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
289	fi
290	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
291	if [ ! -d ${DESTDIR}/usr/src ]; then \
292		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
293	fi
294	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
295
296.ifndef RELEASEDIR
297release:
298	@echo setenv RELEASEDIR before building a release.
299	@false
300.else
301
302release-sets:
303	cd ../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
304
305sha:
306	-cd ${RELEASEDIR}; \
307	    sum -a sha256 INSTALL.`arch -ks` ${ALL_KERNELS} ${MDEXT} ${MISETS} > SHA256
308
309release: sha
310sha: distrib
311distrib: release-sets kernels
312release-sets: distribution
313
314.endif
315
316.endif	# DESTDIR check
317
318distrib:
319	cd ../distrib && \
320	    ${MAKE} && exec ${SUDO} ${MAKE} install
321
322# Becasue the moduli sizes > 4096 are not commonly used, and because they
323# take a long time to generate we update the <= 4096 ones more frequently.
324DHSIZE=1024 1536 2048 3072 4096
325update-moduli: moduli.6144 moduli.8192
326	( \
327		echo -n '#    $$Open'; echo 'BSD$$'; \
328		echo '# Time Type Tests Tries Size Generator Modulus'; \
329		( for i in ${DHSIZE}; do \
330			ssh-keygen -b $$i -G /dev/stdout; \
331		done) | \
332		ssh-keygen -T /dev/stdout ; \
333		cat moduli.6144 ; \
334		cat moduli.8192 ; \
335	) > moduli
336
337# These two will probably take days, so if you're going to regen them
338# run it in a tmux session or something.
339moduli.6144:
340	ssh-keygen -b 6144 -G /dev/stdout | ssh-keygen -T moduli.6144
341
342moduli.8192:
343	ssh-keygen -b 8192 -G /dev/stdout | ssh-keygen -T moduli.8192
344
345.PHONY: distribution-etc-root-var distribution distrib-dirs \
346	release allarchs kernels release-sets m4 install-mtree \
347	bootblocks ${ALL_KERNELS}
348	
349
350SUBDIR+= etc.alpha etc.amd64 etc.armish etc.aviion etc.beagle etc.hp300
351SUBDIR+= etc.hppa etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k 
352SUBDIR+= etc.macppc etc.mvme68k etc.mvme88k etc.palm
353SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
354
355.include <bsd.subdir.mk>
356.include <bsd.prog.mk>
357