Makefile revision 1.148
1#	$OpenBSD: Makefile,v 1.148 2002/02/14 13:24:45 todd Exp $
2
3TZDIR=		/usr/share/zoneinfo
4LOCALTIME=	US/Pacific
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 dm.conf 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 pf.conf nat.conf \
20	phones printcap protocols rbootd.conf rc rc.conf rc.local \
21	rc.securelevel rc.shutdown remote rpc security services \
22	shells syslog.conf weekly etc.${MACHINE}/disktab dhclient.conf \
23	mailer.conf
24
25.if (${MACHINE} == "alpha" || ${MACHINE} == "hppa" || \
26     ${MACHINE} == "i386" || ${MACHINE} == "macppc")
27BIN1+=	wsconsctl.conf
28.endif
29
30# -rw-rw-r--
31BIN2=	motd
32
33NAMEDB=	localhost.rev localhost.v6.rev localhost.zone root.cache
34PCS=	pcs750.bin
35WCS1=	wcs fppwcs poc poc1 poc2 fppoc
36WCS2=	fpevent fppwcs fppwcs_dual hdcwcs load_diags start_fpp wcs wcs_dual
37
38# Use NOGZIP on architectures where the gzip'ing would take too much time
39# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
40# gzip them on a faster machine
41.ifndef NOGZIP
42GZIP?=		gzip
43GZIPFLAGS?=	-9
44GZIPEXT?=	.gz
45.else
46GZIP=		cat
47GZIPFLAGS=
48GZIPEXT=
49.endif
50
51all clean cleandir depend etc install lint:
52
53.ifndef DESTDIR
54distribution-etc-root-var distribution distrib-dirs release snapshot:
55	@echo setenv DESTDIR before doing that!
56	@false
57.else
58distribution-etc-root-var: distrib-dirs
59	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
60	cat etc.${MACHINE}/ttys ttys.pty > ${DESTDIR}/etc/ttys && \
61	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
62	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
63	    chmod 644 ${DESTDIR}/etc/ttys
64	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
65	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
66	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
67	    chmod 644 ${DESTDIR}/etc/sysctl.conf
68	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
69	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
70	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
71	    chmod 644 ${DESTDIR}/etc/fbtab
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 644 login.conf ${DESTDIR}/etc
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 644 moduli ${DESTDIR}/etc
79	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
80	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
81	(cd root; \
82		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
83		    ${DESTDIR}/root/.cshrc; \
84		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
85		    ${DESTDIR}/root/.klogin; \
86		${INSTALL} -c -o root -g wheel -m 644 dot.login \
87		    ${DESTDIR}/root/.login; \
88		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
89		    ${DESTDIR}/root/.profile; \
90		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
91		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
92		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
93	(cd skel; \
94		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
95		    ${DESTDIR}/etc/skel/.cshrc; \
96		${INSTALL} -c -o root -g wheel -m 644 dot.login \
97		    ${DESTDIR}/etc/skel/.login; \
98		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
99		    ${DESTDIR}/etc/skel/.mailrc; \
100		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
101		    ${DESTDIR}/etc/skel/.profile; \
102		${INSTALL} -c -o root -g wheel -m 600 dot.rhosts \
103		    ${DESTDIR}/etc/skel/.rhosts)
104	(cd kerberosIV; \
105		${INSTALL} -c -o root -g wheel -m 644 README \
106		    ${DESTDIR}/etc/kerberosIV; \
107		${INSTALL} -c -o root -g wheel -m 644 krb.conf \
108		    ${DESTDIR}/etc/kerberosIV; \
109		${INSTALL} -c -o root -g wheel -m 644 krb.realms \
110		    ${DESTDIR}/etc/kerberosIV; \
111		${INSTALL} -c -o root -g wheel -m 644 krb.extra \
112		    ${DESTDIR}/etc/kerberosIV; \
113		${INSTALL} -c -o root -g wheel -m 644 krb.equiv \
114		    ${DESTDIR}/etc/kerberosIV)
115	(cd kerberosV; \
116		${INSTALL} -c -o root -g wheel -m 644 README \
117		    ${DESTDIR}/etc/kerberosV; \
118		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
119		    ${DESTDIR}/etc/kerberosV)
120	(cd amd; \
121		${INSTALL} -c -o root -g wheel -m 644 master.sample \
122		    ${DESTDIR}/etc/amd)
123	(cd mtree; \
124		${INSTALL} -c -o root -g wheel -m 600 special \
125		    ${DESTDIR}/etc/mtree; \
126		${INSTALL} -c -o root -g wheel -m 444 4.4BSD.dist \
127		    ${DESTDIR}/etc/mtree; \
128		${INSTALL} -c -o root -g wheel -m 444 BSD.local.dist \
129		    ${DESTDIR}/etc/mtree; \
130		${INSTALL} -c -o root -g wheel -m 444 BSD.x11.dist \
131		    ${DESTDIR}/etc/mtree)
132	(cd photuris; \
133		${INSTALL} -c -o root -g wheel -m 600 secrets.conf \
134		    ${DESTDIR}/etc/photuris; \
135		${INSTALL} -c -o root -g wheel -m 600 attributes.conf \
136		    ${DESTDIR}/etc/photuris; \
137		${INSTALL} -c -o root -g wheel -m 600 photuris.conf \
138		    ${DESTDIR}/etc/photuris; \
139		${INSTALL} -c -o root -g wheel -m 600 photuris.startup \
140		    ${DESTDIR}/etc/photuris)
141	(cd ppp; \
142		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
143		    ${DESTDIR}/etc/ppp; \
144		${INSTALL} -c -o root -g wheel -m 600 options \
145		    ${DESTDIR}/etc/ppp; \
146		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
147		    ${DESTDIR}/etc/ppp; \
148		${INSTALL} -c -o root -g wheel -m 600 options.sample \
149		    ${DESTDIR}/etc/ppp; \
150		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
151		    ${DESTDIR}/etc/ppp; \
152		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
153		    ${DESTDIR}/etc/ppp; \
154		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
155		    ${DESTDIR}/etc/ppp; \
156		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
157		    ${DESTDIR}/etc/ppp; \
158		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
159		    ${DESTDIR}/etc/ppp; \
160		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
161		    ${DESTDIR}/etc/ppp)
162	(cd afs; \
163		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
164		    ${DESTDIR}/etc/afs; \
165		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
166		    ${DESTDIR}/etc/afs; \
167		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
168		    ${DESTDIR}/etc/afs; \
169		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
170		    ${DESTDIR}/etc/afs; \
171		${INSTALL} -c -o root -g wheel -m 644 README \
172		    ${DESTDIR}/etc/afs)
173	(cd namedb; \
174	    ${INSTALL} -c -o root -g ${BINGRP} -m 644 named.boot \
175		${DESTDIR}/var/named; \
176	    ${INSTALL} -c -o named -g ${BINGRP} -m 644 ${NAMEDB} \
177		${DESTDIR}/var/named/namedb)
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 ${BINOWN} -g wheel -m 600 /dev/null \
187		${DESTDIR}/etc/skeykeys
188	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
189		${DESTDIR}/var/at/at.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 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 640 /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 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	(cd etc.vax; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${PCS} \
220	    ${DESTDIR}/)
221.endif
222	(cd ../gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
223	(cd ../usr.sbin/ypserv/ypinit; ${MAKE} distribution)
224	(cd ../usr.bin/ssh; ${MAKE} distribution)
225	(cd ../usr.sbin/httpd; ${MAKE} -f Makefile.bsd-wrapper distribution)
226	(cd ../lib/libssl; ${MAKE} -f Makefile.bsd-wrapper distribution)
227	(cd ../gnu/usr.bin/lynx; ${MAKE} -f Makefile.bsd-wrapper distribution)
228	(cd ../usr.bin/mail; ${MAKE} distribution)
229	${INSTALL} -c -o root -g ${BINGRP} -m 644 aliases \
230	    ${DESTDIR}/etc/mail/aliases
231	/usr/libexec/sendmail/sendmail -C${DESTDIR}/etc/mail/sendmail.cf \
232	    -bi -O AliasFile=${DESTDIR}/etc/mail/aliases \
233	    -O DontBlameSendmail=mapinunsafedirpath
234	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
235		${DESTDIR}/var/mail/root
236	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
237		${DESTDIR}/etc/sudoers
238
239distribution: distribution-etc-root-var
240	(cd ..; ${MAKE} install)
241
242distrib-dirs:
243	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
244	-mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -u
245	if [ ! -d ${DESTDIR}/usr/src ]; then \
246		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
247	fi
248	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
249
250.ifndef RELEASEDIR
251release:
252	@echo setenv RELEASEDIR before building a release.
253	@false
254.else
255release: distribution snap_pre snap_md
256	cd ${.CURDIR}/../distrib/notes; ${MAKE}; ${MAKE} install
257	cd ${.CURDIR}/../distrib/sets; sh maketars ${OSrev}
258	-cp ${DESTDIR}/snapshot/bsd* ${RELEASEDIR}
259	-cp ${DESTDIR}/snapshot/*boot* ${RELEASEDIR}
260	-cp ${DESTDIR}/snapshot/*BOOT* ${RELEASEDIR}
261	-cp ${DESTDIR}/snapshot/INSTALL.* ${RELEASEDIR}
262	-cp ${DESTDIR}/snapshot/*.fs ${DESTDIR}/snapshot/*.fs.gz ${RELEASEDIR}
263	-cd ${RELEASEDIR}; \
264		md5 bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.gz *.tgz > MD5
265	-cd ${RELEASEDIR}; \
266		cksum bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.gz *.tgz > CKSUM
267.if defined(MACHINE_HAS_TOOLS)
268	mkdir -p ${RELEASEDIR}/tools
269	cp ${DESTDIR}/snapshot/tools/* ${RELEASEDIR}/tools
270	cd ${RELEASEDIR} && md5 tools/* >>MD5
271	cd ${RELEASEDIR} && cksum tools/* >>CKSUM
272.endif
273	-cd ${RELEASEDIR} && sort -o MD5 MD5
274	-cd ${RELEASEDIR} && sort -o CKSUM -k 3 CKSUM
275.endif
276
277snapshot: distribution snap_pre snap_tar snap_md
278	cd ${DESTDIR}/snapshot && cksum * > CKSUMS
279	cd ${DESTDIR}/snapshot && md5 * > MD5
280
281snap_pre:
282	/bin/rm -rf ${DESTDIR}/snapshot
283	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/snapshot
284
285snap_tar:
286	cd ${DESTDIR} && tar cf - bin \
287	    | ${GZIP} ${GZIPFLAGS} > snapshot/bin.tar${GZIPEXT}
288	cd ${DESTDIR} && tar cf - dev \
289	    | ${GZIP} ${GZIPFLAGS} > snapshot/dev.tar${GZIPEXT}
290	cd ${DESTDIR} && tar cf - .profile .cshrc altroot etc home mnt \
291	    root stand sys tmp | ${GZIP} ${GZIPFLAGS} \
292	    > snapshot/etc.tar${GZIPEXT}
293	cd ${DESTDIR} && tar cf - sbin \
294	    | ${GZIP} ${GZIPFLAGS} > snapshot/sbin.tar${GZIPEXT}
295	cd ${DESTDIR} && tar cf - usr/bin \
296	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.bin.tar${GZIPEXT}
297	cd ${DESTDIR} && tar cf - usr/games \
298	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.games.tar${GZIPEXT}
299	cd ${DESTDIR} && tar cf - usr/include \
300	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.include.tar${GZIPEXT}
301	cd ${DESTDIR} && tar cf - usr/lib \
302	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.lib.tar${GZIPEXT}
303	cd ${DESTDIR} && tar cf - usr/libexec \
304	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.libexec.tar${GZIPEXT}
305	cd ${DESTDIR} && tar cf - usr/mdec usr/libdata usr/lkm usr/local \
306	    usr/src usr/obj | ${GZIP} ${GZIPFLAGS} \
307	    > snapshot/usr.misc.tar${GZIPEXT}
308	cd ${DESTDIR} && tar cf - usr/sbin \
309	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.sbin.tar${GZIPEXT}
310	cd ${DESTDIR} && tar cf - usr/share \
311	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.share.tar${GZIPEXT}
312	cd ${DESTDIR} && tar cf - var \
313	    | ${GZIP} ${GZIPFLAGS} > snapshot/var.tar${GZIPEXT}
314	cd ../distrib/notes; ${MAKE}; ${MAKE} install
315
316snap_md:
317# nothing here -- look in the machine-dependent Makefile.inc
318
319.endif	# DESTDIR check
320
321MAKEDEVARCHS+= alpha
322MAKEDEVARCHS+= amiga
323MAKEDEVARCHS+= hp300
324MAKEDEVARCHS+= hppa
325MAKEDEVARCHS+= i386
326MAKEDEVARCHS+= mac68k
327MAKEDEVARCHS+= macppc
328#MAKEDEVARCHS+= mvme68k
329#MAKEDEVARCHS+= mvme88k
330#MAKEDEVARCHS+= mvmeppc
331MAKEDEVARCHS+= sparc
332MAKEDEVARCHS+= sparc64
333MAKEDEVARCHS+= sun3
334MAKEDEVARCHS+= vax
335
336all:
337	@make M=${MACHINE} m4
338
339clean:
340	rm -f etc.${MACHINE}/MAKEDEV
341
342cleandir:
343	@cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
344	    make MACHINE=$$m clean; done
345
346m4: etc.${M}/MAKEDEV
347
348etc.${M}/MAKEDEV: MAKEDEV.sub MAKEDEV.mi etc.${M}/MAKEDEV.md
349	@echo "==> etc.${M}/MAKEDEV"
350	@m4 -DMACHINE=${M} MAKEDEV.mi > etc.${M}/.MAKEDEV.tmp && \
351	    mv etc.${M}/.MAKEDEV.tmp etc.${M}/MAKEDEV || \
352	    rm etc.${M}/.MAKEDEV.tmp
353
354allarchs: MAKEDEV.sub MAKEDEV.mi
355	@cd ${.CURDIR}; for m in ${MAKEDEVARCHS}; do \
356	    make M=$$m m4; done
357
358.include <bsd.prog.mk>
359