]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
Move opieaccess to lib/libopie/
[FreeBSD/FreeBSD.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2 # $FreeBSD$
3
4 .include <src.opts.mk>
5
6 FILESGROUPS=    FILES
7
8 # No need as it is empty and just causes rebuilds since this file does so much.
9 UPDATE_DEPENDFILE=      no
10
11 .if ${MK_SENDMAIL} != "no"
12 SUBDIR+=sendmail
13 .endif
14
15 BIN1=   \
16         group \
17         hosts.allow \
18         login.access \
19         rc.bsdextended \
20         rc.firewall \
21         termcap.small
22
23 # NB: keep these sorted by MK_* knobs
24
25 .if ${MK_OPENSSL} != "no"
26 SSL=    ${SRCTOP}/crypto/openssl/apps/openssl.cnf
27 .endif
28
29 .if ${MK_SENDMAIL} != "no"
30 BIN1+=  rc.sendmail
31 .endif
32
33 .if ${MK_SENDMAIL} == "no"
34 ETCMAIL=mailer.conf aliases
35 .else
36 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
37         mailertable.sample aliases
38 .endif
39
40 # Special top level files for FreeBSD
41 FREEBSD=COPYRIGHT
42
43 # Sanitize DESTDIR
44 DESTDIR:=       ${DESTDIR:C://*:/:g}
45
46 afterinstall:
47 .if ${MK_MAN} != "no"
48         ${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb
49 .endif
50
51 distribute:
52         # Avoid installing tests here; "make distribution" will do this and
53         # correctly place them in the right location.
54         ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
55             DESTDIR=${DISTDIR}/${DISTRIBUTION}
56         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
57
58 .include <bsd.endian.mk>
59
60 .if defined(NO_ROOT)
61 METALOG.add?=   cat -l >> ${METALOG}
62 .endif
63
64 distribution:
65 .if !defined(DESTDIR)
66         @echo "set DESTDIR before running \"make ${.TARGET}\""
67         @false
68 .endif
69         cd ${.CURDIR}; \
70             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
71                 ${BIN1} ${DESTDIR}/etc; \
72             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
73                 master.passwd nsmb.conf ${DESTDIR}/etc;
74
75 .if ${MK_TCSH} == "no"
76         sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd
77 .endif
78         pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
79 .if defined(NO_ROOT)
80         ( \
81                 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
82                 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
83                 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
84         ) | ${METALOG.add}
85 .endif
86         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
87         ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
88         ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
89         ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
90 .if ${MK_UNBOUND} != "no"
91         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
92                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
93         fi
94 .endif
95 .if ${MK_SENDMAIL} != "no"
96         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
97 .endif
98 .if ${MK_OPENSSL} != "no"
99         cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
100             ${SSL} ${DESTDIR}/etc/ssl
101 .endif
102 .if ${MK_KERBEROS} != "no"
103         cd ${.CURDIR}/root; \
104             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
105                 dot.k5login ${DESTDIR}/root/.k5login;
106 .endif
107
108 .if ${MK_MAIL} != "no"
109         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
110             ${ETCMAIL} ${DESTDIR}/etc/mail
111         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
112               ! -f ${DESTDIR}/etc/aliases ]; then \
113                 ${INSTALL_SYMLINK} mail/aliases ${DESTDIR}/etc/aliases; \
114         fi
115 .endif
116 .if ${MK_LOCATE} != "no"
117         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
118             ${DESTDIR}/var/db/locate.database
119 .endif
120         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
121                 ${FREEBSD} ${DESTDIR}/
122 .if ${MK_BOOT} != "no"
123 .if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints)
124         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
125             ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \
126             ${DESTDIR}/boot/device.hints
127 .endif
128 .endif
129
130 MTREE_CMD?=     mtree
131
132 MTREES=         mtree/BSD.root.dist             /               \
133                 mtree/BSD.var.dist              /var            \
134                 mtree/BSD.usr.dist              /usr            \
135                 mtree/BSD.include.dist          /usr/include    \
136                 mtree/BSD.debug.dist            /usr/lib
137 .if ${MK_LIB32} != "no"
138 MTREES+=        mtree/BSD.lib32.dist            /usr
139 MTREES+=        mtree/BSD.lib32.dist            /usr/lib/debug/usr
140 .endif
141 .if ${MK_LIBSOFT} != "no"
142 MTREES+=        mtree/BSD.libsoft.dist          /usr
143 MTREES+=        mtree/BSD.libsoft.dist          /usr/lib/debug/usr
144 .endif
145 .if ${MK_TESTS} != "no"
146 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
147 MTREES+=        mtree/BSD.tests.dist            /usr/lib/debug/${TESTSBASE}
148 .endif
149 .if ${MK_SENDMAIL} != "no"
150 MTREES+=        mtree/BSD.sendmail.dist         /
151 .endif
152 .for mtree in ${LOCAL_MTREE}
153 MTREES+=        ../${mtree}                     /
154 .endfor
155
156 # Clean up some directories that where mistakenly created as files that
157 # should not have been as part of the nvi update in r281994.
158 # This should be removed after 11.0-RELEASE.
159 DISTRIB_CLEANUP_SHARE_FILES=    ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit
160 DISTRIB_CLEANUP_SHARE_FILES+=   ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref
161 distrib-cleanup: .PHONY
162         for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \
163                 if [ -f ${DESTDIR}/$${file} ]; then \
164                         rm -f ${DESTDIR}/$${file}; \
165                 fi; \
166         done
167
168 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
169         @set ${MTREES}; \
170         while test $$# -ge 2; do \
171                 m=${.CURDIR}/$$1; \
172                 shift; \
173                 d=${DESTDIR}$$1; \
174                 shift; \
175                 test -d $$d || mkdir -p $$d; \
176                 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
177                     ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
178                 ${MTREE_FILTER} $$m | \
179                 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
180                     -p $$d; \
181         done; true
182 .if defined(NO_ROOT)
183         @set ${MTREES}; \
184         while test $$# -ge 2; do \
185                 m=${.CURDIR}/$$1; \
186                 shift; \
187                 d=$$1; \
188                 test "$$d" == "/" && d=""; \
189                 d=${DISTBASE}$$d; \
190                 shift; \
191                 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
192                 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
193                     "sed s#^\.#.$$d# | ${METALOG.add}" ; \
194                 ${MTREE_FILTER} $$m | \
195                 ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
196                     ${METALOG.add} ; \
197         done; true
198 .endif
199 .if ${MK_NLS} != "no"
200         set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
201         while [ $$# -gt 0 ] ; do \
202                 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \
203                 shift; shift; \
204         done
205 .endif
206
207 etc-examples: ${META_DEPS}
208         cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \
209             ${BIN1} ${BIN2} nsmb.conf \
210             ${DESTDIR}${SHAREDIR}/examples/etc
211
212 .include <bsd.prog.mk>
213
214 .if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
215 MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
216         -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
217         -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
218         -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
219         -e 's,\(gid=\)[^ ]*$$,\1${_gid},'
220 .else
221 MTREE_FILTER= cat
222 .if !defined(NO_FSCHG)
223 MTREE_FSCHG=    -i
224 .endif
225 .endif