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