make distribution: Remove references to deleted nls dirs
[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
101 preupgrade:
102         (pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
103                 pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
104                    -c "Mail user" \
105                    -d /nonexistent -s /sbin/nologin
106         (pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
107                 pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
108                    -c "pflogd privsep user" \
109                    -d /var/empty -s /sbin/nologin
110         (pw -V ${DESTDIR}/etc usershow _sdpd -q > /dev/null) || \
111                 pw -V ${DESTDIR}/etc useradd _sdpd -u 70 \
112                    -c "sdpd privsep user" \
113                    -d /var/empty -s /sbin/nologin
114         (pw -V ${DESTDIR}/etc usershow _dhcp -q > /dev/null) || \
115                 pw -V ${DESTDIR}/etc useradd _dhcp -u 77 \
116                    -c "DHCP programs" \
117                    -d /var/empty -s /sbin/nologin
118         (pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
119                 pw -V ${DESTDIR}/etc groupadd authpf -g 63
120         (pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
121                 pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
122         (pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
123                 pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
124         (pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
125                 pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
126
127 upgrade_check:
128         @if [ -n "`grep '^sendmail.*/usr/libexec/sendmail/sendmail' ${DESTDIR}/etc/mail/mailer.conf`" ]; then \
129                 echo "==================================================================" ; \
130                 echo "=  sendmail is being removed from the base system." ; \
131                 echo "=  /etc/mail/mailer.conf is still configured to use sendmail." ; \
132                 echo "=  See http://www.dragonflybsd.com/docs/docs/newhandbook/mta/" ; \
133                 echo "=  Quick: cp /usr/src/libexec/dma/mailer-conf/mailer.conf.dma " ; \
134                 echo "=            ${DESTDIR}/etc/mail/mailer.conf ; make upgrade" ; \
135                 echo "==================================================================" ; \
136                 /usr/bin/false ; \
137         fi
138
139 upgrade_etc:    upgrade_check preupgrade remove-obsolete-files
140         # files that should be dirs (not possible with Makefile_upgrade.inc)
141 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin
142         [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
143 .endfor
144 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
145         cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
146 .endif
147         cd ${UPGRADE_SRCDIR}; \
148             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
149                 ${BINUPDATE} ${DESTDIR}/etc; \
150             cap_mkdb ${DESTDIR}/etc/login.conf; \
151             for f in ${BIN1}; do \
152                 [ -e "${DESTDIR}/etc/$${f##*/}" ] || \
153                     ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
154                         $$f ${DESTDIR}/etc; \
155             done; \
156             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
157                 ${BIN2} ${DESTDIR}/etc;
158         cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
159             ${DEFAULTS} ${DESTDIR}/etc/defaults
160         cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
161         mkdir -p ${DESTDIR}/etc/rc.d
162         cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install 
163         cd ${UPGRADE_SRCDIR}/devd; ${MAKE} install
164         # "../share/termcap/make etc-termcap" expanded inline here:
165         ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
166         # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
167         ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
168         cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
169             ${MTREE} ${DESTDIR}/etc/mtree
170         cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
171         cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
172 .if !exists(${DESTDIR}/etc/pam.d)
173         mkdir -p ${DESTDIR}/etc/pam.d
174         cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
175         sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
176 .else
177 .for pamconf in README convert.sh atrun cron passwd rsh su system
178 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
179         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
180 .endif
181 .endfor
182 .endif
183         # these removals must occur AFTER any pam conversion
184         csh -c "rm -f /usr/lib/pam_{cleartext_pass_ok,deny,opie,opieaccess,permit,radius,skey,ssh,tacplus,unix}.so"
185         rm -f /etc/pam.conf
186 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
187         cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
188             COPYRIGHT ${DESTDIR}/
189 .endif
190         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
191         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
192         rm -f ${DESTDIR}/usr/include/sys/ata.h
193         ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
194         ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
195         ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
196 .if exists(${DESTDIR}/usr/lib/gcc2)
197         ldconfig -m ${DESTDIR}/usr/lib/gcc2
198 .endif
199 .for lib in ${COMPAT_LIBS:M*.so.*}
200 .if exists(${DESTDIR}/usr/lib/${lib})
201         chflags noschg ${DESTDIR}/usr/lib/${lib}
202         rm -f ${DESTDIR}/usr/lib/${lib}
203 .endif
204 .endfor
205 .if !defined(NO_OPENSSH)
206         cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc obj
207         cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc install
208 .endif
209 .if exists(${DESTDIR}/boot)
210 .if exists(${DESTDIR}/kernel)
211         chflags noschg ${DESTDIR}/kernel
212         mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
213         chflags schg ${DESTDIR}/boot/kernel
214 .endif
215 .if exists(${DESTDIR}/modules)
216         mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
217         rm -rf ${DESTDIR}/boot/modules/modules
218 .endif
219 .if exists(${DESTDIR}/kernel.old)
220         mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
221 .endif
222 .if exists(${DESTDIR}/modules.old)
223         mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
224         rm -rf ${DESTDIR}/boot/modules.old/modules.old
225 .endif
226 .endif
227 .if exists(${DESTDIR}/etc/settings.conf)
228         mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
229 .endif
230         for ext in a so.0; do \
231                 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
232                 dest=$$(readlink "$$f"); \
233                 case "$$dest" in \
234                 libthread_xu.*|libc_r.*) \
235                         ln -fs thread/$$dest $$f ;; \
236                 esac; \
237         done
238         ldconfig -R
239         mkdir -p ${DESTDIR}/dev
240
241 # The existence of cleartext_pass_ok means pam config files are out of date.
242         @set - `fgrep cleartext_pass_ok ${DESTDIR}/etc/pam.d/*`; \
243         if [ $$# -gt 0 ] ; \
244         then \
245                 echo "It appears your PAM configuration files need to be updated"; \
246                 echo "This can be done by manually editing the files or:"; \
247                 echo "  cd ${UPGRADE_SRCDIR}/pam.d"; \
248                 echo "  make install"; \
249         fi
250
251 distribution:
252         cd ${.CURDIR}; \
253             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
254                 ${BINUPDATE} ${DESTDIR}/etc; \
255             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
256                 ${BIN1} ${DESTDIR}/etc; \
257             cap_mkdb ${DESTDIR}/etc/login.conf; \
258             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
259                 ${BIN2} ${DESTDIR}/etc; \
260             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
261                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
262             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
263         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
264             ${DEFAULTS} ${DESTDIR}/etc/defaults
265         cd ${.CURDIR}/pam.d; ${MAKE} install
266         cd ${.CURDIR}/bluetooth; ${MAKE} install
267         cd ${.CURDIR}/periodic; ${MAKE} install
268         cd ${.CURDIR}/rc.d; ${MAKE} install 
269         cd ${.CURDIR}/devd; ${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 .for dir in ${DIRS}
276 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
277         cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
278         cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
279 .endif
280 .endfor
281         mkdir -p ${DESTDIR}/dev
282         cd ${.CURDIR}/root; \
283             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
284                 dot.cshrc ${DESTDIR}/root/.cshrc; \
285             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
286                 dot.klogin ${DESTDIR}/root/.klogin; \
287             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
288                 dot.login ${DESTDIR}/root/.login; \
289             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
290                 dot.profile ${DESTDIR}/root/.profile; \
291             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
292         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
293             ${MTREE} ${DESTDIR}/etc/mtree
294         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
295             ${PPPCNF} ${DESTDIR}/etc/ppp
296         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
297             ${ETCMAIL} ${DESTDIR}/etc/mail
298         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
299               ! -f ${DESTDIR}/etc/aliases ]; then \
300                 set -x; \
301                 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
302         fi
303         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
304             ${DESTDIR}/etc/dumpdates
305         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
306             ${DESTDIR}/var/db/locate.database
307         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
308             ${DESTDIR}/var/log/auth.log
309         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
310             ${DESTDIR}/var/log/cron
311         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
312             ${DESTDIR}/var/log/daemon
313         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
314             ${DESTDIR}/var/log/lpd-errs
315         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
316             ${DESTDIR}/var/log/maillog
317         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
318             ${DESTDIR}/var/log/lastlog
319         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
320             ${DESTDIR}/var/log/lastlogx
321         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
322             ${DESTDIR}/var/log/messages
323         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
324             ${DESTDIR}/var/log/security
325         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
326             ${DESTDIR}/var/log/slip.log
327         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
328             ${DESTDIR}/var/log/ppp.log
329         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
330             ${DESTDIR}/var/log/wtmp
331         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
332             ${DESTDIR}/var/log/wtmpx
333         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
334             ${DESTDIR}/var/run/utmp
335         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
336             ${DESTDIR}/var/run/utmpx
337         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
338             ${DESTDIR}/var/crash
339         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
340             COPYRIGHT ${DESTDIR}/
341         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
342         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
343         rm -f ${DESTDIR}/usr/include/sys/ata.h
344         ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
345         ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
346         ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
347 .if !defined(NOMAN)
348         cd ${.CURDIR}/../share/man; ${MAKE} makedb
349 .endif
350
351 distrib-dirs:
352         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
353         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
354         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
355         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
356                 -p ${DESTDIR}/usr/include
357         cd ${DESTDIR}/; test -e sys || (rm -f sys;  ${LN} -s usr/src/sys sys)
358         cd ${DESTDIR}/usr/share/nls; \
359         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
360         while [ $$# -gt 0 ] ; \
361         do \
362                 rm -rf "$$1"; \
363                 ${LN} -s "$$2" "$$1"; \
364                 shift; shift; \
365         done
366
367 etc-examples:
368         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
369             ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf opieaccess \
370             ${DESTDIR}/usr/share/examples/etc
371         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
372             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
373
374 .include <bsd.prog.mk>