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