Makefile revision 1.210
1#	$OpenBSD: Makefile,v 1.210 2004/08/16 17:39:21 deraadt 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/*BOOT* ${RELEASEDIR}
262	-cp ${DESTDIR}/snapshot/cd*.iso ${RELEASEDIR}
263	-cp ${DESTDIR}/snapshot/INSTALL.* ${RELEASEDIR}
264	-cp ${DESTDIR}/snapshot/*.fs ${DESTDIR}/snapshot/*.fs.gz ${RELEASEDIR}
265	-cd ${RELEASEDIR}; \
266		md5 bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.iso *.gz *.tgz \
267		    > MD5
268	-cd ${RELEASEDIR}; \
269		cksum bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.iso *.gz *.tgz \
270		    > CKSUM
271.if defined(MACHINE_HAS_TOOLS)
272	mkdir -p ${RELEASEDIR}/tools
273	cp ${DESTDIR}/snapshot/tools/* ${RELEASEDIR}/tools
274	cd ${RELEASEDIR} && md5 tools/* >>MD5
275	cd ${RELEASEDIR} && cksum tools/* >>CKSUM
276.endif
277	-cd ${RELEASEDIR} && sort -o MD5 MD5
278	-cd ${RELEASEDIR} && sort -o CKSUM -k 3 CKSUM
279.endif
280
281snapshot: distribution snap_pre snap_tar snap_md
282	cd ${DESTDIR}/snapshot && cksum * > CKSUMS
283	cd ${DESTDIR}/snapshot && md5 * > MD5
284
285snap_pre:
286	${SUDO} /bin/rm -rf ${DESTDIR}/snapshot
287	${SUDO} ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/snapshot
288
289snap_tar:
290	cd ${DESTDIR} && tar cf - bin \
291	    | ${GZIP} ${GZIPFLAGS} > snapshot/bin.tar${GZIPEXT}
292	cd ${DESTDIR} && tar cf - dev \
293	    | ${GZIP} ${GZIPFLAGS} > snapshot/dev.tar${GZIPEXT}
294	cd ${DESTDIR} && tar cf - .profile .cshrc altroot etc home mnt \
295	    root stand sys tmp | ${GZIP} ${GZIPFLAGS} \
296	    > snapshot/etc.tar${GZIPEXT}
297	cd ${DESTDIR} && tar cf - sbin \
298	    | ${GZIP} ${GZIPFLAGS} > snapshot/sbin.tar${GZIPEXT}
299	cd ${DESTDIR} && tar cf - usr/bin \
300	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.bin.tar${GZIPEXT}
301	cd ${DESTDIR} && tar cf - usr/games \
302	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.games.tar${GZIPEXT}
303	cd ${DESTDIR} && tar cf - usr/include \
304	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.include.tar${GZIPEXT}
305	cd ${DESTDIR} && tar cf - usr/lib \
306	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.lib.tar${GZIPEXT}
307	cd ${DESTDIR} && tar cf - usr/libexec \
308	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.libexec.tar${GZIPEXT}
309	cd ${DESTDIR} && tar cf - usr/mdec usr/libdata usr/lkm usr/local \
310	    usr/src usr/obj | ${GZIP} ${GZIPFLAGS} \
311	    > snapshot/usr.misc.tar${GZIPEXT}
312	cd ${DESTDIR} && tar cf - usr/sbin \
313	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.sbin.tar${GZIPEXT}
314	cd ${DESTDIR} && tar cf - usr/share \
315	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.share.tar${GZIPEXT}
316	cd ${DESTDIR} && tar cf - var \
317	    | ${GZIP} ${GZIPFLAGS} > snapshot/var.tar${GZIPEXT}
318	cd ../distrib/notes; ${MAKE}; ${MAKE} install
319
320snap_md:
321# nothing here -- look in the machine-dependent Makefile.inc
322
323.endif	# DESTDIR check
324
325MAKEDEVARCHS+= alpha
326MAKEDEVARCHS+= amd64
327MAKEDEVARCHS+= cats
328MAKEDEVARCHS+= hp300
329MAKEDEVARCHS+= hppa
330MAKEDEVARCHS+= i386
331MAKEDEVARCHS+= luna88k
332MAKEDEVARCHS+= mac68k
333MAKEDEVARCHS+= macppc
334MAKEDEVARCHS+= mvme68k
335MAKEDEVARCHS+= mvme88k
336#MAKEDEVARCHS+= mvmeppc
337MAKEDEVARCHS+= sgi
338MAKEDEVARCHS+= sparc
339MAKEDEVARCHS+= sparc64
340MAKEDEVARCHS+= vax
341
342clean:
343	rm -f etc.${MACHINE}/MAKEDEV
344
345cleandir:
346	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
347	    ${MAKE} MACHINE=$$m clean; done
348
349MAKEDEVSRC=	MAKEDEV.mi MAKEDEV.sub MAKEDEV.common
350MAKEDEVDOC=	MAKEDEV.man MAKEDEV.mansub MAKEDEV.common
351m4: etc.${M}/MAKEDEV
352man: ${.CURDIR}/../share/man/man8/man.${M}/MAKEDEV.8
353
354etc.${M}/MAKEDEV: ${MAKEDEVSRC} etc.${M}/MAKEDEV.md
355	@echo "==> etc.${M}/MAKEDEV"
356	m4 -DMACHINE=${M} MAKEDEV.mi > etc.${M}/.MAKEDEV.tmp && \
357	    mv etc.${M}/.MAKEDEV.tmp etc.${M}/MAKEDEV || \
358	    rm etc.${M}/.MAKEDEV.tmp
359
360${.CURDIR}/../share/man/man8/man.${M}/MAKEDEV.8: ${MAKEDEVDOC} etc.${M}/MAKEDEV.md
361	m4 -DMACHINE=${M} MAKEDEV.man > \
362	    ${.CURDIR}/../share/man/man8/man8.${M}/MAKEDEV.8
363
364allarchs: ${MAKEDEVSRC} ${MAKEDEVDOC}
365	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
366	    ${MAKE} M=$$m m4 man; done
367
368distrib:
369	cd ${.CURDIR}/../distrib && \
370	    ${MAKE} cleandir && ${MAKE} && exec ${SUDO} ${MAKE} install
371
372DHSIZE=1024 1536 2048 3072 4096
373update-moduli:
374	( \
375		echo '#    $$OpenBSD: Makefile,v 1.210 2004/08/16 17:39:21 deraadt Exp $$'; \
376		echo '# Time Type Tests Tries Size Generator Modulus'; \
377		( for i in ${DHSIZE}; do \
378			ssh-keygen -b $$i -G /dev/stdout; \
379		done) | \
380		ssh-keygen -T /dev/stdout \
381	) > moduli
382
383.PHONY: distribution-etc-root-var distribution distrib-dirs \
384	release snapshot allarchs snap_pre snap_tar snap_md m4
385.include <bsd.prog.mk>
386