libevtr: Add YY_NO_INPUT to ktrfmt.l and regenerate (silences gcc44 warning).
[dragonfly.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2 # $FreeBSD: src/etc/Makefile,v 1.219.2.38 2003/03/04 09:49:00 ru Exp $
3
4 .if !defined(NO_SENDMAIL)
5 SUBDIR= sendmail
6 .endif
7
8 # Files that should be installed read-only (444)
9 #
10 BINUPDATE= apmd.conf fbtab gettytab network.subr \
11         pf.os \
12         protocols \
13         rc rc.firewall6 \
14         rc.sendmail rc.shutdown \
15         rc.subr rpc services \
16         etc.${MACHINE_ARCH}/disktab
17 .if defined(BINARY_UPGRADE) # location of these depends on upgrade method
18 BINUPDATE+=mail.rc locate.rc
19 .else
20 BINUPDATE+=${.CURDIR}/../usr.bin/mail/misc/mail.rc \
21         ${.CURDIR}/../usr.bin/locate/locate/locate.rc
22 .endif
23
24 # Initial distribution files are installed read-write (644)
25 #
26 BIN1=   amd.map auth.conf \
27         crontab csh.cshrc csh.login csh.logout \
28         devd.conf devtab dhclient.conf dm.conf dntpd.conf \
29         ftpusers group \
30         hosts hosts.allow hosts.equiv hosts.lpd \
31         inetd.conf login.access login.conf \
32         motd modems netconfig networks newsyslog.conf \
33         nscd.conf pf.conf phones printcap profile \
34         regdomain.xml remote sensorsd.conf \
35         shells sysctl.conf syslog.conf usbd.conf \
36         etc.${MACHINE_ARCH}/ttys
37 .if defined(BINARY_UPGRADE) # location of these depends on upgrade method
38 BIN1+=  manpath.config
39 .else
40 BIN1+=  ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
41 .endif
42
43 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
44 .if !defined(NO_OPENSSH)
45 DIRS+=  secure/lib/libssh \
46         secure/usr.bin/ssh \
47         secure/usr.sbin/sshd
48 .endif
49 DIRS+=  secure/usr.bin/openssl
50 .endif
51 DIRS+=  libexec/dma
52
53 # Files that should be installed read-only-executable (555) root:wheel
54 #
55 BIN2=   pccard_ether rc.firewall rc.suspend rc.resume
56
57 DEFAULTS= compilers.conf devfs.conf make.conf periodic.conf rc.conf uuids
58
59 MTREE=  BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
60         BSD.var.dist
61 .if !defined(NO_SENDMAIL)
62 MTREE+= BSD.sendmail.dist
63 .endif
64
65 PPPCNF= ppp.conf
66
67 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
68         mailertable.sample aliases
69
70 # Special top level files for FreeBSD
71 FREEBSD=COPYRIGHT
72
73 # List of libraries in /usr/lib/compat that might have to be removed
74 # from /usr/lib.
75 COMPAT_LIBS != cd ${DESTDIR}/usr/lib/compat && find . -name '*.so.*'
76
77 # Use this directory as the source for new configuration files when upgrading
78 UPGRADE_SRCDIR?=${.CURDIR}
79
80 # Include file which contains obsolete files
81 .if exists(${DESTDIR}/etc/upgrade/Makefile_upgrade.inc)
82 .include "${DESTDIR}/etc/upgrade/Makefile_upgrade.inc"
83 .endif
84
85 remove-obsolete-files:
86         @if [ -z "${TO_REMOVE}" ]; then \
87                 echo "Please do a 'make installworld' first."; \
88                 echo "See build(7) for further information."; \
89                 exit 1; \
90         fi;
91         @echo "===> Remove now obsolete files"
92         @for item in ${TO_REMOVE:M*.info.gz}; do \
93                 if [ -e ${DESTDIR}$${item} ]; then \
94                         install-info --delete ${DESTDIR}$${item} \
95                             /usr/share/info/dir; \
96                 fi; \
97         done;
98         @for item in ${TO_REMOVE}; do \
99                 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
100                         echo "${DESTDIR}$${item}"; \
101                         rm -rf "${DESTDIR}$${item}"; \
102                 fi; \
103         done
104
105 preupgrade:
106 .if !defined(NO_SENDMAIL)
107         (pw -V ${DESTDIR}/etc groupshow smmsp -q > /dev/null) || \
108                 pw -V ${DESTDIR}/etc groupadd smmsp -g 25
109         (pw -V ${DESTDIR}/etc usershow smmsp -q > /dev/null) || \
110                 pw -V ${DESTDIR}/etc useradd smmsp -u 25 \
111                    -c "Sendmail Submission User" \
112                    -d /var/spool/clientmqueue -s /sbin/nologin
113 .endif
114         (pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
115                 pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
116                    -c "pflogd privsep user" \
117                    -d /var/empty -s /sbin/nologin
118         (pw -V ${DESTDIR}/etc usershow _sdpd -q > /dev/null) || \
119                 pw -V ${DESTDIR}/etc useradd _sdpd -u 70 \
120                    -c "sdpd privsep user" \
121                    -d /var/empty -s /sbin/nologin
122         (pw -V ${DESTDIR}/etc usershow _dhcp -q > /dev/null) || \
123                 pw -V ${DESTDIR}/etc useradd _dhcp -u 77 \
124                    -c "DHCP programs" \
125                    -d /var/empty -s /sbin/nologin
126         (pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
127                 pw -V ${DESTDIR}/etc groupadd authpf -g 63
128         (pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
129                 pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
130         (pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
131                 pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
132         (pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
133                 pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
134
135 upgrade_etc:    preupgrade remove-obsolete-files
136         # files that should be dirs (not possible with Makefile_upgrade.inc)
137 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin
138         [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
139 .endfor
140 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
141         cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
142 .endif
143         cd ${UPGRADE_SRCDIR}; \
144             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
145                 ${BINUPDATE} ${DESTDIR}/etc; \
146             cap_mkdb ${DESTDIR}/etc/login.conf; \
147             for f in ${BIN1}; do \
148                 [ -e "${DESTDIR}/etc/$${f##*/}" ] || \
149                     ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
150                         $$f ${DESTDIR}/etc; \
151             done; \
152             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
153                 ${BIN2} ${DESTDIR}/etc;
154         cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
155             ${DEFAULTS} ${DESTDIR}/etc/defaults
156         cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
157         mkdir -p ${DESTDIR}/etc/rc.d
158         cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install 
159         # "../share/termcap/make etc-termcap" expanded inline here:
160         ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
161         # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
162         ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
163 .if !defined(BINARY_UPGRADE) # XXX not yet handled by binary upgrade
164 .if !defined(NO_SENDMAIL)
165         cd ${UPGRADE_SRCDIR}/sendmail; ${MAKE} upgrade
166 .endif
167 .endif
168 .if !defined(NO_I4B)
169         cd ${UPGRADE_SRCDIR}/isdn; ${MAKE} install
170 .endif
171         cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
172             ${MTREE} ${DESTDIR}/etc/mtree
173         cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
174         cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
175 .if !exists(${DESTDIR}/etc/pam.d)
176         mkdir -p ${DESTDIR}/etc/pam.d
177         cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
178         sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
179 .else
180 .for pamconf in README convert.sh atrun cron passwd rsh su system
181 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
182         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
183 .endif
184 .endfor
185 .endif
186         # these removals must occur AFTER any pam conversion
187         csh -c "rm -f /usr/lib/pam_{cleartext_pass_ok,deny,opie,opieaccess,permit,radius,skey,ssh,tacplus,unix}.so"
188         rm -f /etc/pam.conf
189 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
190         cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
191             ${FREEBSD} ${DESTDIR}/
192 .endif
193         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
194         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
195         ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
196         ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
197 .if exists(${DESTDIR}/usr/lib/gcc2)
198         ldconfig -m ${DESTDIR}/usr/lib/gcc2
199 .endif
200 .for lib in ${COMPAT_LIBS:M*.so.*}
201 .if exists(${DESTDIR}/usr/lib/${lib})
202         chflags noschg ${DESTDIR}/usr/lib/${lib}
203         rm -f ${DESTDIR}/usr/lib/${lib}
204 .endif
205 .endfor
206 .if !defined(NO_OPENSSH)
207         cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc obj
208         cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc install
209 .endif
210 .if exists(${DESTDIR}/boot)
211 .if exists(${DESTDIR}/kernel)
212         chflags noschg ${DESTDIR}/kernel
213         mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
214         chflags schg ${DESTDIR}/boot/kernel
215 .endif
216 .if exists(${DESTDIR}/modules)
217         mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
218         rm -rf ${DESTDIR}/boot/modules/modules
219 .endif
220 .if exists(${DESTDIR}/kernel.old)
221         mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
222 .endif
223 .if exists(${DESTDIR}/modules.old)
224         mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
225         rm -rf ${DESTDIR}/boot/modules.old/modules.old
226 .endif
227 .endif
228 .if exists(${DESTDIR}/etc/settings.conf)
229         mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
230 .endif
231         for ext in a so.0; do \
232                 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
233                 dest=$$(readlink "$$f"); \
234                 case "$$dest" in \
235                 libthread_xu.*|libc_r.*) \
236                         ln -fs thread/$$dest $$f ;; \
237                 esac; \
238         done
239         ldconfig -R
240         mkdir -p ${DESTDIR}/dev
241
242 # The existence of cleartext_pass_ok means pam config files are out of date.
243         @set - `fgrep cleartext_pass_ok ${DESTDIR}/etc/pam.d/*`; \
244         if [ $$# -gt 0 ] ; \
245         then \
246                 echo "It appears your PAM configuration files need to be updated"; \
247                 echo "This can be done by manually editing the files or:"; \
248                 echo "  cd ${UPGRADE_SRCDIR}/pam.d"; \
249                 echo "  make install"; \
250         fi
251
252 distribution:
253         cd ${.CURDIR}; \
254             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
255                 ${BINUPDATE} ${DESTDIR}/etc; \
256             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
257                 ${BIN1} ${DESTDIR}/etc; \
258             cap_mkdb ${DESTDIR}/etc/login.conf; \
259             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
260                 ${BIN2} ${DESTDIR}/etc; \
261             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
262                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
263             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
264         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
265             ${DEFAULTS} ${DESTDIR}/etc/defaults
266         cd ${.CURDIR}/pam.d; ${MAKE} install
267         cd ${.CURDIR}/bluetooth; ${MAKE} install
268         cd ${.CURDIR}/periodic; ${MAKE} install
269         cd ${.CURDIR}/rc.d; ${MAKE} install 
270         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
271         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
272         cd ${.CURDIR}; \
273             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
274                 Makefile.usr ${DESTDIR}/usr/Makefile
275 .if !defined(NO_I4B)
276         cd ${.CURDIR}/isdn; ${MAKE} install
277 .endif
278 .if !defined(NO_SENDMAIL)
279         cd ${.CURDIR}/sendmail; ${MAKE} obj
280         cd ${.CURDIR}/sendmail; ${MAKE} distribution
281 .endif
282 .for dir in ${DIRS}
283 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
284         cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
285         cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
286 .endif
287 .endfor
288         mkdir -p ${DESTDIR}/dev
289         cd ${.CURDIR}/root; \
290             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
291                 dot.cshrc ${DESTDIR}/root/.cshrc; \
292             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
293                 dot.klogin ${DESTDIR}/root/.klogin; \
294             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
295                 dot.login ${DESTDIR}/root/.login; \
296             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
297                 dot.profile ${DESTDIR}/root/.profile; \
298             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
299             ${LN} ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
300             ${LN} ${DESTDIR}/root/.profile ${DESTDIR}/.profile
301         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
302             ${MTREE} ${DESTDIR}/etc/mtree
303         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
304             ${PPPCNF} ${DESTDIR}/etc/ppp
305         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
306             ${ETCMAIL} ${DESTDIR}/etc/mail
307         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
308               ! -f ${DESTDIR}/etc/aliases ]; then \
309                 set -x; \
310                 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
311         fi
312         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
313             ${DESTDIR}/etc/dumpdates
314         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
315             ${DESTDIR}/var/db/locate.database
316         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
317             ${DESTDIR}/var/log/auth.log
318         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
319             ${DESTDIR}/var/log/cron
320         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
321             ${DESTDIR}/var/log/daemon
322         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
323             ${DESTDIR}/var/log/lpd-errs
324         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
325             ${DESTDIR}/var/log/maillog
326         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
327             ${DESTDIR}/var/log/lastlog
328         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
329             ${DESTDIR}/var/log/lastlogx
330         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
331             ${DESTDIR}/var/log/messages
332         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
333             ${DESTDIR}/var/log/security
334         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
335             ${DESTDIR}/var/log/slip.log
336         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
337             ${DESTDIR}/var/log/ppp.log
338         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
339             ${DESTDIR}/var/log/wtmp
340         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
341             ${DESTDIR}/var/log/wtmpx
342         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
343             ${DESTDIR}/var/run/utmp
344         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
345             ${DESTDIR}/var/run/utmpx
346         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
347             ${DESTDIR}/var/crash
348         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
349             ${FREEBSD} ${DESTDIR}/
350 .if !defined(NOMAN)
351         cd ${.CURDIR}/../share/man; ${MAKE} makedb
352 .endif
353
354 distrib-dirs:
355         -set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.deprecated`; \
356         while [ $$# -gt 0 ] ; \
357         do \
358                 for dir in /usr/share/locale \
359                            /usr/share/nls \
360                            /usr/local/share/nls; \
361                 do \
362                         test -d ${DESTDIR}/$${dir} && cd ${DESTDIR}/$${dir}; \
363                         test -L "$$2" && rm -rf "$$2"; \
364                         test \! -L "$$1" && test -d "$$1" && mv "$$1" "$$2"; \
365                 done; \
366                 shift; shift; \
367         done
368         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
369         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
370         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
371         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
372                 -p ${DESTDIR}/usr/include
373 .if !defined(NO_SENDMAIL)
374         mtree -deU -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
375 .endif
376         cd ${DESTDIR}/; test -e sys || (rm -f sys;  ${LN} -s usr/src/sys sys)
377         cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ${LN} -sf ../man* .
378         cd ${DESTDIR}/usr/share/man; \
379         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
380         while [ $$# -gt 0 ] ; \
381         do \
382                 rm -rf "$$1"; \
383                 ${LN} -s "$$2" "$$1"; \
384                 shift; shift; \
385         done
386         cd ${DESTDIR}/usr/share/locale; \
387         set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.alias`; \
388         while [ $$# -gt 0 ] ; \
389         do \
390                 rm -rf "$$1"; \
391                 ${LN} -s "$$2" "$$1"; \
392                 shift; shift; \
393         done
394         cd ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1; ${LN} -sf ../man* .
395         cd ${DESTDIR}/usr/share/nls; \
396         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
397         while [ $$# -gt 0 ] ; \
398         do \
399                 rm -rf "$$1"; \
400                 ${LN} -s "$$2" "$$1"; \
401                 shift; shift; \
402         done
403
404 etc-examples:
405         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
406             ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf opieaccess \
407             ${DESTDIR}/usr/share/examples/etc
408         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
409             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
410
411 .include <bsd.prog.mk>