Adjust the upgrade target to remove stale /usr/libexec/aout files now
[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.10 2004/01/16 19:57:30 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         rm -rf ${DESTDIR}/usr/libexec/aout
103         csh -c "rm -f ${DESTDIR}/usr/libexec/{cc1,cc1obj,cc1plus,cpp,cpp0}"
104         csh -c "rm -f ${DESTDIR}/usr/libexec/{f771,objformat}"
105         csh -c "rm -f ${DESTDIR}/usr/lib/{crtbegin.o,crtbeginS.o,crtend.o}"
106         csh -c "rm -f ${DESTDIR}/usr/lib/{crtendS.o,libgcc.a,libgcc_p.a}"
107         csh -c "rm -f ${DESTDIR}/usr/lib/{libobjc.a,libobjc_p.a,libstdc++.a}"
108         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++.so,libstdc++.so.3}"
109         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++_p.a}"
110         csh -c "rm -f ${DESTDIR}/usr/bin/CC"
111         ldconfig -R
112 .endif
113
114 distribution:
115         cd ${.CURDIR}; \
116             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
117                 ${BIN1} ${DESTDIR}/etc; \
118             cap_mkdb ${DESTDIR}/etc/login.conf; \
119             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
120                 ${BIN2} ${DESTDIR}/etc; \
121             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
122                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
123             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
124         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
125             ${DEFAULTS} ${DESTDIR}/etc/defaults
126         cd ${.CURDIR}/periodic; ${MAKE} install
127         cd ${.CURDIR}/rc.d; ${MAKE} install 
128         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
129         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
130 .if !defined(NO_I4B)
131         cd ${.CURDIR}/isdn; ${MAKE} install
132 .endif
133 .if !defined(NO_SENDMAIL)
134         cd ${.CURDIR}/sendmail; ${MAKE} distribution
135 .endif
136 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
137 .if !defined(NO_OPENSSH)
138         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
139             ${SSH} ${DESTDIR}/etc/ssh
140 .endif
141         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
142             ${SSL} ${DESTDIR}/etc/ssl
143 .endif
144 .if !defined(NO_MAKEDEV)
145         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
146             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
147 .if !defined(NO_MAKEDEV_RUN)
148         cd ${DESTDIR}/dev; sh MAKEDEV all
149 .endif
150 .endif
151         cd ${.CURDIR}/root; \
152             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
153                 dot.cshrc ${DESTDIR}/root/.cshrc; \
154             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
155                 dot.klogin ${DESTDIR}/root/.klogin; \
156             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
157                 dot.login ${DESTDIR}/root/.login; \
158             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
159                 dot.profile ${DESTDIR}/root/.profile; \
160             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
161             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
162             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
163         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
164             ${MTREE} ${DESTDIR}/etc/mtree
165         cd ${.CURDIR}/namedb; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
166             ${NAMEDB} ${DESTDIR}/etc/namedb
167         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
168             ${PPPCNF} ${DESTDIR}/etc/ppp
169         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
170             ${ETCMAIL} ${DESTDIR}/etc/mail
171         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
172               ! -f ${DESTDIR}/etc/aliases ]; then \
173                 set -x; \
174                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
175         fi
176         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
177             ${DESTDIR}/etc/dumpdates
178         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
179             ${DESTDIR}/var/db/locate.database
180         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
181             ${DESTDIR}/var/log/auth.log
182         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
183             ${DESTDIR}/var/log/cron
184         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
185             ${DESTDIR}/var/log/lpd-errs
186         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
187             ${DESTDIR}/var/log/maillog
188         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
189             ${DESTDIR}/var/log/lastlog
190         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
191             ${DESTDIR}/var/log/messages
192         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
193             ${DESTDIR}/var/log/security
194         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
195             ${DESTDIR}/var/log/slip.log
196         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
197             ${DESTDIR}/var/log/ppp.log
198         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
199             ${DESTDIR}/var/log/wtmp
200         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
201             ${DESTDIR}/var/run/utmp
202         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
203             ${DESTDIR}/var/crash
204         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
205             ${FREEBSD} ${DESTDIR}/
206 .if !defined(NOMAN)
207         cd ${.CURDIR}/../share/man; ${MAKE} makedb
208 .endif
209
210 distrib-dirs:
211         -set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.deprecated`; \
212         while [ $$# -gt 0 ] ; \
213         do \
214                 for dir in /usr/share/locale \
215                            /usr/share/nls \
216                            /usr/local/share/nls; \
217                 do \
218                         test -d ${DESTDIR}/$${dir} && cd ${DESTDIR}/$${dir}; \
219                         test -L "$$2" && rm -rf "$$2"; \
220                         test \! -L "$$1" && test -d "$$1" && mv "$$1" "$$2"; \
221                 done; \
222                 shift; shift; \
223         done
224         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
225         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
226         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
227         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
228                 -p ${DESTDIR}/usr/include
229         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
230                 -p ${DESTDIR}/usr/libdata/perl/5.00503/mach
231 .if !defined(NO_SENDMAIL)
232         mtree -deU -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
233 .endif
234         cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
235         cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
236         cd ${DESTDIR}/usr/share/man; \
237         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
238         while [ $$# -gt 0 ] ; \
239         do \
240                 rm -rf "$$1"; \
241                 ln -s "$$2" "$$1"; \
242                 shift; shift; \
243         done
244         cd ${DESTDIR}/usr/share/locale; \
245         set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.alias`; \
246         while [ $$# -gt 0 ] ; \
247         do \
248                 rm -rf "$$1"; \
249                 ln -s "$$2" "$$1"; \
250                 shift; shift; \
251         done
252         cd ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1; ln -sf ../man* .
253         cd ${DESTDIR}/usr/share/nls; \
254         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
255         while [ $$# -gt 0 ] ; \
256         do \
257                 rm -rf "$$1"; \
258                 ln -s "$$2" "$$1"; \
259                 shift; shift; \
260         done
261
262 etc-examples:
263         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
264             ${BIN1} ${BIN2} nsmb.conf opieaccess \
265             ${DESTDIR}/usr/share/examples/etc
266         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
267             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
268
269 .include <bsd.prog.mk>