1# from: @(#)Makefile 5.11 (Berkeley) 5/21/91 2# $FreeBSD$ 3 4.include <src.opts.mk> 5 6FILESGROUPS= FILES 7 8SUBDIR= \ 9 newsyslog.conf.d 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= ${.CURDIR}/../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" 84FILESGROUPS+= AUTOFS 85AUTOFS+= auto_master 86.endif 87AUTOFSDIR= /etc 88AUTOFSMODE= ${BINMODE} 89AUTOFSPACKAGE= autofs 90AUTOFSTAGS= config 91 92.if ${MK_FREEBSD_UPDATE} != "no" 93BIN1+= freebsd-update.conf 94.endif 95 96.if ${MK_FTP} != "no" 97BIN1+= ftpusers 98.endif 99 100.if ${MK_INETD} != "no" 101BIN1+= inetd.conf 102.endif 103 104.if ${MK_LOCATE} != "no" 105BIN1+= ${.CURDIR}/../usr.bin/locate/locate/locate.rc 106.endif 107 108.if ${MK_LPR} != "no" 109BIN1+= hosts.lpd printcap 110.endif 111 112.if ${MK_MAIL} != "no" 113BIN1+= ${.CURDIR}/../usr.bin/mail/misc/mail.rc 114.endif 115 116.if ${MK_NTP} != "no" 117BIN1+= ntp.conf 118.endif 119 120.if ${MK_OPENSSH} != "no" 121SSH= ${.CURDIR}/../crypto/openssh/ssh_config \ 122 ${.CURDIR}/../crypto/openssh/sshd_config \ 123 ${.CURDIR}/../crypto/openssh/moduli 124.endif 125.if ${MK_OPENSSL} != "no" 126SSL= ${.CURDIR}/../crypto/openssl/apps/openssl.cnf 127.endif 128 129.if ${MK_NS_CACHING} != "no" 130BIN1+= nscd.conf 131.endif 132 133.if ${MK_PORTSNAP} != "no" 134BIN1+= portsnap.conf 135.endif 136 137.if ${MK_PF} != "no" 138BIN1+= pf.os 139.endif 140 141.if ${MK_SENDMAIL} != "no" 142BIN1+= rc.sendmail 143.endif 144 145.if ${MK_TCSH} != "no" 146BIN1+= csh.cshrc csh.login csh.logout 147.endif 148 149.if ${MK_WIRELESS} != "no" 150BIN1+= regdomain.xml 151.endif 152 153# -rwxr-xr-x root:wheel, for the new cron root:wheel 154BIN2= netstart pccard_ether rc.suspend rc.resume 155 156MTREE= BSD.debug.dist BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist 157.if ${MK_LIB32} != "no" 158MTREE+= BSD.lib32.dist 159.endif 160.if ${MK_LIBSOFT} != "no" 161MTREE+= BSD.libsoft.dist 162.endif 163.if ${MK_TESTS} != "no" 164MTREE+= BSD.tests.dist 165.endif 166.if ${MK_SENDMAIL} != "no" 167MTREE+= BSD.sendmail.dist 168.endif 169 170PPPCNF= ppp.conf 171 172.if ${MK_SENDMAIL} == "no" 173ETCMAIL=mailer.conf aliases 174.else 175ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \ 176 mailertable.sample aliases 177.endif 178 179# Special top level files for FreeBSD 180FREEBSD=COPYRIGHT 181 182# Sanitize DESTDIR 183DESTDIR:= ${DESTDIR:C://*:/:g} 184 185afterinstall: 186.if ${MK_MAN} != "no" 187 ${_+_}cd ${.CURDIR}/../share/man; ${MAKE} makedb 188.endif 189 190distribute: 191 # Avoid installing tests here; "make distribution" will do this and 192 # correctly place them in the right location. 193 ${_+_}cd ${.CURDIR} ; ${MAKE} MK_TESTS=no install \ 194 DESTDIR=${DISTDIR}/${DISTRIBUTION} 195 ${_+_}cd ${.CURDIR} ; ${MAKE} distribution DESTDIR=${DISTDIR}/${DISTRIBUTION} 196 197.include <bsd.endian.mk> 198.if ${TARGET_ENDIANNESS} == "1234" 199CAP_MKDB_ENDIAN?= -l 200.elif ${TARGET_ENDIANNESS} == "4321" 201CAP_MKDB_ENDIAN?= -b 202.else 203CAP_MKDB_ENDIAN?= 204.endif 205 206.if defined(NO_ROOT) 207METALOG.add?= cat -l >> ${METALOG} 208.endif 209 210distribution: 211.if !defined(DESTDIR) 212 @echo "set DESTDIR before running \"make ${.TARGET}\"" 213 @false 214.endif 215 cd ${.CURDIR}; \ 216 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 217 ${BIN1} ${DESTDIR}/etc; \ 218 cap_mkdb ${CAP_MKDB_ENDIAN} ${DESTDIR}/etc/login.conf; \ 219 services_mkdb ${CAP_MKDB_ENDIAN} -q -o ${DESTDIR}/var/db/services.db \ 220 ${DESTDIR}/etc/services; \ 221 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 755 \ 222 ${BIN2} ${DESTDIR}/etc; \ 223 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \ 224 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; 225.if ${MK_BSNMP} != "no" 226 cd ${.CURDIR}; \ 227 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \ 228 snmpd.config ${DESTDIR}/etc; 229.endif 230.if ${MK_AT} == "no" 231 sed -i "" -e 's;.*/usr/libexec/atrun;#&;' ${DESTDIR}/etc/crontab 232.endif 233.if ${MK_TCSH} == "no" 234 sed -i "" -e 's;/bin/csh;/bin/sh;' ${DESTDIR}/etc/master.passwd 235.endif 236 pwd_mkdb -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd 237.if defined(NO_ROOT) 238 ( \ 239 echo "./etc/login.conf.db type=file mode=0644 uname=root gname=wheel"; \ 240 echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \ 241 echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \ 242 echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \ 243 ) | ${METALOG.add} 244.endif 245.if ${MK_AUTOFS} != "no" 246 ${_+_}cd ${.CURDIR}/autofs; ${MAKE} install 247.endif 248.if ${MK_BLUETOOTH} != "no" 249 ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install 250.endif 251.if ${MK_CASPER} != "no" 252 ${_+_}cd ${.CURDIR}/casper; ${MAKE} install 253.endif 254 ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install 255 ${_+_}cd ${.CURDIR}/devd; ${MAKE} install 256 ${_+_}cd ${.CURDIR}/gss; ${MAKE} install 257.if ${MK_NTP} != "no" 258 ${_+_}cd ${.CURDIR}/ntp; ${MAKE} install 259.endif 260 ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install 261.if ${MK_PKGBOOTSTRAP} != "no" 262 ${_+_}cd ${.CURDIR}/pkg; ${MAKE} install 263.endif 264 ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install 265 ${_+_}cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap 266 ${_+_}cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt 267 ${_+_}cd ${.CURDIR}/pam.d; ${MAKE} install 268 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0444 \ 269 ${BSM_ETC_OPEN_FILES} ${BSM_ETC_DIR} 270 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0600 \ 271 ${BSM_ETC_RESTRICTED_FILES} ${BSM_ETC_DIR} 272 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 0500 \ 273 ${BSM_ETC_EXEC_FILES} ${BSM_ETC_DIR} 274.if ${MK_UNBOUND} != "no" 275 if [ ! -e ${DESTDIR}/etc/unbound ]; then \ 276 ${INSTALL_SYMLINK} ../var/unbound ${DESTDIR}/etc/unbound; \ 277 fi 278.endif 279.if ${MK_SENDMAIL} != "no" 280 ${_+_}cd ${.CURDIR}/sendmail; ${MAKE} distribution 281.endif 282.if ${MK_OPENSSH} != "no" 283 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 284 ${SSH} ${DESTDIR}/etc/ssh 285.endif 286.if ${MK_OPENSSL} != "no" 287 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 288 ${SSL} ${DESTDIR}/etc/ssl 289.endif 290.if ${MK_KERBEROS} != "no" 291 cd ${.CURDIR}/root; \ 292 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 293 dot.k5login ${DESTDIR}/root/.k5login; 294.endif 295 cd ${.CURDIR}/root; \ 296 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 297 dot.profile ${DESTDIR}/root/.profile; \ 298 rm -f ${DESTDIR}/.profile; \ 299 ln ${DESTDIR}/root/.profile ${DESTDIR}/.profile 300.if ${MK_TCSH} != "no" 301 cd ${.CURDIR}/root; \ 302 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 303 dot.cshrc ${DESTDIR}/root/.cshrc; \ 304 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 305 dot.login ${DESTDIR}/root/.login; \ 306 rm -f ${DESTDIR}/.cshrc; \ 307 ln ${DESTDIR}/root/.cshrc ${DESTDIR}/.cshrc 308.endif 309 cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 310 ${MTREE} ${DESTDIR}/etc/mtree 311.if ${MK_MAIL} != "no" 312 cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \ 313 ${ETCMAIL} ${DESTDIR}/etc/mail 314 if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \ 315 ! -f ${DESTDIR}/etc/aliases ]; then \ 316 ln -s mail/aliases ${DESTDIR}/etc/aliases; \ 317 fi 318.endif 319 ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \ 320 ${DESTDIR}/etc/dumpdates 321.if ${MK_LOCATE} != "no" 322 ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \ 323 ${DESTDIR}/var/db/locate.database 324.endif 325 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \ 326 ${DESTDIR}/var/crash 327 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 328 ${FREEBSD} ${DESTDIR}/ 329.if ${MK_BOOT} != "no" 330.if exists(${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints) 331 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 332 ${.CURDIR}/../sys/${MACHINE}/conf/GENERIC.hints \ 333 ${DESTDIR}/boot/device.hints 334.endif 335.endif 336.if ${MK_NIS} == "no" 337 sed -i "" -e 's/.*_compat:/# &/' -e 's/compat$$/files/' \ 338 ${DESTDIR}/etc/nsswitch.conf 339.endif 340 341MTREE_CMD?= mtree 342 343.if ${MK_INSTALL_AS_USER} == "yes" && ${_uid} != 0 344MTREE_FILTER= sed -e 's,\([gu]\)name=,\1id=,g' \ 345 -e 's,\(uid=\)[^ ]* ,\1${_uid} ,' \ 346 -e 's,\(gid=\)[^ ]* ,\1${_gid} ,' \ 347 -e 's,\(uid=\)[^ ]*$$,\1${_uid},' \ 348 -e 's,\(gid=\)[^ ]*$$,\1${_gid},' 349.else 350MTREE_FILTER= cat 351.if !defined(NO_FSCHG) 352MTREE_FSCHG= -i 353.endif 354.endif 355 356MTREES= mtree/BSD.root.dist / \ 357 mtree/BSD.var.dist /var \ 358 mtree/BSD.usr.dist /usr \ 359 mtree/BSD.include.dist /usr/include \ 360 mtree/BSD.debug.dist /usr/lib 361.if ${MK_GROFF} != "no" 362MTREES+= mtree/BSD.groff.dist /usr 363.endif 364.if ${MK_LIB32} != "no" 365MTREES+= mtree/BSD.lib32.dist /usr 366MTREES+= mtree/BSD.lib32.dist /usr/lib/debug/usr 367.endif 368.if ${MK_LIBSOFT} != "no" 369MTREES+= mtree/BSD.libsoft.dist /usr 370MTREES+= mtree/BSD.libsoft.dist /usr/lib/debug/usr 371.endif 372.if ${MK_TESTS} != "no" 373MTREES+= mtree/BSD.tests.dist ${TESTSBASE} 374MTREES+= mtree/BSD.tests.dist /usr/lib/debug/${TESTSBASE} 375.endif 376.if ${MK_SENDMAIL} != "no" 377MTREES+= mtree/BSD.sendmail.dist / 378.endif 379.for mtree in ${LOCAL_MTREE} 380MTREES+= ../${mtree} / 381.endfor 382 383# Clean up some directories that where mistakenly created as files that 384# should not have been as part of the nvi update in r281994. 385# This should be removed after 11.0-RELEASE. 386DISTRIB_CLEANUP_SHARE_FILES= ${SHAREDIR}/doc/usd/10.exref ${SHAREDIR}/doc/usd/11.edit 387DISTRIB_CLEANUP_SHARE_FILES+= ${SHAREDIR}/doc/usd/12.vi ${SHAREDIR}/doc/usd/13.viref 388distrib-cleanup: .PHONY 389 for file in ${DISTRIB_CLEANUP_SHARE_FILES}; do \ 390 if [ -f ${DESTDIR}/$${file} ]; then \ 391 rm -f ${DESTDIR}/$${file}; \ 392 fi; \ 393 done 394 395distrib-dirs: ${MTREES:N/*} distrib-cleanup .PHONY 396 @set ${MTREES}; \ 397 while test $$# -ge 2; do \ 398 m=${.CURDIR}/$$1; \ 399 shift; \ 400 d=${DESTDIR}$$1; \ 401 shift; \ 402 test -d $$d || mkdir -p $$d; \ 403 ${ECHO} ${MTREE_CMD} -deU ${MTREE_FSCHG} \ 404 ${MTREE_FOLLOWS_SYMLINKS} -f $$m -p $$d; \ 405 ${MTREE_FILTER} $$m | \ 406 ${MTREE_CMD} -deU ${MTREE_FSCHG} ${MTREE_FOLLOWS_SYMLINKS} \ 407 -p $$d; \ 408 done; true 409.if defined(NO_ROOT) 410 @set ${MTREES}; \ 411 while test $$# -ge 2; do \ 412 m=${.CURDIR}/$$1; \ 413 shift; \ 414 d=$$1; \ 415 test "$$d" == "/" && d=""; \ 416 d=${DISTBASE}$$d; \ 417 shift; \ 418 test -d ${DESTDIR}/$$d || mkdir -p ${DESTDIR}/$$d; \ 419 ${ECHO} "${MTREE_CMD:N-W} -C -f $$m -K uname,gname | " \ 420 "sed s#^\.#.$$d# | ${METALOG.add}" ; \ 421 ${MTREE_FILTER} $$m | \ 422 ${MTREE_CMD:N-W} -C -K uname,gname | sed s#^\.#.$$d# | \ 423 ${METALOG.add} ; \ 424 done; true 425.endif 426 ${INSTALL_SYMLINK} usr/src/sys ${DESTDIR}/sys 427.if ${MK_MAN} != "no" 428 cd ${DESTDIR}${SHAREDIR}/man; \ 429 for mandir in man*; do \ 430 ${INSTALL_SYMLINK} ../$$mandir \ 431 ${DESTDIR}${SHAREDIR}/man/en.ISO8859-1/; \ 432 ${INSTALL_SYMLINK} ../$$mandir \ 433 ${DESTDIR}${SHAREDIR}/man/en.UTF-8/; \ 434 done 435.if ${MK_OPENSSL} != "no" 436 cd ${DESTDIR}${SHAREDIR}/openssl/man; \ 437 for mandir in man*; do \ 438 ${INSTALL_SYMLINK} ../$$mandir \ 439 ${DESTDIR}${SHAREDIR}/openssl/man/en.ISO8859-1/; \ 440 done 441.endif 442 set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \ 443 while [ $$# -gt 0 ] ; do \ 444 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/man/$$1"; \ 445 if [ "${MK_OPENSSL}" != "no" ]; then \ 446 ${INSTALL_SYMLINK} "$$2" \ 447 "${DESTDIR}${SHAREDIR}/openssl/man/$$1"; \ 448 fi; \ 449 shift; shift; \ 450 done 451.endif 452.if ${MK_NLS} != "no" 453 set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \ 454 while [ $$# -gt 0 ] ; do \ 455 ${INSTALL_SYMLINK} "$$2" "${DESTDIR}${SHAREDIR}/nls/$$1"; \ 456 shift; shift; \ 457 done 458.endif 459 460etc-examples: 461 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \ 462 ${BIN1} ${BIN2} nsmb.conf opieaccess \ 463 ${DESTDIR}${SHAREDIR}/examples/etc 464 ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install \ 465 DESTDIR=${DESTDIR}${SHAREDIR}/examples 466 467.include <bsd.prog.mk> 468