1# from: @(#)Makefile 5.11 (Berkeley) 5/21/91 2 3.include <src.opts.mk> 4.include <src.tools.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 13.if ${MK_SENDMAIL} != "no" 14SUBDIR+=sendmail 15.endif 16 17# NB: keep these sorted by MK_* knobs 18 19ETCMAIL=aliases 20.if ${MK_SENDMAIL} != "no" 21ETCMAIL+=Makefile README access.sample virtusertable.sample \ 22 mailertable.sample 23.endif 24 25# Special top level files for FreeBSD 26FREEBSD=COPYRIGHT 27 28# Sanitize DESTDIR 29DESTDIR:= ${DESTDIR:C://*:/:g} 30 31afterinstall: 32.if ${MK_MAN} != "no" 33 ${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb 34.endif 35 36distribute: 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) 46METALOG.add?= cat -l >> ${METALOG} 47.endif 48 49distribution: 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 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 86 -T "package=runtime" ${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 -T "package=bootloader,config" \ 91 ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \ 92 ${DESTDIR}/boot/device.hints 93.endif 94.endif 95 96MTREES= mtree/BSD.root.dist / \ 97 mtree/BSD.var.dist /var \ 98 mtree/BSD.usr.dist /usr \ 99 mtree/BSD.include.dist /usr/include \ 100 mtree/BSD.debug.dist /usr/lib 101.if ${MK_LIB32} != "no" 102MTREES+= mtree/BSD.lib32.dist /usr 103MTREES+= mtree/BSD.lib32.dist /usr/lib/debug/usr 104.endif 105.if ${MK_LIBSOFT} != "no" 106MTREES+= mtree/BSD.libsoft.dist /usr 107MTREES+= mtree/BSD.libsoft.dist /usr/lib/debug/usr 108.endif 109.if ${MK_TESTS} != "no" 110MTREES+= mtree/BSD.tests.dist ${TESTSBASE} 111MTREES+= mtree/BSD.tests.dist /usr/lib/debug${TESTSBASE} 112.endif 113.if ${MK_SENDMAIL} != "no" 114MTREES+= mtree/BSD.sendmail.dist / 115.endif 116.for mtree in ${LOCAL_MTREE} 117MTREES+= ../${mtree} / 118.endfor 119 120# Clean up files that have changed into directories, as mtree cannot handle this 121# scenario. 122DISTRIB_CLEANUP_FILES+= ${INCLUDEDIR}/c++/v1/__string 123DISTRIB_CLEANUP_FILES+= ${INCLUDEDIR}/c++/v1/__tuple 124DISTRIB_CLEANUP_FILES+= ${LIBEXECDIR}/kgdb 125distrib-cleanup: .PHONY 126 for file in ${DISTRIB_CLEANUP_FILES}; do \ 127 if [ -f ${DESTDIR}/$${file} ]; then \ 128 rm -f ${DESTDIR}/$${file}; \ 129 fi; \ 130 done 131 132distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY 133.for _m _d in ${MTREES} 134 @m=${.CURDIR}/${_m}; \ 135 d=${DESTDIR}${_d}; \ 136 test -d $$d || mkdir -p $$d; \ 137 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \ 138 ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ 139 ${MTREE_FILTER} $$m | \ 140 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \ 141 -p $$d 142.endfor 143.if defined(NO_ROOT) 144.for _m _d in ${MTREES} 145 @m=${.CURDIR}/${_m}; \ 146 d=${_d}; \ 147 test "$$d" == "/" && d=""; \ 148 d=${DISTBASE}$$d; \ 149 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ 150 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \ 151 "sed s#^\.#.$$d# | ${METALOG.add}" ; \ 152 ${MTREE_FILTER} $$m | \ 153 ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \ 154 ${METALOG.add} 155.endfor 156.endif 157.if ${MK_NLS} != "no" 158.for alias nls in ${NLS_ALIASES} 159 ${INSTALL_SYMLINK} -T "package=utilities" \ 160 "${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 167MTREE_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 173MTREE_FILTER= cat 174.if !defined(NO_FSCHG) 175MTREE_FSCHG= -i 176.endif 177.endif 178