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