xref: /openbsd/etc/Makefile (revision 133306f0)
1#	$OpenBSD: Makefile,v 1.117 2001/01/21 15:11:18 itojun 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	ipf.rules ksh.kshrc locate.rc man.conf monthly motd mrouted.conf \
19	myname ipnat.rules netstart networks newsyslog.conf passwd.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# -rw-rw-r--
26BIN2=	motd
27
28NAMEDB=	localhost.rev root.cache
29PCS=	pcs750.bin
30WCS1=	wcs fppwcs poc poc1 poc2 fppoc
31WCS2=	fpevent fppwcs fppwcs_dual hdcwcs load_diags start_fpp wcs wcs_dual
32
33# Use NOGZIP on architectures where the gzip'ing would take too much time
34# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
35# gzip them on a faster machine
36.ifndef NOGZIP
37GZIP?=		gzip
38GZIPFLAGS?=	-9
39GZIPEXT?=	.gz
40.else
41GZIP=		cat
42GZIPFLAGS=
43GZIPEXT=
44.endif
45
46all clean cleandir depend etc install lint:
47
48.ifndef DESTDIR
49distribution-etc-root-var distribution distrib-dirs release snapshot:
50	@echo setenv DESTDIR before doing that!
51	@false
52.else
53distribution-etc-root-var: distrib-dirs
54	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
55	cat etc.${MACHINE}/ttys ttys.pty > ${DESTDIR}/etc/ttys && \
56	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
57	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
58	    chmod 644 ${DESTDIR}/etc/ttys
59	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
60	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
61	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
62	    chmod 644 ${DESTDIR}/etc/sysctl.conf
63	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
64	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
65	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
66	    chmod 644 ${DESTDIR}/etc/fbtab
67	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
68	${INSTALL} -c -o root -g wheel -m 600 hosts.equiv ${DESTDIR}/etc
69	${INSTALL} -c -o root -g wheel -m 600 crontab ${DESTDIR}/var/cron/tabs/root
70	${INSTALL} -c -o root -g wheel -m 644 login.conf ${DESTDIR}/etc
71	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
72	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
73	${INSTALL} -c -o root -g wheel -m 644 primes ${DESTDIR}/etc
74	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
75	     MAKEDEV.local etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
76	(cd root; \
77		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
78		    ${DESTDIR}/root/.cshrc; \
79		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
80		    ${DESTDIR}/root/.klogin; \
81		${INSTALL} -c -o root -g wheel -m 644 dot.login \
82		    ${DESTDIR}/root/.login; \
83		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
84		    ${DESTDIR}/root/.profile; \
85		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
86		ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
87		ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile)
88	(cd skel; \
89		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
90		    ${DESTDIR}/etc/skel/.cshrc; \
91		${INSTALL} -c -o root -g wheel -m 644 dot.login \
92		    ${DESTDIR}/etc/skel/.login; \
93		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
94		    ${DESTDIR}/etc/skel/.mailrc; \
95		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
96		    ${DESTDIR}/etc/skel/.profile; \
97		${INSTALL} -c -o root -g wheel -m 600 dot.rhosts \
98		    ${DESTDIR}/etc/skel/.rhosts)
99	(cd kerberosIV; \
100		${INSTALL} -c -o root -g wheel -m 644 README \
101		    ${DESTDIR}/etc/kerberosIV; \
102		${INSTALL} -c -o root -g wheel -m 644 krb.conf \
103		    ${DESTDIR}/etc/kerberosIV; \
104		${INSTALL} -c -o root -g wheel -m 644 krb.realms \
105		    ${DESTDIR}/etc/kerberosIV)
106	(cd amd; \
107		${INSTALL} -c -o root -g wheel -m 644 master.sample \
108		    ${DESTDIR}/etc/amd)
109	(cd mtree; \
110		${INSTALL} -c -o root -g wheel -m 600 special \
111		    ${DESTDIR}/etc/mtree; \
112		${INSTALL} -c -o root -g wheel -m 444 4.4BSD.dist \
113		    ${DESTDIR}/etc/mtree; \
114		${INSTALL} -c -o root -g wheel -m 444 BSD.local.dist \
115		    ${DESTDIR}/etc/mtree; \
116		${INSTALL} -c -o root -g wheel -m 444 BSD.x11.dist \
117		    ${DESTDIR}/etc/mtree)
118	(cd photuris; \
119		${INSTALL} -c -o root -g wheel -m 600 secrets.conf \
120		    ${DESTDIR}/etc/photuris; \
121		${INSTALL} -c -o root -g wheel -m 600 attributes.conf \
122		    ${DESTDIR}/etc/photuris; \
123		${INSTALL} -c -o root -g wheel -m 600 photuris.conf \
124		    ${DESTDIR}/etc/photuris; \
125		${INSTALL} -c -o root -g wheel -m 600 photuris.startup \
126		    ${DESTDIR}/etc/photuris)
127	(cd ppp; \
128		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
129		    ${DESTDIR}/etc/ppp; \
130		${INSTALL} -c -o root -g wheel -m 600 options \
131		    ${DESTDIR}/etc/ppp; \
132		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
133		    ${DESTDIR}/etc/ppp; \
134		${INSTALL} -c -o root -g wheel -m 600 options.sample \
135		    ${DESTDIR}/etc/ppp; \
136		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
137		    ${DESTDIR}/etc/ppp; \
138		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
139		    ${DESTDIR}/etc/ppp; \
140		${INSTALL} -c -o root -g wheel -m 644 ppp.conf.sample \
141		    ${DESTDIR}/etc/ppp; \
142		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
143		    ${DESTDIR}/etc/ppp; \
144		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
145		    ${DESTDIR}/etc/ppp; \
146		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
147		    ${DESTDIR}/etc/ppp)
148	(cd afs; \
149		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
150		    ${DESTDIR}/etc/afs; \
151		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
152		    ${DESTDIR}/etc/afs; \
153		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
154		    ${DESTDIR}/etc/afs; \
155		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
156		    ${DESTDIR}/etc/afs; \
157		${INSTALL} -c -o root -g wheel -m 644 README \
158		    ${DESTDIR}/etc/afs)
159	(cd namedb; \
160	    ${INSTALL} -c -o root -g ${BINGRP} -m 644 named.boot \
161		${DESTDIR}/var/named; \
162	    ${INSTALL} -c -o named -g ${BINGRP} -m 644 ${NAMEDB} \
163		${DESTDIR}/var/named/namedb)
164	/bin/rm -f ${DESTDIR}/etc/localtime
165	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
166	/bin/rm -f ${DESTDIR}/etc/rmt
167	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
168	${INSTALL} -c -o root -g wheel -m 644 minfree \
169		${DESTDIR}/var/crash
170	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
171		${DESTDIR}/etc/dumpdates
172	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
173		${DESTDIR}/etc/skeykeys
174	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
175		${DESTDIR}/var/at/at.deny
176	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
177		${DESTDIR}/var/cron/log
178	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
179		${DESTDIR}/var/db/locate.database
180	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
181		${DESTDIR}/var/log/authlog
182	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
183		${DESTDIR}/var/log/daemon
184	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
185		${DESTDIR}/var/log/ftpd
186	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
187		${DESTDIR}/var/log/ipflog
188	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
189		${DESTDIR}/var/log/lastlog
190	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
191		${DESTDIR}/var/log/lpd-errs
192	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
193		${DESTDIR}/var/log/maillog
194	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
195		${DESTDIR}/var/log/messages
196	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
197		${DESTDIR}/var/log/secure
198	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
199		${DESTDIR}/var/log/wtmp
200	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
201		${DESTDIR}/var/log/xferlog
202	${INSTALL} -c -o daemon -g staff -m 664 /dev/null \
203		${DESTDIR}/var/msgs/bounds
204	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
205		${DESTDIR}/var/run/utmp
206.if (${MACHINE_ARCH} == "mips")
207	(cd etc.${MACHINE}; ${INSTALL} -c -o ${BINOWN} -g wheel -m 444 \
208	    ld.so.conf ${DESTDIR}/etc)
209.endif
210.ifndef NOMAKEDEV
211	(cd ${DESTDIR}/dev; ./MAKEDEV all)
212.endif
213.if ${MACHINE} == "vax"
214	(cd etc.vax; ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${PCS} \
215	    ${DESTDIR}/)
216.endif
217	(cd ../gnu/usr.sbin/sendmail/cf/cf; ${MAKE} distribution)
218	(cd ../usr.sbin/ypserv/ypinit; ${MAKE} distribution)
219	(cd ../usr.bin/ssh; ${MAKE} distribution)
220	(cd ../usr.sbin/httpd; ${MAKE} -f Makefile.bsd-wrapper distribution)
221	(cd ../lib/libssl; ${MAKE} -f Makefile.bsd-wrapper distribution)
222	(cd ../gnu/usr.bin/lynx; ${MAKE} -f Makefile.bsd-wrapper distribution)
223	(cd ../usr.bin/mail; ${MAKE} distribution)
224	${INSTALL} -c -o root -g ${BINGRP} -m 644 aliases \
225	    ${DESTDIR}/etc/mail/aliases
226	/usr/libexec/sendmail/sendmail -C${DESTDIR}/etc/mail/sendmail.cf \
227	    -bi -O AliasFile=${DESTDIR}/etc/mail/aliases \
228	    -O DontBlameSendmail=mapinunsafedirpath
229	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
230		${DESTDIR}/var/mail/root
231
232distribution: distribution-etc-root-var
233	(cd ..; ${MAKE} install)
234
235distrib-dirs:
236	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}
237	-mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -u
238	if [ ! -d ${DESTDIR}/usr/src ]; then \
239		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
240	fi
241	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
242
243.ifndef RELEASEDIR
244release:
245	@echo setenv RELEASEDIR before building a release.
246	@false
247.else
248release: distribution snap_pre snap_md
249	cd ${.CURDIR}/../distrib/notes; ${MAKE}; ${MAKE} install
250	cd ${.CURDIR}/../distrib/sets; csh maketars ${OSrev}
251	-cp ${DESTDIR}/snapshot/bsd* ${RELEASEDIR}
252	-cp ${DESTDIR}/snapshot/*boot* ${RELEASEDIR}
253	-cp ${DESTDIR}/snapshot/*BOOT* ${RELEASEDIR}
254	-cp ${DESTDIR}/snapshot/INSTALL.* ${RELEASEDIR}
255	-cp ${DESTDIR}/snapshot/*.fs ${DESTDIR}/snapshot/*.fs.gz ${RELEASEDIR}
256	-cd ${RELEASEDIR}; \
257		md5 bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.gz *.tgz > MD5
258	-cd ${RELEASEDIR}; \
259		cksum bsd!(*.gz) *boot* *BOOT* INSTALL.* *.fs *.gz *.tgz > CKSUM
260.if defined(MACHINE_HAS_TOOLS)
261	mkdir -p ${RELEASEDIR}/tools
262	cp ${DESTDIR}/snapshot/tools/* ${RELEASEDIR}/tools
263	cd ${RELEASEDIR} && md5 tools/* >>MD5
264	cd ${RELEASEDIR} && cksum tools/* >>CKSUM
265.endif
266	-cd ${RELEASEDIR} && sort -o MD5 MD5
267	-cd ${RELEASEDIR} && sort -o CKSUM -k 3 CKSUM
268.endif
269
270snapshot: distribution snap_pre snap_tar snap_md
271	cd ${DESTDIR}/snapshot && cksum * > CKSUMS
272	cd ${DESTDIR}/snapshot && md5 * > MD5
273
274snap_pre:
275	/bin/rm -rf ${DESTDIR}/snapshot
276	${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}/snapshot
277
278snap_tar:
279	cd ${DESTDIR} && tar cf - bin \
280	    | ${GZIP} ${GZIPFLAGS} > snapshot/bin.tar${GZIPEXT}
281	cd ${DESTDIR} && tar cf - dev \
282	    | ${GZIP} ${GZIPFLAGS} > snapshot/dev.tar${GZIPEXT}
283	cd ${DESTDIR} && tar cf - .profile .cshrc altroot etc home mnt \
284	    root stand sys tmp | ${GZIP} ${GZIPFLAGS} \
285	    > snapshot/etc.tar${GZIPEXT}
286	cd ${DESTDIR} && tar cf - sbin \
287	    | ${GZIP} ${GZIPFLAGS} > snapshot/sbin.tar${GZIPEXT}
288	cd ${DESTDIR} && tar cf - usr/bin \
289	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.bin.tar${GZIPEXT}
290	cd ${DESTDIR} && tar cf - usr/games \
291	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.games.tar${GZIPEXT}
292	cd ${DESTDIR} && tar cf - usr/include \
293	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.include.tar${GZIPEXT}
294	cd ${DESTDIR} && tar cf - usr/lib \
295	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.lib.tar${GZIPEXT}
296	cd ${DESTDIR} && tar cf - usr/libexec \
297	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.libexec.tar${GZIPEXT}
298	cd ${DESTDIR} && tar cf - usr/mdec usr/libdata usr/lkm usr/local \
299	    usr/src usr/obj | ${GZIP} ${GZIPFLAGS} \
300	    > snapshot/usr.misc.tar${GZIPEXT}
301	cd ${DESTDIR} && tar cf - usr/sbin \
302	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.sbin.tar${GZIPEXT}
303	cd ${DESTDIR} && tar cf - usr/share \
304	    | ${GZIP} ${GZIPFLAGS} > snapshot/usr.share.tar${GZIPEXT}
305	cd ${DESTDIR} && tar cf - var \
306	    | ${GZIP} ${GZIPFLAGS} > snapshot/var.tar${GZIPEXT}
307	cd ../distrib/notes; ${MAKE}; ${MAKE} install
308
309snap_md:
310# nothing here -- look in the machine-dependent Makefile.inc
311
312.endif	# DESTDIR check
313
314.include <bsd.prog.mk>
315