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