bsd.own.mk revision 245241
1# $FreeBSD: head/share/mk/bsd.own.mk 245241 2013-01-09 21:07:08Z brooks $ 2# 3# The include file <bsd.own.mk> set common variables for owner, 4# group, mode, and directories. Defaults are in brackets. 5# 6# 7# +++ variables +++ 8# 9# DESTDIR Change the tree where the file gets installed. [not set] 10# 11# DISTDIR Change the tree where the file for a distribution 12# gets installed (see /usr/src/release/Makefile). [not set] 13# 14# COMPRESS_CMD Program to compress documents. 15# Output is to stdout. [gzip -cn] 16# 17# COMPRESS_EXT File name extension of ${COMPRESS_CMD} command. [.gz] 18# 19# BINOWN Binary owner. [root] 20# 21# BINGRP Binary group. [wheel] 22# 23# BINMODE Binary mode. [555] 24# 25# NOBINMODE Mode for non-executable files. [444] 26# 27# LIBDIR Base path for libraries. [/usr/lib] 28# 29# LIBCOMPATDIR Base path for compat libraries. [/usr/lib/compat] 30# 31# LIBDATADIR Base path for misc. utility data files. [/usr/libdata] 32# 33# LIBEXECDIR Base path for system daemons and utilities. [/usr/libexec] 34# 35# LINTLIBDIR Base path for lint libraries. [/usr/libdata/lint] 36# 37# SHLIBDIR Base path for shared libraries. [${LIBDIR}] 38# 39# LIBOWN Library owner. [${BINOWN}] 40# 41# LIBGRP Library group. [${BINGRP}] 42# 43# LIBMODE Library mode. [${NOBINMODE}] 44# 45# 46# KMODDIR Base path for loadable kernel modules 47# (see kld(4)). [/boot/kernel] 48# 49# KMODOWN Kernel and KLD owner. [${BINOWN}] 50# 51# KMODGRP Kernel and KLD group. [${BINGRP}] 52# 53# KMODMODE KLD mode. [${BINMODE}] 54# 55# 56# SHAREDIR Base path for architecture-independent ascii 57# text files. [/usr/share] 58# 59# SHAREOWN ASCII text file owner. [root] 60# 61# SHAREGRP ASCII text file group. [wheel] 62# 63# SHAREMODE ASCII text file mode. [${NOBINMODE}] 64# 65# 66# CONFDIR Base path for configuration files. [/etc] 67# 68# CONFOWN Configuration file owner. [root] 69# 70# CONFGRP Configuration file group. [wheel] 71# 72# CONFMODE Configuration file mode. [644] 73# 74# 75# DOCDIR Base path for system documentation (e.g. PSD, USD, 76# handbook, FAQ etc.). [${SHAREDIR}/doc] 77# 78# DOCOWN Documentation owner. [${SHAREOWN}] 79# 80# DOCGRP Documentation group. [${SHAREGRP}] 81# 82# DOCMODE Documentation mode. [${NOBINMODE}] 83# 84# 85# INFODIR Base path for GNU's hypertext system 86# called Info (see info(1)). [${SHAREDIR}/info] 87# 88# INFOOWN Info owner. [${SHAREOWN}] 89# 90# INFOGRP Info group. [${SHAREGRP}] 91# 92# INFOMODE Info mode. [${NOBINMODE}] 93# 94# 95# MANDIR Base path for manual installation. [${SHAREDIR}/man/man] 96# 97# MANOWN Manual owner. [${SHAREOWN}] 98# 99# MANGRP Manual group. [${SHAREGRP}] 100# 101# MANMODE Manual mode. [${NOBINMODE}] 102# 103# 104# NLSDIR Base path for National Language Support files 105# installation. [${SHAREDIR}/nls] 106# 107# NLSOWN National Language Support files owner. [${SHAREOWN}] 108# 109# NLSGRP National Language Support files group. [${SHAREGRP}] 110# 111# NLSMODE National Language Support files mode. [${NOBINMODE}] 112# 113# INCLUDEDIR Base path for standard C include files [/usr/include] 114 115.if !target(__<bsd.own.mk>__) 116__<bsd.own.mk>__: 117 118.if !defined(_WITHOUT_SRCCONF) 119SRCCONF?= /etc/src.conf 120.if exists(${SRCCONF}) 121.include "${SRCCONF}" 122.endif 123.endif 124 125# Binaries 126BINOWN?= root 127BINGRP?= wheel 128BINMODE?= 555 129NOBINMODE?= 444 130 131.if defined(MODULES_WITH_WORLD) 132KMODDIR?= /boot/modules 133.else 134KMODDIR?= /boot/kernel 135.endif 136KMODOWN?= ${BINOWN} 137KMODGRP?= ${BINGRP} 138KMODMODE?= ${BINMODE} 139 140LIBDIR?= /usr/lib 141LIBCOMPATDIR?= /usr/lib/compat 142LIBDATADIR?= /usr/libdata 143LIBEXECDIR?= /usr/libexec 144LINTLIBDIR?= /usr/libdata/lint 145SHLIBDIR?= ${LIBDIR} 146LIBOWN?= ${BINOWN} 147LIBGRP?= ${BINGRP} 148LIBMODE?= ${NOBINMODE} 149 150 151# Share files 152SHAREDIR?= /usr/share 153SHAREOWN?= root 154SHAREGRP?= wheel 155SHAREMODE?= ${NOBINMODE} 156 157CONFDIR?= /etc 158CONFOWN?= root 159CONFGRP?= wheel 160CONFMODE?= 644 161 162MANDIR?= ${SHAREDIR}/man/man 163MANOWN?= ${SHAREOWN} 164MANGRP?= ${SHAREGRP} 165MANMODE?= ${NOBINMODE} 166 167DOCDIR?= ${SHAREDIR}/doc 168DOCOWN?= ${SHAREOWN} 169DOCGRP?= ${SHAREGRP} 170DOCMODE?= ${NOBINMODE} 171 172INFODIR?= ${SHAREDIR}/info 173INFOOWN?= ${SHAREOWN} 174INFOGRP?= ${SHAREGRP} 175INFOMODE?= ${NOBINMODE} 176 177NLSDIR?= ${SHAREDIR}/nls 178NLSOWN?= ${SHAREOWN} 179NLSGRP?= ${SHAREGRP} 180NLSMODE?= ${NOBINMODE} 181 182INCLUDEDIR?= /usr/include 183 184# Common variables 185.if !defined(DEBUG_FLAGS) 186STRIP?= -s 187.endif 188 189COMPRESS_CMD?= gzip -cn 190COMPRESS_EXT?= .gz 191 192.if !defined(_WITHOUT_SRCCONF) 193# 194# Define MK_* variables (which are either "yes" or "no") for users 195# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the 196# make(1) environment. 197# These should be tested with `== "no"' or `!= "no"' in makefiles. 198# The NO_* variables should only be set by makefiles. 199# 200 201# 202# Supported NO_* options (if defined, MK_* will be forced to "no", 203# regardless of user's setting). 204# 205.for var in \ 206 CTF \ 207 INSTALLLIB \ 208 MAN \ 209 PROFILE 210.if defined(NO_${var}) 211.if defined(WITH_${var}) 212.undef WITH_${var} 213.endif 214WITHOUT_${var}= 215.endif 216.endfor 217 218# 219# Compat NO_* options (same as above, except their use is deprecated). 220# 221.if !defined(BURN_BRIDGES) 222.for var in \ 223 ACPI \ 224 ATM \ 225 AUDIT \ 226 AUTHPF \ 227 BIND \ 228 BIND_DNSSEC \ 229 BIND_ETC \ 230 BIND_LIBS_LWRES \ 231 BIND_MTREE \ 232 BIND_NAMED \ 233 BIND_UTILS \ 234 BLUETOOTH \ 235 BOOT \ 236 CALENDAR \ 237 CPP \ 238 CRYPT \ 239 CVS \ 240 CXX \ 241 DICT \ 242 DYNAMICROOT \ 243 EXAMPLES \ 244 FORTH \ 245 FP_LIBC \ 246 GAMES \ 247 GCOV \ 248 GDB \ 249 GNU \ 250 GPIB \ 251 GROFF \ 252 HTML \ 253 INET6 \ 254 INFO \ 255 IPFILTER \ 256 IPX \ 257 KDUMP \ 258 KERBEROS \ 259 LIB32 \ 260 LIBPTHREAD \ 261 LIBTHR \ 262 LOCALES \ 263 LPR \ 264 MAILWRAPPER \ 265 NETCAT \ 266 NIS \ 267 NLS \ 268 NLS_CATALOGS \ 269 NS_CACHING \ 270 OPENSSH \ 271 OPENSSL \ 272 PAM \ 273 PF \ 274 RCMDS \ 275 RCS \ 276 RESCUE \ 277 SENDMAIL \ 278 SETUID_LOGIN \ 279 SHAREDOCS \ 280 SYSCONS \ 281 TCSH \ 282 TOOLCHAIN \ 283 USB \ 284 WPA_SUPPLICANT_EAPOL 285.if defined(NO_${var}) 286#.warning NO_${var} is deprecated in favour of WITHOUT_${var}= 287WITHOUT_${var}= 288.endif 289.endfor 290.endif # !defined(BURN_BRIDGES) 291 292# 293# Older-style variables that enabled behaviour when set. 294# 295.if defined(YES_HESIOD) 296WITH_HESIOD= 297.endif 298.if defined(MAKE_IDEA) 299WITH_IDEA= 300.endif 301 302__DEFAULT_YES_OPTIONS = \ 303 ACCT \ 304 ACPI \ 305 AMD \ 306 APM \ 307 ASSERT_DEBUG \ 308 AT \ 309 ATF \ 310 ATM \ 311 AUDIT \ 312 AUTHPF \ 313 BIND \ 314 BIND_DNSSEC \ 315 BIND_ETC \ 316 BIND_LIBS_LWRES \ 317 BIND_MTREE \ 318 BIND_NAMED \ 319 BIND_UTILS \ 320 BINUTILS \ 321 BLUETOOTH \ 322 BOOT \ 323 BSD_CPIO \ 324 BSNMP \ 325 BZIP2 \ 326 CALENDAR \ 327 CAPSICUM \ 328 CDDL \ 329 CPP \ 330 CRYPT \ 331 CTM \ 332 CVS \ 333 CXX \ 334 DICT \ 335 DYNAMICROOT \ 336 ED_CRYPTO \ 337 EXAMPLES \ 338 FLOPPY \ 339 FORTH \ 340 FP_LIBC \ 341 FREEBSD_UPDATE \ 342 GAMES \ 343 GCC \ 344 GCOV \ 345 GDB \ 346 GNU \ 347 GPIB \ 348 GPIO \ 349 GROFF \ 350 HTML \ 351 INET \ 352 INET6 \ 353 INFO \ 354 INSTALLLIB \ 355 IPFILTER \ 356 IPFW \ 357 IPX \ 358 JAIL \ 359 KDUMP \ 360 KERBEROS \ 361 KERNEL_SYMBOLS \ 362 KVM \ 363 LEGACY_CONSOLE \ 364 LIB32 \ 365 LIBPTHREAD \ 366 LIBTHR \ 367 LOCALES \ 368 LOCATE \ 369 LPR \ 370 LS_COLORS \ 371 MAIL \ 372 MAILWRAPPER \ 373 MAKE \ 374 MAN \ 375 NDIS \ 376 NETCAT \ 377 NETGRAPH \ 378 NIS \ 379 NLS \ 380 NLS_CATALOGS \ 381 NS_CACHING \ 382 NTP \ 383 OPENSSH \ 384 OPENSSL \ 385 PAM \ 386 PF \ 387 PKGBOOTSTRAP \ 388 PKGTOOLS \ 389 PMC \ 390 PORTSNAP \ 391 PPP \ 392 PROFILE \ 393 QUOTAS \ 394 RCMDS \ 395 RCS \ 396 RESCUE \ 397 ROUTED \ 398 SENDMAIL \ 399 SETUID_LOGIN \ 400 SHAREDOCS \ 401 SOURCELESS \ 402 SOURCELESS_HOST \ 403 SOURCELESS_UCODE \ 404 SSP \ 405 SYMVER \ 406 SYSCONS \ 407 SYSINSTALL \ 408 TCSH \ 409 TELNET \ 410 TEXTPROC \ 411 TOOLCHAIN \ 412 USB \ 413 UTMPX \ 414 WIRELESS \ 415 WPA_SUPPLICANT_EAPOL \ 416 ZFS \ 417 ZONEINFO 418 419__DEFAULT_NO_OPTIONS = \ 420 BIND_IDN \ 421 BIND_LARGE_FILE \ 422 BIND_LIBS \ 423 BIND_SIGCHASE \ 424 BIND_XML \ 425 BMAKE \ 426 BSDCONFIG \ 427 BSD_GREP \ 428 CLANG_EXTRAS \ 429 CTF \ 430 HESIOD \ 431 ICONV \ 432 IDEA \ 433 INSTALL_AS_USER \ 434 NMTREE \ 435 NAND \ 436 OFED \ 437 SHARED_TOOLCHAIN 438 439# 440# Default behaviour of some options depends on the architecture. Unfortunately 441# this means that we have to test TARGET_ARCH (the buildworld case) as well 442# as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not 443# used at all in bsd.*.mk, but we have to make an exception here if we want 444# to allow defaults for some things like clang and fdt to vary by target 445# architecture. 446# 447.if defined(TARGET_ARCH) 448__T=${TARGET_ARCH} 449.else 450__T=${MACHINE_ARCH} 451.endif 452# Clang is only for x86 and powerpc right now, by default. 453.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*} 454__DEFAULT_YES_OPTIONS+=CLANG 455.else 456__DEFAULT_NO_OPTIONS+=CLANG 457.endif 458# Clang the default system compiler only on x86. 459.if ${__T} == "amd64" || ${__T} == "i386" 460__DEFAULT_YES_OPTIONS+=CLANG_IS_CC 461.else 462__DEFAULT_NO_OPTIONS+=CLANG_IS_CC 463.endif 464# FDT is needed only for arm, mips and powerpc 465.if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*} 466__DEFAULT_YES_OPTIONS+=FDT 467.else 468__DEFAULT_NO_OPTIONS+=FDT 469.endif 470.undef __T 471 472# 473# MK_* options which default to "yes". 474# 475.for var in ${__DEFAULT_YES_OPTIONS} 476.if defined(WITH_${var}) && defined(WITHOUT_${var}) 477.error WITH_${var} and WITHOUT_${var} can't both be set. 478.endif 479.if defined(MK_${var}) 480.error MK_${var} can't be set by a user. 481.endif 482.if defined(WITHOUT_${var}) 483MK_${var}:= no 484.else 485MK_${var}:= yes 486.endif 487.endfor 488.undef __DEFAULT_YES_OPTIONS 489 490# 491# MK_* options which default to "no". 492# 493.for var in ${__DEFAULT_NO_OPTIONS} 494.if defined(WITH_${var}) && defined(WITHOUT_${var}) 495.error WITH_${var} and WITHOUT_${var} can't both be set. 496.endif 497.if defined(MK_${var}) 498.error MK_${var} can't be set by a user. 499.endif 500.if defined(WITH_${var}) 501MK_${var}:= yes 502.else 503MK_${var}:= no 504.endif 505.endfor 506.undef __DEFAULT_NO_OPTIONS 507 508# 509# Force some options off if their dependencies are off. 510# Order is somewhat important. 511# 512.if ${MK_LIBPTHREAD} == "no" 513MK_LIBTHR:= no 514.endif 515 516.if ${MK_LIBTHR} == "no" 517MK_BIND:= no 518.endif 519 520.if ${MK_BIND} == "no" 521MK_BIND_DNSSEC:= no 522MK_BIND_ETC:= no 523MK_BIND_LIBS:= no 524MK_BIND_LIBS_LWRES:= no 525MK_BIND_MTREE:= no 526MK_BIND_NAMED:= no 527MK_BIND_UTILS:= no 528.endif 529 530.if ${MK_BIND_MTREE} == "no" 531MK_BIND_ETC:= no 532.endif 533 534.if ${MK_SOURCELESS} == "no" 535MK_SOURCELESS_HOST:= no 536MK_SOURCELESS_UCODE:= no 537.endif 538 539.if ${MK_CDDL} == "no" 540MK_ZFS:= no 541MK_CTF:= no 542.endif 543 544.if ${MK_CLANG} == "no" 545MK_CLANG_EXTRAS:= no 546.endif 547 548.if ${MK_CRYPT} == "no" 549MK_OPENSSL:= no 550MK_OPENSSH:= no 551MK_KERBEROS:= no 552.endif 553 554.if ${MK_CXX} == "no" 555MK_CLANG:= no 556MK_GROFF:= no 557.endif 558 559.if ${MK_MAIL} == "no" 560MK_MAILWRAPPER:= no 561MK_SENDMAIL:= no 562.endif 563 564.if ${MK_NETGRAPH} == "no" 565MK_ATM:= no 566MK_BLUETOOTH:= no 567.endif 568 569.if ${MK_OPENSSL} == "no" 570MK_OPENSSH:= no 571MK_KERBEROS:= no 572.endif 573 574.if ${MK_PF} == "no" 575MK_AUTHPF:= no 576.endif 577 578.if ${MK_TEXTPROC} == "no" 579MK_GROFF:= no 580.endif 581 582.if ${MK_TOOLCHAIN} == "no" 583MK_BINUTILS:= no 584MK_CLANG:= no 585MK_GCC:= no 586MK_GDB:= no 587.endif 588 589.if ${MK_CLANG} == "no" 590MK_CLANG_IS_CC:= no 591.endif 592 593# 594# Set defaults for the MK_*_SUPPORT variables. 595# 596 597# 598# MK_*_SUPPORT options which default to "yes" unless their corresponding 599# MK_* variable is set to "no". 600# 601.for var in \ 602 BZIP2 \ 603 GNU \ 604 INET \ 605 INET6 \ 606 IPX \ 607 KERBEROS \ 608 KVM \ 609 NETGRAPH \ 610 PAM \ 611 WIRELESS 612.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT) 613.error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set. 614.endif 615.if defined(MK_${var}_SUPPORT) 616.error MK_${var}_SUPPORT can't be set by a user. 617.endif 618.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" 619MK_${var}_SUPPORT:= no 620.else 621MK_${var}_SUPPORT:= yes 622.endif 623.endfor 624 625# 626# MK_* options whose default value depends on another option. 627# 628.for vv in \ 629 GSSAPI/KERBEROS \ 630 MAN_UTILS/MAN 631.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H}) 632.error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set. 633.endif 634.if defined(MK_${vv:H}) 635.error MK_${vv:H} can't be set by a user. 636.endif 637.if defined(WITH_${vv:H}) 638MK_${vv:H}:= yes 639.elif defined(WITHOUT_${vv:H}) 640MK_${vv:H}:= no 641.else 642MK_${vv:H}:= ${MK_${vv:T}} 643.endif 644.endfor 645 646# 647# MK_* options that default to "yes" if the compiler is a C++11 compiler. 648# 649.include <bsd.compiler.mk> 650.for var in \ 651 LIBCPLUSPLUS 652.if defined(WITH_${var}) && defined(WITHOUT_${var}) 653.error WITH_${var} and WITHOUT_${var} can't both be set. 654.endif 655.if defined(MK_${var}) 656.error MK_${var} can't be set by a user. 657.endif 658.if ${COMPILER_FEATURES:Mc++11} 659.if defined(WITHOUT_${var}) 660MK_${var}:= no 661.else 662MK_${var}:= yes 663.endif 664.else 665.if defined(WITH_${var}) 666MK_${var}:= yes 667.else 668MK_${var}:= no 669.endif 670.endif 671.endfor 672 673.if ${MK_CTF} != "no" 674CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 675.elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300) 676CTFCONVERT_CMD= 677.else 678CTFCONVERT_CMD= @: 679.endif 680 681.if ${MK_INSTALL_AS_USER} != "no" 682_uid!= id -u 683.if ${_uid} != 0 684.if !defined(USER) 685USER!= id -un 686.endif 687_gid!= id -gn 688.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE 689$xOWN= ${USER} 690$xGRP= ${_gid} 691.endfor 692.endif 693.endif 694 695.endif # !_WITHOUT_SRCCONF 696 697.endif # !target(__<bsd.own.mk>__) 698