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