Makefile revision 1.288
1#	$OpenBSD: Makefile,v 1.288 2010/06/05 17:29:14 martinh Exp $
2
3TZDIR=		/usr/share/zoneinfo
4LOCALTIME=	Canada/Mountain
5MTREEDIR=	/etc/mtree
6
7NOOBJ=
8
9.if exists(etc.${MACHINE}/Makefile.inc)
10.include "etc.${MACHINE}/Makefile.inc"
11.endif
12
13# -rw-r--r--
14BINOWN= root
15BINGRP= wheel
16BIN1=	changelist ccd.conf csh.cshrc csh.login csh.logout daily dhcpd.conf \
17	exports ftpusers ftpchroot gettytab group hosts hosts.lpd inetd.conf \
18	ksh.kshrc locate.rc man.conf monthly motd mrouted.conf myname \
19	netstart networks newsyslog.conf phones printcap protocols \
20	rbootd.conf rc rc.conf rc.local rc.securelevel rc.shutdown \
21	remote rpc security services shells syslog.conf weekly \
22	etc.${MACHINE}/disktab dhclient.conf mailer.conf ntpd.conf \
23	moduli pf.os sensorsd.conf ifstated.conf
24
25.if ${MACHINE} != "aviion" && ${MACHINE} != "mvme68k" && \
26    ${MACHINE} != "mvme88k"
27BIN1+=	wsconsctl.conf
28.endif
29
30# -rw-rw-r--
31BIN2=	motd
32
33MISETS=	base${OSrev}.tgz comp${OSrev}.tgz misc${OSrev}.tgz \
34	man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz
35
36PCS=	pcs750.bin
37
38# Use NOGZIP on architectures where the gzip'ing would take too much time
39# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
40# gzip them on a faster machine
41.ifndef NOGZIP
42GZIPCMD?=	gzip
43GZIPFLAGS?=	-9
44GZIPEXT?=	.gz
45.else
46GZIPCMD=	cat
47GZIPFLAGS=
48GZIPEXT=
49.endif
50
51all clean cleandir depend etc install lint:
52
53install-mtree:
54	${INSTALL} -c -o root -g wheel -m 600 ${.CURDIR}/mtree/special \
55	    ${DESTDIR}${MTREEDIR}
56	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/4.4BSD.dist \
57	    ${DESTDIR}${MTREEDIR}
58	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/BSD.local.dist \
59	    ${DESTDIR}${MTREEDIR}
60	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/BSD.x11.dist \
61	    ${DESTDIR}${MTREEDIR}
62
63.ifndef DESTDIR
64distribution-etc-root-var distribution distrib-dirs release:
65	@echo setenv DESTDIR before doing that!
66	@false
67.else
68distribution-etc-root-var: distrib-dirs
69	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
70	ksh ttys.pty | cat etc.${MACHINE}/ttys - > ${DESTDIR}/etc/ttys && \
71	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
72	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
73	    chmod 644 ${DESTDIR}/etc/ttys
74	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
75	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
76	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
77	    chmod 644 ${DESTDIR}/etc/sysctl.conf
78	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
79	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
80	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
81	    chmod 644 ${DESTDIR}/etc/fbtab
82	awk -f ${.CURDIR}/mklogin.conf `test -f etc.${MACHINE}/login.conf.overrides && echo etc.${MACHINE}/login.conf.overrides` < ${.CURDIR}/login.conf.in > \
83	    ${DESTDIR}/etc/login.conf && \
84	    chown ${BINOWN}:${BINGRP} ${DESTDIR}/etc/login.conf && \
85	    chmod 644 ${DESTDIR}/etc/login.conf
86	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
87	${INSTALL} -c -o root -g wheel -m 600 hosts.equiv ${DESTDIR}/etc
88	${INSTALL} -c -o root -g crontab -m 600 crontab ${DESTDIR}/var/cron/tabs/root
89	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
90	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
91	${INSTALL} -c -o root -g wheel -m 600 bgpd.conf ${DESTDIR}/etc
92	${INSTALL} -c -o root -g wheel -m 600 ospfd.conf ${DESTDIR}/etc
93	${INSTALL} -c -o root -g wheel -m 600 ospf6d.conf ${DESTDIR}/etc
94	${INSTALL} -c -o root -g wheel -m 600 ripd.conf ${DESTDIR}/etc
95	${INSTALL} -c -o root -g wheel -m 600 dvmrpd.conf ${DESTDIR}/etc
96	${INSTALL} -c -o root -g wheel -m 600 ldpd.conf ${DESTDIR}/etc
97	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
98	${INSTALL} -c -o root -g operator -m 644 chio.conf ${DESTDIR}/etc
99	${INSTALL} -c -o root -g wheel -m 600 hostapd.conf ${DESTDIR}/etc
100	${INSTALL} -c -o root -g wheel -m 600 relayd.conf ${DESTDIR}/etc
101	${INSTALL} -c -o root -g wheel -m 600 ipsec.conf ${DESTDIR}/etc
102	${INSTALL} -c -o root -g wheel -m 600 sasyncd.conf ${DESTDIR}/etc
103	${INSTALL} -c -o root -g wheel -m 600 snmpd.conf ${DESTDIR}/etc
104	${INSTALL} -c -o root -g wheel -m 600 ldapd.conf ${DESTDIR}/etc
105	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
106	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
107	cd root; \
108		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
109		    ${DESTDIR}/root/.cshrc; \
110		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
111		    ${DESTDIR}/root/.klogin; \
112		${INSTALL} -c -o root -g wheel -m 644 dot.login \
113		    ${DESTDIR}/root/.login; \
114		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
115		    ${DESTDIR}/root/.profile; \
116		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
117		    ${DESTDIR}/root/.Xdefaults; \
118		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
119		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
120		    ${DESTDIR}/.cshrc; \
121		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
122		    ${DESTDIR}/.profile
123	cd skel; \
124		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
125		    ${DESTDIR}/etc/skel/.cshrc; \
126		${INSTALL} -c -o root -g wheel -m 644 dot.login \
127		    ${DESTDIR}/etc/skel/.login; \
128		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
129		    ${DESTDIR}/etc/skel/.mailrc; \
130		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
131		    ${DESTDIR}/etc/skel/.profile; \
132		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
133		    ${DESTDIR}/etc/skel/.Xdefaults; \
134		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
135		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
136	cd kerberosV; \
137		${INSTALL} -c -o root -g wheel -m 644 README \
138		    ${DESTDIR}/etc/kerberosV; \
139		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
140		    ${DESTDIR}/etc/kerberosV
141	cd amd; \
142		${INSTALL} -c -o root -g wheel -m 644 master.sample \
143		    ${DESTDIR}/etc/amd
144	cd ppp; \
145		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
146		    ${DESTDIR}/etc/ppp; \
147		${INSTALL} -c -o root -g wheel -m 600 options \
148		    ${DESTDIR}/etc/ppp; \
149		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
150		    ${DESTDIR}/etc/ppp; \
151		${INSTALL} -c -o root -g wheel -m 600 options.sample \
152		    ${DESTDIR}/etc/ppp; \
153		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
154		    ${DESTDIR}/etc/ppp; \
155		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
156		    ${DESTDIR}/etc/ppp; \
157		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
158		    ${DESTDIR}/etc/ppp; \
159		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
160		    ${DESTDIR}/etc/ppp; \
161		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
162		    ${DESTDIR}/etc/ppp; \
163		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
164		    ${DESTDIR}/etc/ppp
165	cd afs; \
166		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
167		    ${DESTDIR}/etc/afs; \
168		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
169		    ${DESTDIR}/etc/afs; \
170		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
171		    ${DESTDIR}/etc/afs; \
172		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
173		    ${DESTDIR}/etc/afs; \
174		${INSTALL} -c -o root -g wheel -m 644 README \
175		    ${DESTDIR}/etc/afs
176	cd systrace; \
177		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
178		    ${DESTDIR}/etc/systrace; \
179		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
180		    ${DESTDIR}/etc/systrace
181	cd bind; \
182		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
183		    ${DESTDIR}/var/named/etc/named.conf; \
184		${INSTALL} -c -o root -g named -m 640 named-*.conf \
185		    ${DESTDIR}/var/named/etc; \
186		${INSTALL} -c -o root -g wheel -m 644 root.hint \
187		    ${DESTDIR}/var/named/etc; \
188		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
189		    ${DESTDIR}/var/named/standard/localhost; \
190		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
191		    ${DESTDIR}/var/named/standard/loopback; \
192		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
193		    ${DESTDIR}/var/named/standard/loopback6.arpa
194	/bin/rm -f ${DESTDIR}/etc/localtime
195	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
196	/bin/rm -f ${DESTDIR}/etc/rmt
197	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
198	${INSTALL} -c -o root -g wheel -m 644 minfree \
199	    ${DESTDIR}/var/crash
200	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
201	    ${DESTDIR}/etc/dumpdates
202	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
203	    ${DESTDIR}/var/cron/at.deny
204	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
205	    ${DESTDIR}/var/cron/cron.deny
206	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
207	    ${DESTDIR}/var/cron/log
208	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
209	    ${DESTDIR}/var/db/locate.database
210	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
211	    ${DESTDIR}/var/log/authlog
212	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
213	    ${DESTDIR}/var/log/daemon
214	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
215	    ${DESTDIR}/var/log/failedlogin
216	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
217	    ${DESTDIR}/var/log/ftpd
218	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
219	    ${DESTDIR}/var/log/lastlog
220	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
221	    ${DESTDIR}/var/log/lpd-errs
222	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
223	    ${DESTDIR}/var/log/maillog
224	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
225	    ${DESTDIR}/var/log/messages
226	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
227	    ${DESTDIR}/var/log/secure
228	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
229	    ${DESTDIR}/var/log/sendmail.st
230	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
231	    ${DESTDIR}/var/log/wtmp
232	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
233	    ${DESTDIR}/var/log/xferlog
234	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
235	    ${DESTDIR}/var/msgs/bounds
236	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
237	    ${DESTDIR}/var/run/utmp
238.if ${MACHINE} == "vax"
239	uudecode -p etc.vax/${PCS}.uu > ${DESTDIR}/${PCS} && \
240	    chown ${BINOWN} ${DESTDIR}/${PCS} && \
241	    chgrp ${BINGRP} ${DESTDIR}/${PCS} && \
242	    chmod 644 ${DESTDIR}/${PCS}
243.endif
244	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
245	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
246	cd ../usr.bin/ssh && exec ${MAKE} distribution
247	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
248	cd ../lib/libssl && exec ${MAKE} distribution
249	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
250	cd ../usr.bin/bgplg && exec ${MAKE} distribution
251	cd ../usr.bin/mail && exec ${MAKE} distribution
252	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
253	cd mail && exec ${MAKE} distribution
254	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
255	    ${DESTDIR}/var/mail/root
256	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
257	    ${DESTDIR}/etc/sudoers
258
259distribution:
260	exec ${SUDO} ${MAKE} distribution-etc-root-var
261	cd .. && exec ${SUDO} ${MAKE} install
262	touch ${DESTDIR}/var/db/sysmerge/etcsum
263	TMPSUM=`mktemp /tmp/_etcsum.XXXXXXXXXX` || exit 1; \
264	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${TMPSUM}; \
265	cd ${DESTDIR} && \
266		xargs cksum < $${TMPSUM} > ${DESTDIR}/var/db/sysmerge/etcsum; \
267	rm -f $${TMPSUM}
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 ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
287
288sha:
289	-cd ${RELEASEDIR}; \
290	    sum -a sha256 INSTALL.`arch -ks` ${MDEXT} ${MISETS} > SHA256
291
292release: distribution kernels release-sets distrib sha
293
294.endif
295
296.endif	# DESTDIR check
297
298distrib:
299	cd ${.CURDIR}/../distrib && \
300	    ${MAKE} && exec ${SUDO} ${MAKE} install
301
302DHSIZE=1024 1536 2048 3072 4096
303update-moduli:
304	( \
305		echo -n '#    $$Open'; echo 'BSD$$'; \
306		echo '# Time Type Tests Tries Size Generator Modulus'; \
307		( for i in ${DHSIZE}; do \
308			ssh-keygen -b $$i -G /dev/stdout; \
309		done) | \
310		ssh-keygen -T /dev/stdout \
311	) > moduli
312
313.PHONY: distribution-etc-root-var distribution distrib-dirs \
314	release allarchs kernels release-sets m4 install-mtree
315
316SUBDIR+= etc.alpha etc.amd64 etc.armish etc.aviion etc.hp300 etc.hppa
317SUBDIR+= etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k 
318SUBDIR+= etc.mac68k etc.macppc etc.mvme68k etc.mvme88k etc.palm 
319SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
320
321.include <bsd.subdir.mk>
322.include <bsd.prog.mk>
323