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