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