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= crontab \ 16 devd.conf \ 17 devfs.conf \ 18 ddb.conf \ 19 dhclient.conf \ 20 disktab \ 21 fbtab \ 22 gettytab \ 23 group \ 24 hosts \ 25 hosts.allow \ 26 hosts.equiv \ 27 libalias.conf \ 28 libmap.conf \ 29 login.access \ 30 login.conf \ 31 mac.conf \ 32 motd \ 33 netconfig \ 34 network.subr \ 35 networks \ 36 newsyslog.conf \ 37 nsswitch.conf \ 38 phones \ 39 profile \ 40 protocols \ 41 rc \ 42 rc.bsdextended \ 43 rc.firewall \ 44 rc.initdiskless \ 45 rc.shutdown \ 46 rc.subr \ 47 remote \ 48 rpc \ 49 services \ 50 shells \ 51 sysctl.conf \ 52 syslog.conf \ 53 termcap.small 54 55.if exists(${.CURDIR}/etc.${MACHINE}/ttys) 56BIN1+= etc.${MACHINE}/ttys 57.elif exists(${.CURDIR}/etc.${MACHINE_ARCH}/ttys) 58BIN1+= etc.${MACHINE_ARCH}/ttys 59.elif exists(${.CURDIR}/etc.${MACHINE_CPUARCH}/ttys) 60BIN1+= etc.${MACHINE_CPUARCH}/ttys 61.else 62.error etc.MACHINE/ttys missing 63.endif 64 65OPENBSMDIR= ${SRCTOP}/contrib/openbsm 66BSM_ETC_OPEN_FILES= ${OPENBSMDIR}/etc/audit_class \ 67 ${OPENBSMDIR}/etc/audit_event 68BSM_ETC_RESTRICTED_FILES= ${OPENBSMDIR}/etc/audit_control \ 69 ${OPENBSMDIR}/etc/audit_user 70BSM_ETC_EXEC_FILES= ${OPENBSMDIR}/etc/audit_warn 71BSM_ETC_DIR= ${DESTDIR}/etc/security 72 73# NB: keep these sorted by MK_* knobs 74 75.if ${MK_AMD} != "no" 76BIN1+= amd.map 77.endif 78 79.if ${MK_APM} != "no" 80BIN1+= apmd.conf 81.endif 82 83.if ${MK_AUTOFS} != "no" 84BIN1+= auto_master 85.endif 86 87.if ${MK_BLACKLIST} != "no" 88BIN1+= blacklistd.conf 89.endif 90 91.if ${MK_FREEBSD_UPDATE} != "no" 92BIN1+= freebsd-update.conf 93.endif 94 95.if ${MK_FTP} != "no" 96BIN1+= ftpusers 97.endif 98 99.if ${MK_INETD} != "no" 100BIN1+= inetd.conf 101.endif 102 103.if ${MK_LOCATE} != "no" 104BIN1+= ${SRCTOP}/usr.bin/locate/locate/locate.rc 105.endif 106 107.if ${MK_LPR} != "no" 108BIN1+= hosts.lpd printcap 109.endif 110 111.if ${MK_MAIL} != "no" 112BIN1+= ${SRCTOP}/usr.bin/mail/misc/mail.rc 113.endif 114 115.if ${MK_NTP} != "no" 116BIN1+= ntp.conf 117.endif 118 119.if ${MK_OPENSSH} != "no" 120SSH= ${SRCTOP}/crypto/openssh/ssh_config \ 121 ${SRCTOP}/crypto/openssh/sshd_config \ 122 ${SRCTOP}/crypto/openssh/moduli 123.endif 124.if ${MK_OPENSSL} != "no" 125SSL= ${SRCTOP}/crypto/openssl/apps/openssl.cnf 126.endif 127 128.if ${MK_NS_CACHING} != "no" 129BIN1+= nscd.conf 130.endif 131 132.if ${MK_PORTSNAP} != "no" 133BIN1+= portsnap.conf 134.endif 135 136.if ${MK_PF} != "no" 137BIN1+= pf.os 138.endif 139 140.if ${MK_SENDMAIL} != "no" 141BIN1+= rc.sendmail 142.endif 143 144.if ${MK_TCSH} != "no" 145BIN1+= csh.cshrc csh.login csh.logout 146.endif 147 148.if ${MK_WIRELESS} != "no" 149BIN1+= regdomain.xml 150.endif 151 152# -rwxr-xr-x root:wheel, for the new cron root:wheel 153BIN2= netstart pccard_ether rc.suspend rc.resume 154 155.if ${MK_SENDMAIL} == "no" 156ETCMAIL=mailer.conf aliases 157.else 158ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \ 159 mailertable.sample aliases 160.endif 161 162# Special top level files for FreeBSD 163FREEBSD=COPYRIGHT 164 165# Sanitize DESTDIR 166DESTDIR:= ${DESTDIR:C://*:/:g} 167 168afterinstall: 169.if ${MK_MAN} != "no" 170 ${_+_}cd ${SRCTOP}/share/man; ${MAKE} makedb 171.endif 172 173distribute: 174 # Avoid installing tests here; "make distribution" will do this and 175 # correctly place them in the right location. 176 ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \ 177 DESTDIR=${DISTDIR}/${DISTRIBUTION} 178 ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION} 179 180.include <bsd.endian.mk> 181.if ${TARGET_ENDIANNESS} == "1234" 182CAP_MKDB_ENDIAN?= -l 183.elif ${TARGET_ENDIANNESS} == "4321" 184CAP_MKDB_ENDIAN?= -b 185.else 186CAP_MKDB_ENDIAN?= 187.endif 188 189.if defined(NO_ROOT) 190METALOG.add?= cat -l >> ${METALOG} 191.endif 192 193distribution: 194.if !defined(DESTDIR) 195 @echo "set DESTDIR before running \"make ${.TARGET}\"" 196 @false 197.endif 198 cd ${.CURDIR}; \ 199 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 200 ${BIN1} ${DESTDIR}/etc; \ 201 cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \ 202 services_mkdb ${CAP_MKDB_ENDIAN} -q -o ${DESTDIR}/var/db/services.db \ 203 ${DESTDIR}/etc/services; \ 204 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \ 205 ${BIN2} ${DESTDIR}/etc; \ 206 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \ 207 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; 208.if ${MK_BSNMP} != "no" 209 cd ${.CURDIR}; \ 210 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \ 211 snmpd.config ${DESTDIR}/etc; 212.endif 213.if ${MK_TCSH} == "no" 214 sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd 215.endif 216 pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd 217.if defined(NO_ROOT) 218 ( \ 219 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \ 220 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \ 221 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \ 222 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \ 223 ) | ${METALOG.add} 224.endif 225.if ${MK_AUTOFS} != "no" 226 ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install 227.endif 228.if ${MK_BLUETOOTH} != "no" 229 ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install 230.endif 231 ${_+_}cd ${.CURDIR}/cron.d; ${MAKE} install 232 ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install 233 ${_+_}cd ${.CURDIR}/devd; ${MAKE} install 234 ${_+_}cd ${.CURDIR}/gss; ${MAKE} install 235 ${_+_}cd ${.CURDIR}/mtree; ${MAKE} install 236 ${_+_}cd ${.CURDIR}/newsyslog.conf.d; ${MAKE} install 237.if ${MK_NTP} != "no" 238 ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install 239.endif 240 ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install 241.if ${MK_PKGBOOTSTRAP} != "no" 242 ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install 243.endif 244 ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install 245 ${_+_}cd ${SRCTOP}/share/termcap; ${MAKE} etc-termcap 246 ${_+_}cd ${.CURDIR}/syslog.d; ${MAKE} install 247 ${_+_}cd ${SRCTOP}/usr.sbin/rmt; ${MAKE} etc-rmt 248 ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install 249 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \ 250 ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR} 251 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \ 252 ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR} 253 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \ 254 ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR} 255.if ${MK_UNBOUND} != "no" 256 if [ ! -e ${DESTDIR}/etc/unbound ]; then \ 257 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \ 258 fi 259.endif 260.if ${MK_SENDMAIL} != "no" 261 ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution 262.endif 263.if ${MK_OPENSSH} != "no" 264 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 265 ${SSH} ${DESTDIR}/etc/ssh 266.endif 267.if ${MK_OPENSSL} != "no" 268 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 269 ${SSL} ${DESTDIR}/etc/ssl 270.endif 271.if ${MK_KERBEROS} != "no" 272 cd ${.CURDIR}/root; \ 273 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 274 dot.k5login ${DESTDIR}/root/.k5login; 275.endif 276 cd ${.CURDIR}/root; \ 277 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 278 dot.profile ${DESTDIR}/root/.profile; \ 279 rm -f ${DESTDIR}/.profile; \ 280 ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile 281.if ${MK_TCSH} != "no" 282 cd ${.CURDIR}/root; \ 283 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 284 dot.cshrc ${DESTDIR}/root/.cshrc; \ 285 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 286 dot.login ${DESTDIR}/root/.login; \ 287 rm -f ${DESTDIR}/.cshrc; \ 288 ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc 289.endif 290.if ${MK_MAIL} != "no" 291 cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 292 ${ETCMAIL} ${DESTDIR}/etc/mail 293 if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \ 294 ! -f ${DESTDIR}/etc/aliases ]; then \ 295 ln -s mail/aliases ${DESTDIR}/etc/aliases; \ 296 fi 297.endif 298 ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \ 299 ${DESTDIR}/etc/dumpdates 300.if ${MK_LOCATE} != "no" 301 ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \ 302 ${DESTDIR}/var/db/locate.database 303.endif 304 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \ 305 ${DESTDIR}/var/crash 306 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 307 ${FREEBSD} ${DESTDIR}/ 308.if ${MK_BOOT} != "no" 309.if exists(${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints) 310 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 311 ${SRCTOP}/sys/${MACHINE}/conf/GENERIC.hints \ 312 ${DESTDIR}/boot/device.hints 313.endif 314.endif 315.if ${MK_NIS} == "no" 316 sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \ 317 ${DESTDIR}/etc/nsswitch.conf 318.endif 319 320MTREE_CMD?= mtree 321 322MTREES= mtree/BSD.root.dist / \ 323 mtree/BSD.var.dist /var \ 324 mtree/BSD.usr.dist /usr \ 325 mtree/BSD.include.dist /usr/include \ 326 mtree/BSD.debug.dist /usr/lib 327.if ${MK_LIB32} != "no" 328MTREES+= mtree/BSD.lib32.dist /usr 329MTREES+= mtree/BSD.lib32.dist /usr/lib/debug/usr 330.endif 331.if ${MK_LIBSOFT} != "no" 332MTREES+= mtree/BSD.libsoft.dist /usr 333MTREES+= mtree/BSD.libsoft.dist /usr/lib/debug/usr 334.endif 335.if ${MK_TESTS} != "no" 336MTREES+= mtree/BSD.tests.dist ${TESTSBASE} 337MTREES+= mtree/BSD.tests.dist /usr/lib/debug/${TESTSBASE} 338.endif 339.if ${MK_SENDMAIL} != "no" 340MTREES+= mtree/BSD.sendmail.dist / 341.endif 342.for mtree in ${LOCAL_MTREE} 343MTREES+= ../${mtree} / 344.endfor 345 346# Clean up some directories that where mistakenly created as files that 347# should not have been as part of the nvi update in r281994. 348# This should be removed after 11.0-RELEASE. 349DISTRIB_CLEANUP_SHARE_FILES= ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit 350DISTRIB_CLEANUP_SHARE_FILES+= ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref 351distrib-cleanup: .PHONY 352 for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \ 353 if [ -f ${DESTDIR}/$${file} ]; then \ 354 rm -f ${DESTDIR}/$${file}; \ 355 fi; \ 356 done 357 358distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY 359 @set ${MTREES}; \ 360 while test $$# -ge 2; do \ 361 m=${.CURDIR}/$$1; \ 362 shift; \ 363 d=${DESTDIR}$$1; \ 364 shift; \ 365 test -d $$d || mkdir -p $$d; \ 366 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \ 367 ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ 368 ${MTREE_FILTER} $$m | \ 369 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \ 370 -p $$d; \ 371 done; true 372.if defined(NO_ROOT) 373 @set ${MTREES}; \ 374 while test $$# -ge 2; do \ 375 m=${.CURDIR}/$$1; \ 376 shift; \ 377 d=$$1; \ 378 test "$$d" == "/" && d=""; \ 379 d=${DISTBASE}$$d; \ 380 shift; \ 381 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ 382 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K all | " \ 383 "sed s#^\.#.$$d# | ${METALOG.add}" ; \ 384 ${MTREE_FILTER} $$m | \ 385 ${MTREE_CMD:N-W} -C -K all | sed s#^\.#.$$d# | \ 386 ${METALOG.add} ; \ 387 done; true 388.endif 389 ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys 390.if ${MK_NLS} != "no" 391 set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \ 392 while [ $$# -gt 0 ] ; do \ 393 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \ 394 shift; shift; \ 395 done 396.endif 397 398etc-examples-install: ${META_DEPS} 399 cd ${.CURDIR}; ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 \ 400 ${BIN1} ${BIN2} nsmb.conf opieaccess \ 401 ${DESTDIR}${SHAREDIR}/examples/etc 402 403etc-examples: etc-examples-install 404 ${_+_}cd ${.CURDIR}/defaults; \ 405 ${MAKE} ${${MK_STAGING} == "yes":?all:install} \ 406 DESTDIR=${DESTDIR}${SHAREDIR}/examples 407 408.include <bsd.prog.mk> 409 410.if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0 411MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \ 412 -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \ 413 -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \ 414 -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \ 415 -e 's,\(gid=\)[^ ]*$$,\1${_gid},' 416.else 417MTREE_FILTER= cat 418.if !defined(NO_FSCHG) 419MTREE_FSCHG= -i 420.endif 421.endif 422