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