bsd.own.mk revision 246354
1# $FreeBSD: head/share/mk/bsd.own.mk 246354 2013-02-05 05:16:02Z andrew $ 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# 185# install(1) parameters. 186# 187HRDLINK?= -l h 188SYMLINK?= -l s 189 190INSTALL_LINK?= ${INSTALL} ${HRDLINK} 191INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK} 192 193# Common variables 194.if !defined(DEBUG_FLAGS) 195STRIP?= -s 196.endif 197 198COMPRESS_CMD?= gzip -cn 199COMPRESS_EXT?= .gz 200 201.if !defined(_WITHOUT_SRCCONF) 202# 203# Define MK_* variables (which are either "yes" or "no") for users 204# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the 205# make(1) environment. 206# These should be tested with `== "no"' or `!= "no"' in makefiles. 207# The NO_* variables should only be set by makefiles. 208# 209 210# 211# Supported NO_* options (if defined, MK_* will be forced to "no", 212# regardless of user's setting). 213# 214.for var in \ 215 CTF \ 216 INSTALLLIB \ 217 MAN \ 218 PROFILE 219.if defined(NO_${var}) 220.if defined(WITH_${var}) 221.undef WITH_${var} 222.endif 223WITHOUT_${var}= 224.endif 225.endfor 226 227# 228# Older-style variables that enabled behaviour when set. 229# 230.if defined(YES_HESIOD) 231WITH_HESIOD= 232.endif 233.if defined(MAKE_IDEA) 234WITH_IDEA= 235.endif 236 237__DEFAULT_YES_OPTIONS = \ 238 ACCT \ 239 ACPI \ 240 AMD \ 241 APM \ 242 ASSERT_DEBUG \ 243 AT \ 244 ATF \ 245 ATM \ 246 AUDIT \ 247 AUTHPF \ 248 BIND \ 249 BIND_DNSSEC \ 250 BIND_ETC \ 251 BIND_LIBS_LWRES \ 252 BIND_MTREE \ 253 BIND_NAMED \ 254 BIND_UTILS \ 255 BINUTILS \ 256 BLUETOOTH \ 257 BOOT \ 258 BSD_CPIO \ 259 BSNMP \ 260 BZIP2 \ 261 CALENDAR \ 262 CAPSICUM \ 263 CDDL \ 264 CPP \ 265 CRYPT \ 266 CTM \ 267 CVS \ 268 CXX \ 269 DICT \ 270 DYNAMICROOT \ 271 ED_CRYPTO \ 272 EXAMPLES \ 273 FLOPPY \ 274 FORTH \ 275 FP_LIBC \ 276 FREEBSD_UPDATE \ 277 GAMES \ 278 GCC \ 279 GCOV \ 280 GDB \ 281 GNU \ 282 GPIB \ 283 GPIO \ 284 GROFF \ 285 HTML \ 286 INET \ 287 INET6 \ 288 INFO \ 289 INSTALLLIB \ 290 IPFILTER \ 291 IPFW \ 292 IPX \ 293 JAIL \ 294 KDUMP \ 295 KERBEROS \ 296 KERNEL_SYMBOLS \ 297 KVM \ 298 LEGACY_CONSOLE \ 299 LIB32 \ 300 LIBPTHREAD \ 301 LIBTHR \ 302 LOCALES \ 303 LOCATE \ 304 LPR \ 305 LS_COLORS \ 306 MAIL \ 307 MAILWRAPPER \ 308 MAKE \ 309 MAN \ 310 NDIS \ 311 NETCAT \ 312 NETGRAPH \ 313 NIS \ 314 NLS \ 315 NLS_CATALOGS \ 316 NS_CACHING \ 317 NTP \ 318 OPENSSH \ 319 OPENSSL \ 320 PAM \ 321 PC_SYSINSTALL \ 322 PF \ 323 PKGBOOTSTRAP \ 324 PKGTOOLS \ 325 PMC \ 326 PORTSNAP \ 327 PPP \ 328 PROFILE \ 329 QUOTAS \ 330 RCMDS \ 331 RCS \ 332 RESCUE \ 333 ROUTED \ 334 SENDMAIL \ 335 SETUID_LOGIN \ 336 SHAREDOCS \ 337 SOURCELESS \ 338 SOURCELESS_HOST \ 339 SOURCELESS_UCODE \ 340 SSP \ 341 SYMVER \ 342 SYSCONS \ 343 SYSINSTALL \ 344 TCSH \ 345 TELNET \ 346 TEXTPROC \ 347 TOOLCHAIN \ 348 USB \ 349 UTMPX \ 350 WIRELESS \ 351 WPA_SUPPLICANT_EAPOL \ 352 ZFS \ 353 ZONEINFO 354 355__DEFAULT_NO_OPTIONS = \ 356 ARM_EABI \ 357 BSD_PATCH \ 358 BIND_IDN \ 359 BIND_LARGE_FILE \ 360 BIND_LIBS \ 361 BIND_SIGCHASE \ 362 BIND_XML \ 363 BMAKE \ 364 BSDCONFIG \ 365 BSD_GREP \ 366 CLANG_EXTRAS \ 367 CTF \ 368 GPL_DTC \ 369 HESIOD \ 370 ICONV \ 371 IDEA \ 372 INSTALL_AS_USER \ 373 NMTREE \ 374 NAND \ 375 OFED \ 376 OPENSSH_NONE_CIPHER \ 377 SHARED_TOOLCHAIN 378 379# 380# Default behaviour of some options depends on the architecture. Unfortunately 381# this means that we have to test TARGET_ARCH (the buildworld case) as well 382# as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not 383# used at all in bsd.*.mk, but we have to make an exception here if we want 384# to allow defaults for some things like clang and fdt to vary by target 385# architecture. 386# 387.if defined(TARGET_ARCH) 388__T=${TARGET_ARCH} 389.else 390__T=${MACHINE_ARCH} 391.endif 392# Clang is only for x86, powerpc and little-endian arm right now, by default. 393.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*} 394__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL 395.elif ${__T} == "arm" || ${__T} == "armv6" 396__DEFAULT_YES_OPTIONS+=CLANG 397# GCC is unable to build the full clang on arm, disable it by default. 398__DEFAULT_NO_OPTIONS+=CLANG_FULL 399.else 400__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL 401.endif 402# Clang the default system compiler only on x86. 403.if ${__T} == "amd64" || ${__T} == "i386" 404__DEFAULT_YES_OPTIONS+=CLANG_IS_CC 405.else 406__DEFAULT_NO_OPTIONS+=CLANG_IS_CC 407.endif 408# FDT is needed only for arm, mips and powerpc 409.if ${__T:Marm*} || ${__T:Mpowerpc*} || ${__T:Mmips*} 410__DEFAULT_YES_OPTIONS+=FDT 411.else 412__DEFAULT_NO_OPTIONS+=FDT 413.endif 414.undef __T 415 416# 417# MK_* options which default to "yes". 418# 419.for var in ${__DEFAULT_YES_OPTIONS} 420.if defined(WITH_${var}) && defined(WITHOUT_${var}) 421.error WITH_${var} and WITHOUT_${var} can't both be set. 422.endif 423.if defined(MK_${var}) 424.error MK_${var} can't be set by a user. 425.endif 426.if defined(WITHOUT_${var}) 427MK_${var}:= no 428.else 429MK_${var}:= yes 430.endif 431.endfor 432.undef __DEFAULT_YES_OPTIONS 433 434# 435# MK_* options which default to "no". 436# 437.for var in ${__DEFAULT_NO_OPTIONS} 438.if defined(WITH_${var}) && defined(WITHOUT_${var}) 439.error WITH_${var} and WITHOUT_${var} can't both be set. 440.endif 441.if defined(MK_${var}) 442.error MK_${var} can't be set by a user. 443.endif 444.if defined(WITH_${var}) 445MK_${var}:= yes 446.else 447MK_${var}:= no 448.endif 449.endfor 450.undef __DEFAULT_NO_OPTIONS 451 452# 453# Force some options off if their dependencies are off. 454# Order is somewhat important. 455# 456.if ${MK_LIBPTHREAD} == "no" 457MK_LIBTHR:= no 458.endif 459 460.if ${MK_LIBTHR} == "no" 461MK_BIND:= no 462.endif 463 464.if ${MK_BIND} == "no" 465MK_BIND_DNSSEC:= no 466MK_BIND_ETC:= no 467MK_BIND_LIBS:= no 468MK_BIND_LIBS_LWRES:= no 469MK_BIND_MTREE:= no 470MK_BIND_NAMED:= no 471MK_BIND_UTILS:= no 472.endif 473 474.if ${MK_BIND_MTREE} == "no" 475MK_BIND_ETC:= no 476.endif 477 478.if ${MK_SOURCELESS} == "no" 479MK_SOURCELESS_HOST:= no 480MK_SOURCELESS_UCODE:= no 481.endif 482 483.if ${MK_CDDL} == "no" 484MK_ZFS:= no 485MK_CTF:= no 486.endif 487 488.if ${MK_CRYPT} == "no" 489MK_OPENSSL:= no 490MK_OPENSSH:= no 491MK_KERBEROS:= no 492.endif 493 494.if ${MK_CXX} == "no" 495MK_CLANG:= no 496MK_GROFF:= no 497.endif 498 499.if ${MK_MAIL} == "no" 500MK_MAILWRAPPER:= no 501MK_SENDMAIL:= no 502.endif 503 504.if ${MK_NETGRAPH} == "no" 505MK_ATM:= no 506MK_BLUETOOTH:= no 507.endif 508 509.if ${MK_OPENSSL} == "no" 510MK_OPENSSH:= no 511MK_KERBEROS:= no 512.endif 513 514.if ${MK_PF} == "no" 515MK_AUTHPF:= no 516.endif 517 518.if ${MK_TEXTPROC} == "no" 519MK_GROFF:= no 520.endif 521 522.if ${MK_TOOLCHAIN} == "no" 523MK_BINUTILS:= no 524MK_CLANG:= no 525MK_GCC:= no 526MK_GDB:= no 527.endif 528 529.if ${MK_CLANG} == "no" 530MK_CLANG_EXTRAS:= no 531MK_CLANG_FULL:= no 532MK_CLANG_IS_CC:= no 533.endif 534 535# 536# Set defaults for the MK_*_SUPPORT variables. 537# 538 539# 540# MK_*_SUPPORT options which default to "yes" unless their corresponding 541# MK_* variable is set to "no". 542# 543.for var in \ 544 BZIP2 \ 545 GNU \ 546 INET \ 547 INET6 \ 548 IPX \ 549 KERBEROS \ 550 KVM \ 551 NETGRAPH \ 552 PAM \ 553 WIRELESS 554.if defined(WITH_${var}_SUPPORT) && defined(WITHOUT_${var}_SUPPORT) 555.error WITH_${var}_SUPPORT and WITHOUT_${var}_SUPPORT can't both be set. 556.endif 557.if defined(MK_${var}_SUPPORT) 558.error MK_${var}_SUPPORT can't be set by a user. 559.endif 560.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" 561MK_${var}_SUPPORT:= no 562.else 563MK_${var}_SUPPORT:= yes 564.endif 565.endfor 566 567# 568# MK_* options whose default value depends on another option. 569# 570.for vv in \ 571 GSSAPI/KERBEROS \ 572 MAN_UTILS/MAN 573.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H}) 574.error WITH_${vv:H} and WITHOUT_${vv:H} can't both be set. 575.endif 576.if defined(MK_${vv:H}) 577.error MK_${vv:H} can't be set by a user. 578.endif 579.if defined(WITH_${vv:H}) 580MK_${vv:H}:= yes 581.elif defined(WITHOUT_${vv:H}) 582MK_${vv:H}:= no 583.else 584MK_${vv:H}:= ${MK_${vv:T}} 585.endif 586.endfor 587 588# 589# MK_* options that default to "yes" if the compiler is a C++11 compiler. 590# 591.include <bsd.compiler.mk> 592.for var in \ 593 LIBCPLUSPLUS 594.if defined(WITH_${var}) && defined(WITHOUT_${var}) 595.error WITH_${var} and WITHOUT_${var} can't both be set. 596.endif 597.if defined(MK_${var}) 598.error MK_${var} can't be set by a user. 599.endif 600.if ${COMPILER_FEATURES:Mc++11} 601.if defined(WITHOUT_${var}) 602MK_${var}:= no 603.else 604MK_${var}:= yes 605.endif 606.else 607.if defined(WITH_${var}) 608MK_${var}:= yes 609.else 610MK_${var}:= no 611.endif 612.endif 613.endfor 614 615.if ${MK_CTF} != "no" 616CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 617.elif defined(.PARSEDIR) || (defined(MAKE_VERSION) && ${MAKE_VERSION} >= 5201111300) 618CTFCONVERT_CMD= 619.else 620CTFCONVERT_CMD= @: 621.endif 622 623.if ${MK_INSTALL_AS_USER} != "no" 624_uid!= id -u 625.if ${_uid} != 0 626.if !defined(USER) 627USER!= id -un 628.endif 629_gid!= id -gn 630.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE 631$xOWN= ${USER} 632$xGRP= ${_gid} 633.endfor 634.endif 635.endif 636 637.endif # !_WITHOUT_SRCCONF 638 639.endif # !target(__<bsd.own.mk>__) 640