Merge from vendor branch GCC:
[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.22 2004/06/16 01:06:42 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 getroot README
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
65 upgrade_etc:
66         cd ${.CURDIR}/../share/mk; ${MAKE} install
67         cd ${.CURDIR}; \
68             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
69                 ${BINUPDATE} ${DESTDIR}/etc; \
70             cap_mkdb ${DESTDIR}/etc/login.conf; \
71             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
72                 ${BIN2} ${DESTDIR}/etc;
73         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
74             ${DEFAULTS} ${DESTDIR}/etc/defaults
75         cd ${.CURDIR}/periodic; ${MAKE} install
76         cd ${.CURDIR}/rc.d; ${MAKE} install 
77         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
78         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
79 .if !defined(NO_I4B)
80         cd ${.CURDIR}/isdn; ${MAKE} install
81 .endif
82 .if !defined(NO_MAKEDEV)
83         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
84             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
85 .if !defined(NO_MAKEDEV_RUN)
86         cd ${DESTDIR}/dev; sh MAKEDEV all
87 .endif
88 .endif
89         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
90             ${MTREE} ${DESTDIR}/etc/mtree
91         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
92             ${FREEBSD} ${DESTDIR}/
93 .if !defined(NOMAN)
94         cd ${.CURDIR}/../share/man; ${MAKE} makedb
95 .endif
96         rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
97         rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
98         ln -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
99         ln -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
100 .if exists(${DESTDIR}/usr/sbin/named-checkzone)
101         rm -f ${DESTDIR}/usr/libexec/named-xfer
102         rm -f ${DESTDIR}/usr/bin/dnsquery
103         rm -f ${DESTDIR}/usr/bin/dnskeygen
104         rm -f ${DESTDIR}/usr/sbin/ndc
105 .endif
106 .if exists(${DESTDIR}/usr/lib/crtbegin.o)
107         csh -c "rm -f ${DESTDIR}/usr/lib/gcc2/{crtbegin.o,crtbeginS.o,crtend.o,crtendS.o}"
108         csh -c "rm -f ${DESTDIR}/usr/lib/gcc3/{crtbegin.o,crtbeginS.o,crtend.o,crtendS.o}"
109 .endif
110 .if exists(${DESTDIR}/usr/libexec/binutils212/elf/as)
111         ldconfig -m ${DESTDIR}/usr/lib/gcc2
112         rm -rf ${DESTDIR}/usr/libdata/ldscripts
113         rm -rf ${DESTDIR}/usr/libdata/gcc2
114         rm -rf ${DESTDIR}/usr/libdata/gcc3
115         rm -rf ${DESTDIR}/usr/libexec/elf
116         rm -rf ${DESTDIR}/usr/libexec/aout
117         rm -rf ${DESTDIR}/usr/bin/gcc2
118         rm -rf ${DESTDIR}/usr/bin/gcc3
119         rm -rf ${DESTDIR}/usr/include/g++
120         csh -c "rm -f ${DESTDIR}/usr/bin/{genassym,gensetdefs,nawk}"
121         csh -c "rm -f ${DESTDIR}/usr/share/man/{man8,cat8}/{genassym,gensetdefs}.8.gz"
122         csh -c "rm -f ${DESTDIR}/usr/share/man/{man1,cat1}/{gawk,nawk}.1.gz"
123         csh -c "rm -f ${DESTDIR}/usr/libexec/{cc1,cc1obj,cc1plus}"
124         csh -c "rm -f ${DESTDIR}/usr/libexec/{cpp,cpp0,f771,objformat}"
125         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils212/{cc1,cc1obj,cc1plus}"
126         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils212/{cpp,cpp0,f771,objformat}"
127         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils214/{cc1,cc1obj,cc1plus}"
128         csh -c "rm -f ${DESTDIR}/usr/libexec/binutils214/{cpp,cpp0,f771,objformat}"
129         csh -c "rm -f ${DESTDIR}/usr/lib/{libgcc.a,libgcc_p.a}"
130         csh -c "rm -f ${DESTDIR}/usr/lib/{libobjc.a,libobjc_p.a,libstdc++.a}"
131         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++.so,libstdc++.so.3}"
132         csh -c "rm -f ${DESTDIR}/usr/lib/{libstdc++_p.a}"
133         csh -c "rm -f ${DESTDIR}/usr/bin/CC"
134         rm -f ${DESTDIR}/usr/bin/makewhatis
135         rm -f ${DESTDIR}/usr/sbin/prebind
136         ldconfig -R
137 .endif
138
139 distribution:
140         cd ${.CURDIR}; \
141             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
142                 ${BIN1} ${DESTDIR}/etc; \
143             cap_mkdb ${DESTDIR}/etc/login.conf; \
144             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \
145                 ${BIN2} ${DESTDIR}/etc; \
146             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
147                 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
148             pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
149         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
150             ${DEFAULTS} ${DESTDIR}/etc/defaults
151         cd ${.CURDIR}/periodic; ${MAKE} install
152         cd ${.CURDIR}/rc.d; ${MAKE} install 
153         cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
154         cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
155 .if !defined(NO_I4B)
156         cd ${.CURDIR}/isdn; ${MAKE} install
157 .endif
158 .if !defined(NO_SENDMAIL)
159         cd ${.CURDIR}/sendmail; ${MAKE} obj
160         cd ${.CURDIR}/sendmail; ${MAKE} distribution
161 .endif
162 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
163 .if !defined(NO_OPENSSH)
164         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
165             ${SSH} ${DESTDIR}/etc/ssh
166 .endif
167         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
168             ${SSL} ${DESTDIR}/etc/ssl
169 .endif
170 .if !defined(NO_MAKEDEV)
171         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
172             MAKEDEV.local MAKEDEV ${DESTDIR}/dev
173 .if !defined(NO_MAKEDEV_RUN)
174         cd ${DESTDIR}/dev; sh MAKEDEV all
175 .endif
176 .endif
177         cd ${.CURDIR}/root; \
178             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
179                 dot.cshrc ${DESTDIR}/root/.cshrc; \
180             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
181                 dot.klogin ${DESTDIR}/root/.klogin; \
182             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
183                 dot.login ${DESTDIR}/root/.login; \
184             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
185                 dot.profile ${DESTDIR}/root/.profile; \
186             rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
187             ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc; \
188             ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile
189         cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
190             ${MTREE} ${DESTDIR}/etc/mtree
191         cd ${.CURDIR}/namedb; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
192             ${NAMEDB} ${DESTDIR}/etc/namedb
193         cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
194             ${PPPCNF} ${DESTDIR}/etc/ppp
195         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
196             ${ETCMAIL} ${DESTDIR}/etc/mail
197         @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
198               ! -f ${DESTDIR}/etc/aliases ]; then \
199                 set -x; \
200                 ln -s mail/aliases ${DESTDIR}/etc/aliases; \
201         fi
202         ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
203             ${DESTDIR}/etc/dumpdates
204         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
205             ${DESTDIR}/var/db/locate.database
206         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
207             ${DESTDIR}/var/log/auth.log
208         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
209             ${DESTDIR}/var/log/cron
210         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
211             ${DESTDIR}/var/log/lpd-errs
212         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
213             ${DESTDIR}/var/log/maillog
214         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
215             ${DESTDIR}/var/log/lastlog
216         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
217             ${DESTDIR}/var/log/messages
218         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
219             ${DESTDIR}/var/log/security
220         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
221             ${DESTDIR}/var/log/slip.log
222         ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
223             ${DESTDIR}/var/log/ppp.log
224         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
225             ${DESTDIR}/var/log/wtmp
226         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
227             ${DESTDIR}/var/run/utmp
228         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
229             ${DESTDIR}/var/crash
230         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
231             ${FREEBSD} ${DESTDIR}/
232 .if !defined(NOMAN)
233         cd ${.CURDIR}/../share/man; ${MAKE} makedb
234 .endif
235
236 distrib-dirs:
237         -set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.deprecated`; \
238         while [ $$# -gt 0 ] ; \
239         do \
240                 for dir in /usr/share/locale \
241                            /usr/share/nls \
242                            /usr/local/share/nls; \
243                 do \
244                         test -d ${DESTDIR}/$${dir} && cd ${DESTDIR}/$${dir}; \
245                         test -L "$$2" && rm -rf "$$2"; \
246                         test \! -L "$$1" && test -d "$$1" && mv "$$1" "$$2"; \
247                 done; \
248                 shift; shift; \
249         done
250         mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
251         mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
252         mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
253         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
254                 -p ${DESTDIR}/usr/include
255         mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
256                 -p ${DESTDIR}/usr/libdata/perl/5.00503/mach
257 .if !defined(NO_SENDMAIL)
258         mtree -deU -f ${.CURDIR}/mtree/BSD.sendmail.dist -p ${DESTDIR}/
259 .endif
260         cd ${DESTDIR}/etc/namedb; rm -f etc/namedb; ln -s ".." etc/namedb
261         cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
262         cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
263         cd ${DESTDIR}/usr/share/man; \
264         set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
265         while [ $$# -gt 0 ] ; \
266         do \
267                 rm -rf "$$1"; \
268                 ln -s "$$2" "$$1"; \
269                 shift; shift; \
270         done
271         cd ${DESTDIR}/usr/share/locale; \
272         set - `grep "^[a-zA-Z]" ${.CURDIR}/locale.alias`; \
273         while [ $$# -gt 0 ] ; \
274         do \
275                 rm -rf "$$1"; \
276                 ln -s "$$2" "$$1"; \
277                 shift; shift; \
278         done
279         cd ${DESTDIR}/usr/share/openssl/man/en.ISO8859-1; ln -sf ../man* .
280         cd ${DESTDIR}/usr/share/nls; \
281         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
282         while [ $$# -gt 0 ] ; \
283         do \
284                 rm -rf "$$1"; \
285                 ln -s "$$2" "$$1"; \
286                 shift; shift; \
287         done
288
289 etc-examples:
290         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
291             ${BIN1} ${BIN2} nsmb.conf opieaccess \
292             ${DESTDIR}/usr/share/examples/etc
293         cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
294             ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
295
296 .include <bsd.prog.mk>