]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - etc/Makefile
Move back group, master.passwd and shells to etc directory
[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 # NB: keep these sorted by MK_* knobs
18
19 .if ${MK_SENDMAIL} == "no"
20 ETCMAIL=mailer.conf aliases
21 .else
22 ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \
23         mailertable.sample aliases
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 .if ${MK_UNBOUND} != "no"
60         if [ ! -e ${DESTDIR}/etc/unbound ]; then \
61                 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \
62         fi
63 .endif
64 .if ${MK_SENDMAIL} != "no"
65         ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution
66 .endif
67 .if ${MK_KERBEROS} != "no"
68         cd ${.CURDIR}/root; \
69             ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
70                 dot.k5login ${DESTDIR}/root/.k5login;
71 .endif
72
73 .if ${MK_MAIL} != "no"
74         cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
75             ${ETCMAIL} ${DESTDIR}/etc/mail
76         if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
77               ! -f ${DESTDIR}/etc/aliases ]; then \
78                 ${INSTALL_SYMLINK} mail/aliases ${DESTDIR}/etc/aliases; \
79         fi
80 .endif
81 .if ${MK_LOCATE} != "no"
82         ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
83             ${DESTDIR}/var/db/locate.database
84 .endif
85         cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
86                 ${FREEBSD} ${DESTDIR}/
87 .if ${MK_BOOT} != "no"
88 .if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints)
89         ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
90             ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \
91             ${DESTDIR}/boot/device.hints
92 .endif
93 .endif
94
95 MTREE_CMD?=     mtree
96
97 MTREES=         mtree/BSD.root.dist             /               \
98                 mtree/BSD.var.dist              /var            \
99                 mtree/BSD.usr.dist              /usr            \
100                 mtree/BSD.include.dist          /usr/include    \
101                 mtree/BSD.debug.dist            /usr/lib
102 .if ${MK_LIB32} != "no"
103 MTREES+=        mtree/BSD.lib32.dist            /usr
104 MTREES+=        mtree/BSD.lib32.dist            /usr/lib/debug/usr
105 .endif
106 .if ${MK_LIBSOFT} != "no"
107 MTREES+=        mtree/BSD.libsoft.dist          /usr
108 MTREES+=        mtree/BSD.libsoft.dist          /usr/lib/debug/usr
109 .endif
110 .if ${MK_TESTS} != "no"
111 MTREES+=        mtree/BSD.tests.dist            ${TESTSBASE}
112 MTREES+=        mtree/BSD.tests.dist            /usr/lib/debug/${TESTSBASE}
113 .endif
114 .if ${MK_SENDMAIL} != "no"
115 MTREES+=        mtree/BSD.sendmail.dist         /
116 .endif
117 .for mtree in ${LOCAL_MTREE}
118 MTREES+=        ../${mtree}                     /
119 .endfor
120
121 # Clean up some directories that where mistakenly created as files that
122 # should not have been as part of the nvi update in r281994.
123 # This should be removed after 11.0-RELEASE.
124 DISTRIB_CLEANUP_SHARE_FILES=    ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit
125 DISTRIB_CLEANUP_SHARE_FILES+=   ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref
126 distrib-cleanup: .PHONY
127         for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \
128                 if [ -f ${DESTDIR}/$${file} ]; then \
129                         rm -f ${DESTDIR}/$${file}; \
130                 fi; \
131         done
132
133 distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY
134 .for _m _d in ${MTREES}
135         @m=${.CURDIR}/${_m}; \
136         d=${DESTDIR}${_d}; \
137         test -d $$d || mkdir -p $$d; \
138         ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \
139             ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \
140         ${MTREE_FILTER} $$m | \
141         ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \
142             -p $$d
143 .endfor
144 .if defined(NO_ROOT)
145 .for _m _d in ${MTREES}
146         @m=${.CURDIR}/${_m}; \
147         d=${_d}; \
148         test "$$d" == "/" && d=""; \
149         d=${DISTBASE}$$d; \
150         test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \
151         ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \
152             "sed s#^\.#.$$d# | ${METALOG.add}" ; \
153         ${MTREE_FILTER} $$m | \
154         ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \
155             ${METALOG.add}
156 .endfor
157 .endif
158 .if ${MK_NLS} != "no"
159 .for alias nls in ${NLS_ALIASES}
160         ${INSTALL_SYMLINK} "${nls}" "${DESTDIR}${SHAREDIR}/nls/${alias}"
161 .endfor
162 .endif
163
164 .include <bsd.prog.mk>
165
166 .if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0
167 MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \
168         -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \
169         -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \
170         -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \
171         -e 's,\(gid=\)[^ ]*$$,\1${_gid},'
172 .else
173 MTREE_FILTER= cat
174 .if !defined(NO_FSCHG)
175 MTREE_FSCHG=    -i
176 .endif
177 .endif