Makefile revision 1.184
1#	$OpenBSD: Makefile,v 1.184 2003/08/21 19:10:19 frantzen 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=	bootptab changelist ccd.conf csh.cshrc csh.login csh.logout \
16	daily dhcpd.conf dhcpd.interfaces exports ftpusers \
17	ftpchroot gettytab group hosts hosts.lpd inetd.conf \
18	ksh.kshrc locate.rc man.conf monthly motd mrouted.conf \
19	myname netstart networks newsyslog.conf \
20	phones printcap protocols rbootd.conf rc rc.conf rc.local \
21	rc.securelevel rc.shutdown remote rpc security services \
22	shells spamd.conf syslog.conf weekly etc.${MACHINE}/disktab \
23	dhclient.conf mailer.conf
24
25.if (${MACHINE} == "alpha" || ${MACHINE} == "hppa" || \
26     ${MACHINE} == "i386" || ${MACHINE} == "macppc" || \
27     ${MACHINE} == "sparc" || ${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	cat etc.${MACHINE}/ttys ttys.pty > ${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 pf.conf ${DESTDIR}/etc
81	${INSTALL} -c -o root -g wheel -m 644 pf.os ${DESTDIR}/etc
82	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
83	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
84	cd root; \
85		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
86		    ${DESTDIR}/root/.cshrc; \
87		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
88		    ${DESTDIR}/root/.klogin; \
89		${INSTALL} -c -o root -g wheel -m 644 dot.login \
90		    ${DESTDIR}/root/.login; \
91		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
92		    ${DESTDIR}/root/.profile; \
93		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
94		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
95		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
96	cd skel; \
97		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
98		    ${DESTDIR}/etc/skel/.cshrc; \
99		${INSTALL} -c -o root -g wheel -m 644 dot.login \
100		    ${DESTDIR}/etc/skel/.login; \
101		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
102		    ${DESTDIR}/etc/skel/.mailrc; \
103		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
104		    ${DESTDIR}/etc/skel/.profile; \
105		${INSTALL} -c -o root -g wheel -m 600 dot.rhosts \
106		    ${DESTDIR}/etc/skel/.rhosts
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 db.loopback6.int \
173		    ${DESTDIR}/var/named/standard/loopback6.int; \
174		${INSTALL} -c -o root -g wheel -m 644 root.hint \
175		    ${DESTDIR}/var/named/standard; \
176	/bin/rm -f ${DESTDIR}/etc/localtime
177	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
178	/bin/rm -f ${DESTDIR}/etc/rmt
179	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
180	${INSTALL} -c -o root -g wheel -m 644 minfree \
181		${DESTDIR}/var/crash
182	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
183		${DESTDIR}/etc/dumpdates
184	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
185		${DESTDIR}/var/cron/at.deny
186	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
187		${DESTDIR}/var/cron/cron.deny
188	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
189		${DESTDIR}/var/cron/log
190	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
191		${DESTDIR}/var/db/locate.database
192	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
193		${DESTDIR}/var/log/authlog
194	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
195		${DESTDIR}/var/log/daemon
196	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
197		${DESTDIR}/var/log/failedlogin
198	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
199		${DESTDIR}/var/log/ftpd
200	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
201		${DESTDIR}/var/log/lastlog
202	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
203		${DESTDIR}/var/log/lpd-errs
204	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
205		${DESTDIR}/var/log/maillog
206	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
207		${DESTDIR}/var/log/messages
208	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
209		${DESTDIR}/var/log/secure
210	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
211		${DESTDIR}/var/log/sendmail.st
212	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
213		${DESTDIR}/var/log/wtmp
214	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
215		${DESTDIR}/var/log/xferlog
216	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
217		${DESTDIR}/var/msgs/bounds
218	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
219		${DESTDIR}/var/run/utmp
220.if ${MACHINE} == "vax"
221	uudecode -p etc.vax/${PCS}.uu > ${DESTDIR}/${PCS} && \
222	    chown ${BINOWN} ${DESTDIR}/${PCS} && \
223	    chgrp ${BINGRP} ${DESTDIR}/${PCS} && \
224	    chmod 644 ${DESTDIR}/${PCS}
225.endif
226	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
227	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
228	cd ../usr.bin/ssh && exec ${MAKE} distribution
229	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
230	cd ../lib/libssl && exec ${MAKE} distribution
231	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
232	cd ../usr.bin/mail && exec ${MAKE} distribution
233	${INSTALL} -c -o root -g ${BINGRP} -m 644 aliases \
234	    ${DESTDIR}/etc/mail/aliases
235	/usr/libexec/sendmail/sendmail -C${DESTDIR}/etc/mail/sendmail.cf \
236	    -bi -O AliasFile=${DESTDIR}/etc/mail/aliases \
237	    -O DontBlameSendmail=mapinunsafedirpath
238	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
239		${DESTDIR}/var/mail/root
240	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
241		${DESTDIR}/etc/sudoers
242
243distribution:
244	exec ${SUDO} ${MAKE} distribution-etc-root-var
245	cd .. && exec ${SUDO} ${MAKE} install
246
247distrib-dirs:
248	if [ ! -d ${DESTDIR}/. ]; then \
249		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
250	fi
251	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
252	if [ ! -d ${DESTDIR}/usr/src ]; then \
253		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
254	fi
255	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
256
257.ifndef RELEASEDIR
258release:
259	@echo setenv RELEASEDIR before building a release.
260	@false
261.else
262release: distribution snap_pre snap_md
263	cd ${.CURDIR}/../distrib/notes && ${MAKE} && exec ${SUDO} ${MAKE} install
264	cd ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
265	-cp ${DESTDIR}/snapshot/bsd* ${RELEASEDIR}
266	-cp ${DESTDIR}/snapshot/*boot* ${RELEASEDIR}
267	-cp ${DESTDIR}/snapshot/*BOOT* ${RELEASEDIR}
268	-cp ${DESTDIR}/snapshot/cd*.iso ${RELEASEDIR}
269	-cp ${DESTDIR}/snapshot/INSTALL.* ${RELEASEDIR}
270	-cp ${DESTDIR}/snapshot/*.fs ${DESTDIR}/snapshot/*.fs.gz ${RELEASEDIR}
271	-cd ${RELEASEDIR}; \
272		md5 bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.iso *.gz *.tgz \
273		    > MD5
274	-cd ${RELEASEDIR}; \
275		cksum bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.iso *.gz *.tgz \
276		    > CKSUM
277.if defined(MACHINE_HAS_TOOLS)
278	mkdir -p ${RELEASEDIR}/tools
279	cp ${DESTDIR}/snapshot/tools/* ${RELEASEDIR}/tools
280	cd ${RELEASEDIR} && md5 tools/* >>MD5
281	cd ${RELEASEDIR} && cksum tools/* >>CKSUM
282.endif
283	-cd ${RELEASEDIR} && sort -o MD5 MD5
284	-cd ${RELEASEDIR} && sort -o CKSUM -k 3 CKSUM
285.endif
286
287snapshot: distribution snap_pre snap_tar snap_md
288	cd ${DESTDIR}/snapshot && cksum * > CKSUMS
289	cd ${DESTDIR}/snapshot && md5 * > MD5
290
291snap_pre:
292	${SUDO} /bin/rm -rf ${DESTDIR}/snapshot
293	${SUDO} ${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/snapshot
294
295snap_tar:
296	cd ${DESTDIR} && tar cf - bin \
297	    | ${GZIP} ${GZIPFLAGS} > snapshot/bin.tar${GZIPEXT}
298	cd ${DESTDIR} && tar cf - dev \
299	    | ${GZIP} ${GZIPFLAGS} > snapshot/dev.tar${GZIPEXT}
300	cd ${DESTDIR} && tar cf - .profile .cshrc altroot etc home mnt \
301	    root stand sys tmp | ${GZIP} ${GZIPFLAGS} \
302	    > snapshot/etc.tar${GZIPEXT}
303	cd ${DESTDIR} && tar cf - sbin \
304	    | ${GZIP} ${GZIPFLAGS} > snapshot/sbin.tar${GZIPEXT}
305	cd ${DESTDIR} && tar cf - usr/bin \
306	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.bin.tar${GZIPEXT}
307	cd ${DESTDIR} && tar cf - usr/games \
308	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.games.tar${GZIPEXT}
309	cd ${DESTDIR} && tar cf - usr/include \
310	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.include.tar${GZIPEXT}
311	cd ${DESTDIR} && tar cf - usr/lib \
312	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.lib.tar${GZIPEXT}
313	cd ${DESTDIR} && tar cf - usr/libexec \
314	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.libexec.tar${GZIPEXT}
315	cd ${DESTDIR} && tar cf - usr/mdec usr/libdata usr/lkm usr/local \
316	    usr/src usr/obj | ${GZIP} ${GZIPFLAGS} \
317	    > snapshot/usr.misc.tar${GZIPEXT}
318	cd ${DESTDIR} && tar cf - usr/sbin \
319	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.sbin.tar${GZIPEXT}
320	cd ${DESTDIR} && tar cf - usr/share \
321	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.share.tar${GZIPEXT}
322	cd ${DESTDIR} && tar cf - var \
323	    | ${GZIP} ${GZIPFLAGS} > snapshot/var.tar${GZIPEXT}
324	cd ../distrib/notes; ${MAKE}; ${MAKE} install
325
326snap_md:
327# nothing here -- look in the machine-dependent Makefile.inc
328
329.endif	# DESTDIR check
330
331MAKEDEVARCHS+= alpha
332MAKEDEVARCHS+= hp300
333MAKEDEVARCHS+= hppa
334MAKEDEVARCHS+= i386
335MAKEDEVARCHS+= mac68k
336MAKEDEVARCHS+= macppc
337MAKEDEVARCHS+= mvme68k
338MAKEDEVARCHS+= mvme88k
339#MAKEDEVARCHS+= mvmeppc
340MAKEDEVARCHS+= sparc
341MAKEDEVARCHS+= sparc64
342#MAKEDEVARCHS+= vax
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
351m4: etc.${M}/MAKEDEV
352
353etc.${M}/MAKEDEV: MAKEDEV.sub MAKEDEV.mi etc.${M}/MAKEDEV.md
354	echo "==> etc.${M}/MAKEDEV"
355	m4 -DMACHINE=${M} MAKEDEV.mi > etc.${M}/.MAKEDEV.tmp && \
356	    mv etc.${M}/.MAKEDEV.tmp etc.${M}/MAKEDEV || \
357	    rm etc.${M}/.MAKEDEV.tmp
358
359allarchs: MAKEDEV.sub MAKEDEV.mi
360	cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
361	    ${MAKE} M=$$m m4; done
362
363distrib:
364	cd ${.CURDIR}/../distrib && \
365	    ${MAKE} cleandir && ${MAKE} && exec ${SUDO} ${MAKE} install
366
367.PHONY: distribution-etc-root-var distribution distrib-dirs \
368	release snapshot allarchs snap_pre snap_tar snap_md m4
369.include <bsd.prog.mk>
370