1# from: @(#)Makefile 5.11 (Berkeley) 5/21/91 2# $FreeBSD$ 3 4.include <src.opts.mk> 5 6FILESGROUPS= FILES 7 8# No need as it is empty and just causes rebuilds since this file does so much. 9UPDATE_DEPENDFILE= no 10 11.if ${MK_SENDMAIL} != "no" 12SUBDIR+=sendmail 13.endif 14 15BIN1= \ 16 group \ 17 login.access \ 18 rc.bsdextended \ 19 rc.firewall \ 20 termcap.small 21 22# NB: keep these sorted by MK_* knobs 23 24.if ${MK_SENDMAIL} != "no" 25BIN1+= rc.sendmail 26.endif 27 28.if ${MK_SENDMAIL} == "no" 29ETCMAIL=mailer.conf aliases 30.else 31ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \ 32 mailertable.sample aliases 33.endif 34 35# Special top level files for FreeBSD 36FREEBSD=COPYRIGHT 37 38# Sanitize DESTDIR 39DESTDIR:= ${DESTDIR:C://*:/:g} 40 41afterinstall: 42.if ${MK_MAN} != "no" 43 ${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb 44.endif 45 46distribute: 47 # Avoid installing tests here; "make distribution" will do this and 48 # correctly place them in the right location. 49 ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \ 50 DESTDIR=${DISTDIR}/${DISTRIBUTION} 51 ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION} 52 53.include <bsd.endian.mk> 54 55.if defined(NO_ROOT) 56METALOG.add?= cat -l >> ${METALOG} 57.endif 58 59distribution: 60.if !defined(DESTDIR) 61 @echo "set DESTDIR before running \"make ${.TARGET}\"" 62 @false 63.endif 64 cd ${.CURDIR}; \ 65 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 66 ${BIN1} ${DESTDIR}/etc; \ 67 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \ 68 master.passwd ${DESTDIR}/etc; 69 70.if ${MK_TCSH} == "no" 71 sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd 72.endif 73 pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd 74.if defined(NO_ROOT) 75 ( \ 76 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \ 77 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \ 78 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \ 79 ) | ${METALOG.add} 80.endif 81 ${_+_}cd ${.CURDIR}/gss; ${MAKE} install 82 ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install 83 ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap 84 ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt 85.if ${MK_UNBOUND} != "no" 86 if [ ! -e ${DESTDIR}/etc/unbound ]; then \ 87 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \ 88 fi 89.endif 90.if ${MK_SENDMAIL} != "no" 91 ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution 92.endif 93.if ${MK_KERBEROS} != "no" 94 cd ${.CURDIR}/root; \ 95 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 96 dot.k5login ${DESTDIR}/root/.k5login; 97.endif 98 99.if ${MK_MAIL} != "no" 100 cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 101 ${ETCMAIL} ${DESTDIR}/etc/mail 102 if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \ 103 ! -f ${DESTDIR}/etc/aliases ]; then \ 104 ${INSTALL_SYMLINK} mail/aliases ${DESTDIR}/etc/aliases; \ 105 fi 106.endif 107.if ${MK_LOCATE} != "no" 108 ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \ 109 ${DESTDIR}/var/db/locate.database 110.endif 111 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 112 ${FREEBSD} ${DESTDIR}/ 113.if ${MK_BOOT} != "no" 114.if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints) 115 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 116 ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \ 117 ${DESTDIR}/boot/device.hints 118.endif 119.endif 120 121MTREE_CMD?= mtree 122 123MTREES= mtree/BSD.root.dist / \ 124 mtree/BSD.var.dist /var \ 125 mtree/BSD.usr.dist /usr \ 126 mtree/BSD.include.dist /usr/include \ 127 mtree/BSD.debug.dist /usr/lib 128.if ${MK_LIB32} != "no" 129MTREES+= mtree/BSD.lib32.dist /usr 130MTREES+= mtree/BSD.lib32.dist /usr/lib/debug/usr 131.endif 132.if ${MK_LIBSOFT} != "no" 133MTREES+= mtree/BSD.libsoft.dist /usr 134MTREES+= mtree/BSD.libsoft.dist /usr/lib/debug/usr 135.endif 136.if ${MK_TESTS} != "no" 137MTREES+= mtree/BSD.tests.dist ${TESTSBASE} 138MTREES+= mtree/BSD.tests.dist /usr/lib/debug/${TESTSBASE} 139.endif 140.if ${MK_SENDMAIL} != "no" 141MTREES+= mtree/BSD.sendmail.dist / 142.endif 143.for mtree in ${LOCAL_MTREE} 144MTREES+= ../${mtree} / 145.endfor 146 147# Clean up some directories that where mistakenly created as files that 148# should not have been as part of the nvi update in r281994. 149# This should be removed after 11.0-RELEASE. 150DISTRIB_CLEANUP_SHARE_FILES= ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit 151DISTRIB_CLEANUP_SHARE_FILES+= ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref 152distrib-cleanup: .PHONY 153 for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \ 154 if [ -f ${DESTDIR}/$${file} ]; then \ 155 rm -f ${DESTDIR}/$${file}; \ 156 fi; \ 157 done 158 159distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY 160.for _m _d in ${MTREES} 161 @m=${.CURDIR}/${_m}; \ 162 d=${DESTDIR}${_d}; \ 163 test -d $$d || mkdir -p $$d; \ 164 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \ 165 ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ 166 ${MTREE_FILTER} $$m | \ 167 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \ 168 -p $$d 169.endfor 170.if defined(NO_ROOT) 171.for _m _d in ${MTREES} 172 @m=${.CURDIR}/${_m}; \ 173 d=${_d}; \ 174 test "$$d" == "/" && d=""; \ 175 d=${DISTBASE}$$d; \ 176 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ 177 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \ 178 "sed s#^\.#.$$d# | ${METALOG.add}" ; \ 179 ${MTREE_FILTER} $$m | \ 180 ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \ 181 ${METALOG.add} 182.endfor 183.endif 184.if ${MK_NLS} != "no" 185 set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \ 186 while [ $$# -gt 0 ] ; do \ 187 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \ 188 shift; shift; \ 189 done 190.endif 191 192etc-examples: ${META_DEPS} 193 cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \ 194 ${BIN1} ${BIN2} \ 195 ${DESTDIR}${SHAREDIR}/examples/etc 196 197.include <bsd.prog.mk> 198 199.if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0 200MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \ 201 -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \ 202 -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \ 203 -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \ 204 -e 's,\(gid=\)[^ ]*$$,\1${_gid},' 205.else 206MTREE_FILTER= cat 207.if !defined(NO_FSCHG) 208MTREE_FSCHG= -i 209.endif 210.endif 211