Augment the upgrade_etc target to remove stale compiler-related binaries
[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 # $DragonFly: src/etc/Makefile,v 1.9 2004/01/16 09:11:10 dillon Exp $
4
5 .if !defined(NO_SENDMAIL)
6 SUBDIR= sendmail
7 .endif
8
9 BINUPDATE= apmd.conf fbtab gettytab network.subr \
10         protocols \
11         rc rc.firewall rc.firewall6 \
12         rc.sendmail rc.shutdown \
13         rc.subr rpc services \
14         etc.${MACHINE_ARCH}/disktab \
15         ${.CURDIR}/../usr.bin/mail/misc/mail.rc \
16         ${.CURDIR}/../usr.bin/locate/locate/locate.rc
17
18 BIN1=   ${BINUPDATE} \
19         amd.map auth.conf \
20         crontab csh.cshrc csh.login csh.logout \
21         dhclient.conf dm.conf ftpusers group \
22         hosts hosts.allow host.conf hosts.equiv hosts.lpd \
23         inetd.conf login.access login.conf \
24         motd modems networks newsyslog.conf \
25         pam.conf phones printcap profile \
26         remote \
27         shells sysctl.conf syslog.conf usbd.conf \
28         etc.${MACHINE_ARCH}/ttys \
29         ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
30
31 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
32 .if !defined(NO_OPENSSH)
33 SSH=    ${.CURDIR}/../crypto/openssh/ssh_config \
34         ${.CURDIR}/../crypto/openssh/sshd_config \
35         moduli
36 .endif
37 SSL=    ${.CURDIR}/../crypto/openssl/apps/openssl.cnf
38 .endif
39
40 # -rwxr-xr-x root:wheel, for the new cron root:wheel
41 BIN2=   pccard_ether rc.suspend rc.resume
42
43 DEFAULTS= rc.conf make.conf pccard.conf periodic.conf
44
45 MTREE=  BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
46         BSD.var.dist BSD.x11.dist BSD.x11-4.dist
47 .if !defined(NO_SENDMAIL)
48 MTREE+= BSD.sendmail.dist
49 .endif
50
51 NAMEDB= PROTO.localhost.rev PROTO.localhost-v6.rev named.conf named.root \
52         make-localhost
53
54 PPPCNF= ppp.conf
55
56 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
57         mailertable.sample aliases
58
59 # Special top level files for FreeBSD
60 FREEBSD=COPYRIGHT
61
62 distribute:
63         cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
64 .if defined(OBJFORMAT)
65         echo OBJFORMAT=${OBJFORMAT} > ${DISTDIR}/${DISTRIBUTION}/etc/objformat
66 .endif
67
68 upgrade_etc:
69         cd ${.CURDIR}; \
70             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
71                 ${BINUPDATE} ${DESTDIR}/etc; \
72             cap_mkdb ${DESTDIR}/etc/login.conf; \
73             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
74                 ${BIN2} ${DESTDIR}/etc;
75         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
76             ${DEFAULTS} ${DESTDIR}/etc/defaults
77         cd ${.CURDIR}/periodic; ${MAKE} install
78         cd ${.CURDIR}/rc.d; ${MAKE} install 
79         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
80         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
81 .if !defined(NO_I4B)
82         cd ${.CURDIR}/isdn; ${MAKE} install
83 .endif
84 .if !defined(NO_MAKEDEV)
85         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
86             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
87 .if !defined(NO_MAKEDEV_RUN)
88         cd ${DESTDIR}/dev; sh MAKEDEV all
89 .endif
90 .endif
91         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
92             ${MTREE} ${DESTDIR}/etc/mtree
93         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
94             ${FREEBSD} ${DESTDIR}/
95 .if !defined(NOMAN)
96         cd ${.CURDIR}/../share/man; ${MAKE} makedb
97 .endif
98 .if exists(${DESTDIR}/usr/libexec/gcc2/cc1)
99         ldconfig -m ${DESTDIR}/usr/lib/gcc2
100         rm -rf ${DESTDIR}/usr/libdata/ldscripts
101         rm -rf ${DESTDIR}/usr/libexec/elf
102         csh -c "rm -f ${DESTDIR}/usr/libexec/{cc1,cc1obj,cc1plus,cpp,cpp0}"
103         csh -c "rm -f ${DESTDIR}/usr/libexec/{f771,objformat}"
104         csh -c "rm -f ${DESTDIR}/usr/lib/{crtbegin.o,crtbeginS.o,crtend.o}"
105         csh -c "rm -f ${DESTDIR}/usr/lib/{crtendS.o,libgcc.a,libgcc_p.a}"
106         csh -c "rm -f ${DESTDIR}/usr/lib/{libobjc.a,libobjc_p.a,libstdc++.a}"
107         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++.so,libstdc++.so.3}"
108         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++_p.a}"
109         csh -c "rm -f ${DESTDIR}/usr/bin/CC"
110         ldconfig -R
111 .endif
112
113 distribution:
114         cd ${.CURDIR}; \
115             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
116                 ${BIN1} ${DESTDIR}/etc; \
117             cap_mkdb ${DESTDIR}/etc/login.conf; \
118             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
119                 ${BIN2} ${DESTDIR}/etc; \
120             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
121                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
122             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
123         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
124             ${DEFAULTS} ${DESTDIR}/etc/defaults
125         cd ${.CURDIR}/periodic; ${MAKE} install
126         cd ${.CURDIR}/rc.d; ${MAKE} install 
127         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
128         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
129 .if !defined(NO_I4B)
130         cd ${.CURDIR}/isdn; ${MAKE} install
131 .endif
132 .if !defined(NO_SENDMAIL)
133         cd ${.CURDIR}/sendmail; ${MAKE} distribution
134 .endif
135 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
136 .if !defined(NO_OPENSSH)
137         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
138             ${SSH} ${DESTDIR}/etc/ssh
139 .endif
140         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
141             ${SSL} ${DESTDIR}/etc/ssl
142 .endif
143 .if !defined(NO_MAKEDEV)
144         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
145             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
146 .if !defined(NO_MAKEDEV_RUN)
147         cd ${DESTDIR}/dev; sh MAKEDEV all
148 .endif
149 .endif
150         cd ${.CURDIR}/root; \
151             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
152                 dot.cshrc ${DESTDIR}/root/.cshrc; \
153             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
154                 dot.klogin ${DESTDIR}/root/.klogin; \
155             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
156                 dot.login ${DESTDIR}/root/.login; \
157             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
158                 dot.profile ${DESTDIR}/root/.profile; \
159             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
160             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
161             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
162         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
163             ${MTREE} ${DESTDIR}/etc/mtree
164         cd ${.CURDIR}/namedb; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
165             ${NAMEDB} ${DESTDIR}/etc/namedb
166         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
167             ${PPPCNF} ${DESTDIR}/etc/ppp
168         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
169             ${ETCMAIL} ${DESTDIR}/etc/mail
170         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
171               ! -f ${DESTDIR}/etc/aliases ]; then \
172                 set -x; \
173                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
174         fi
175         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
176             ${DESTDIR}/etc/dumpdates
177         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
178             ${DESTDIR}/var/db/locate.database
179         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
180             ${DESTDIR}/var/log/auth.log
181         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
182             ${DESTDIR}/var/log/cron
183         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
184             ${DESTDIR}/var/log/lpd-errs
185         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
186             ${DESTDIR}/var/log/maillog
187         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
188             ${DESTDIR}/var/log/lastlog
189         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
190             ${DESTDIR}/var/log/messages
191         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
192             ${DESTDIR}/var/log/security
193         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
194             ${DESTDIR}/var/log/slip.log
195         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
196             ${DESTDIR}/var/log/ppp.log
197         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
198             ${DESTDIR}/var/log/wtmp
199         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
200             ${DESTDIR}/var/run/utmp
201         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
202             ${DESTDIR}/var/crash
203         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
204             ${FREEBSD} ${DESTDIR}/
205 .if !defined(NOMAN)
206         cd ${.CURDIR}/../share/man; ${MAKE} makedb
207 .endif
208
209 distrib-dirs:
210         -set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.deprecated`; \
211         while [ $$# -gt 0 ] ; \
212         do \
213                 for dir in /usr/share/locale \
214                            /usr/share/nls \
215                            /usr/local/share/nls; \
216                 do \
217                         test -d ${DESTDIR}/$${dir} && cd ${DESTDIR}/$${dir}; \
218                         test -L "$$2" && rm -rf "$$2"; \
219                         test \! -L "$$1" && test -d "$$1" && mv "$$1" "$$2"; \
220                 done; \
221                 shift; shift; \
222         done
223         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
224         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
225         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
226         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
227                 -p ${DESTDIR}/usr/include
228         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
229                 -p ${DESTDIR}/usr/libdata/perl/5.00503/mach
230 .if !defined(NO_SENDMAIL)
231         mtree -deU -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
232 .endif
233         cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
234         cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
235         cd ${DESTDIR}/usr/share/man; \
236         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
237         while [ $$# -gt 0 ] ; \
238         do \
239                 rm -rf "$$1"; \
240                 ln -s "$$2" "$$1"; \
241                 shift; shift; \
242         done
243         cd ${DESTDIR}/usr/share/locale; \
244         set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.alias`; \
245         while [ $$# -gt 0 ] ; \
246         do \
247                 rm -rf "$$1"; \
248                 ln -s "$$2" "$$1"; \
249                 shift; shift; \
250         done
251         cd ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1; ln -sf ../man* .
252         cd ${DESTDIR}/usr/share/nls; \
253         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
254         while [ $$# -gt 0 ] ; \
255         do \
256                 rm -rf "$$1"; \
257                 ln -s "$$2" "$$1"; \
258                 shift; shift; \
259         done
260
261 etc-examples:
262         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
263             ${BIN1} ${BIN2} nsmb.conf opieaccess \
264             ${DESTDIR}/usr/share/examples/etc
265         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
266             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
267
268 .include <bsd.prog.mk>