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