1# from: @(#)Makefile 5.11 (Berkeley) 5/21/91 2# $FreeBSD$ 3 4.include <src.opts.mk> 5 6FILESGROUPS= FILES 7NLS_ALIASES= POSIX C \ 8 en_US.US_ASCII C 9PWD_MKDB_CMD?= pwd_mkdb 10 11# No need as it is empty and just causes rebuilds since this file does so much. 12UPDATE_DEPENDFILE= no 13 14.if ${MK_SENDMAIL} != "no" 15SUBDIR+=sendmail 16.endif 17 18# NB: keep these sorted by MK_* knobs 19 20.if ${MK_SENDMAIL} == "no" 21ETCMAIL=mailer.conf aliases 22.else 23ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \ 24 mailertable.sample aliases 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 DESTDIR=${DISTDIR}/${DISTRIBUTION} 43 ${_+_}cd ${.CURDIR} ; ${MAKE} 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.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=runtime" ${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=runtime" \ 82 mail/aliases ${DESTDIR}/etc/aliases; \ 83 fi 84.endif 85.if ${MK_LOCATE} != "no" 86 ${INSTALL} -o nobody -g ${BINGRP} -m 644 -T "package=runtime"\ 87 /dev/null ${DESTDIR}/var/db/locate.database 88.endif 89 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 90 -T "package=runtime" ${FREEBSD} ${DESTDIR}/ 91.if ${MK_BOOT} != "no" 92.if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints) 93 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 94 -T "package=runtime" \ 95 ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \ 96 ${DESTDIR}/boot/device.hints 97.endif 98.endif 99 100MTREE_CMD?= mtree 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.if ${MK_LIB32} != "no" 108MTREES+= mtree/BSD.lib32.dist /usr 109MTREES+= mtree/BSD.lib32.dist /usr/lib/debug/usr 110.endif 111.if ${MK_LIBSOFT} != "no" 112MTREES+= mtree/BSD.libsoft.dist /usr 113MTREES+= mtree/BSD.libsoft.dist /usr/lib/debug/usr 114.endif 115.if ${MK_TESTS} != "no" 116MTREES+= mtree/BSD.tests.dist ${TESTSBASE} 117MTREES+= mtree/BSD.tests.dist /usr/lib/debug/${TESTSBASE} 118.endif 119.if ${MK_SENDMAIL} != "no" 120MTREES+= mtree/BSD.sendmail.dist / 121.endif 122.for mtree in ${LOCAL_MTREE} 123MTREES+= ../${mtree} / 124.endfor 125 126# Clean up some directories that where mistakenly created as files that 127# should not have been as part of the nvi update in r281994. 128# This should be removed after 11.0-RELEASE. 129DISTRIB_CLEANUP_SHARE_FILES= ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit 130DISTRIB_CLEANUP_SHARE_FILES+= ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref 131distrib-cleanup: .PHONY 132 for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \ 133 if [ -f ${DESTDIR}/$${file} ]; then \ 134 rm -f ${DESTDIR}/$${file}; \ 135 fi; \ 136 done 137 138distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY 139.for _m _d in ${MTREES} 140 @m=${.CURDIR}/${_m}; \ 141 d=${DESTDIR}${_d}; \ 142 test -d $$d || mkdir -p $$d; \ 143 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \ 144 ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ 145 ${MTREE_FILTER} $$m | \ 146 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \ 147 -p $$d 148.endfor 149.if defined(NO_ROOT) 150.for _m _d in ${MTREES} 151 @m=${.CURDIR}/${_m}; \ 152 d=${_d}; \ 153 test "$$d" == "/" && d=""; \ 154 d=${DISTBASE}$$d; \ 155 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ 156 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \ 157 "sed s#^\.#.$$d# | ${METALOG.add}" ; \ 158 ${MTREE_FILTER} $$m | \ 159 ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \ 160 ${METALOG.add} 161.endfor 162.endif 163.if ${MK_NLS} != "no" 164.for alias nls in ${NLS_ALIASES} 165 ${INSTALL_SYMLINK} "${nls}" "${DESTDIR}${SHAREDIR}/nls/${alias}" 166.endfor 167.endif 168 169.include <bsd.prog.mk> 170 171.if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0 172MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \ 173 -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \ 174 -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \ 175 -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \ 176 -e 's,\(gid=\)[^ ]*$$,\1${_gid},' 177.else 178MTREE_FILTER= cat 179.if !defined(NO_FSCHG) 180MTREE_FSCHG= -i 181.endif 182.endif 183