]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
shmfd: hide direct rangelock(9) use under a wrapper
[FreeBSD/FreeBSD.git] / etc / Makefile
1 #       from: @(#)Makefile      5.11 (Berkeley) 5/21/91
2
3 .include <src.opts.mk>
4 .include <src.tools.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 # NB: keep these sorted by MK_* knobs
18
19 ETCMAIL=aliases
20 .if ${MK_SENDMAIL} != "no"
21 ETCMAIL+=Makefile README access.sample virtusertable.sample \
22         mailertable.sample
23 .endif
24
25 # Special top level files for FreeBSD
26 FREEBSD=COPYRIGHT
27
28 # Sanitize DESTDIR
29 DESTDIR:=       ${DESTDIR:C://*:/:g}
30
31 afterinstall:
32 .if ${MK_MAN} != "no"
33         ${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb
34 .endif
35
36 distribute:
37         # Avoid installing tests here; "make distribution" will do this and
38         # correctly place them in the right location.
39         ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \
40             DESTDIR=${DISTDIR}/${DISTRIBUTION}
41         ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION}
42
43 .include <bsd.endian.mk>
44
45 .if defined(NO_ROOT)
46 METALOG.add?=   cat -l >> ${METALOG}
47 .endif
48
49 distribution:
50 .if !defined(DESTDIR)
51         @echo "set DESTDIR before running \"make ${.TARGET}\""
52         @false
53 .endif
54         ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
55         ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install
56         ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap
57         ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt
58         ${INSTALL_SYMLINK} -T "package=runtime" ../var/run/os-release \
59                 ${DESTDIR}/etc/os-release
60 .if ${MK_UNBOUND} != "no"
61         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
62                 ${INSTALL_SYMLINK} -T "package=unbound" \
63                 ../var/unbound ${DESTDIR}/etc/unbound; \
64         fi
65 .endif
66 .if ${MK_SENDMAIL} != "no"
67         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
68 .endif
69 .if ${MK_KERBEROS} != "no"
70         cd ${.CURDIR}/root; \
71             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
72                 -T "package=runtime" \
73                 dot.k5login ${DESTDIR}/root/.k5login;
74 .endif
75
76 .if ${MK_MAIL} != "no"
77         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
78             -T "package=sendmail" ${ETCMAIL} ${DESTDIR}/etc/mail
79         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
80               ! -f ${DESTDIR}/etc/aliases ]; then \
81                 ${INSTALL_SYMLINK} -T "package=sendmail" \
82                 mail/aliases ${DESTDIR}/etc/aliases; \
83         fi
84 .endif
85 .if ${MK_LOCATE} != "no"
86         ${INSTALL} -o nobody -g ${BINGRP} -m 644 -T "package=runtime"\
87             /dev/null ${DESTDIR}/var/db/locate.database
88 .endif
89         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
90                 -T "package=runtime" ${FREEBSD} ${DESTDIR}/
91 .if ${MK_BOOT} != "no"
92 .if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints)
93         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
94             -T "package=bootloader,config" \
95             ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \
96             ${DESTDIR}/boot/device.hints
97 .endif
98 .endif
99
100 MTREES=         mtree/BSD.root.dist             /               \
101                 mtree/BSD.var.dist              /var            \
102                 mtree/BSD.usr.dist              /usr            \
103                 mtree/BSD.include.dist          /usr/include    \
104                 mtree/BSD.debug.dist            /usr/lib
105 .if ${MK_LIB32} != "no"
106 MTREES+=        mtree/BSD.lib32.dist            /usr
107 MTREES+=        mtree/BSD.lib32.dist            /usr/lib/debug/usr
108 .endif
109 .if ${MK_LIBSOFT} != "no"
110 MTREES+=        mtree/BSD.libsoft.dist          /usr
111 MTREES+=        mtree/BSD.libsoft.dist          /usr/lib/debug/usr
112 .endif
113 .if ${MK_TESTS} != "no"
114 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
115 MTREES+=        mtree/BSD.tests.dist            /usr/lib/debug/${TESTSBASE}
116 .endif
117 .if ${MK_SENDMAIL} != "no"
118 MTREES+=        mtree/BSD.sendmail.dist         /
119 .endif
120 .for mtree in ${LOCAL_MTREE}
121 MTREES+=        ../${mtree}                     /
122 .endfor
123
124 # Clean up files that have changed into directories, as mtree cannot handle this
125 # scenario.
126 DISTRIB_CLEANUP_FILES+= ${INCLUDEDIR}/c++/v1/__string
127 distrib-cleanup: .PHONY
128         for file in ${DISTRIB_CLEANUP_FILES}; do \
129                 if [ -f ${DESTDIR}/$${file} ]; then \
130                         rm -f ${DESTDIR}/$${file}; \
131                 fi; \
132         done
133
134 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
135 .for _m _d in ${MTREES}
136         @m=${.CURDIR}/${_m}; \
137         d=${DESTDIR}${_d}; \
138         test -d $$d || mkdir -p $$d; \
139         ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
140             ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
141         ${MTREE_FILTER} $$m | \
142         ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
143             -p $$d
144 .endfor
145 .if defined(NO_ROOT)
146 .for _m _d in ${MTREES}
147         @m=${.CURDIR}/${_m}; \
148         d=${_d}; \
149         test "$$d" == "/" && d=""; \
150         d=${DISTBASE}$$d; \
151         test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
152         ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
153             "sed s#^\.#.$$d# | ${METALOG.add}" ; \
154         ${MTREE_FILTER} $$m | \
155         ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
156             ${METALOG.add}
157 .endfor
158 .endif
159 .if ${MK_NLS} != "no"
160 .for alias nls in ${NLS_ALIASES}
161         ${INSTALL_SYMLINK} -T "package=utilities" \
162             "${nls}" "${DESTDIR}${SHAREDIR}/nls/${alias}"
163 .endfor
164 .endif
165
166 .include <bsd.prog.mk>
167
168 .if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
169 MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
170         -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
171         -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
172         -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
173         -e 's,\(gid=\)[^ ]*$$,\1${_gid},'
174 .else
175 MTREE_FILTER= cat
176 .if !defined(NO_FSCHG)
177 MTREE_FSCHG=    -i
178 .endif
179 .endif