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