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