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