15e84b765SWarner Losh# $FreeBSD$ 25e84b765SWarner Losh# 35e84b765SWarner Losh# Option file for FreeBSD /usr/src builds. 45e84b765SWarner Losh# 55e84b765SWarner Losh# Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf 65e84b765SWarner Losh# and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} 75e84b765SWarner Losh# with sensible (usually) defaults. 85e84b765SWarner Losh# 95e84b765SWarner Losh# Makefiles must include bsd.opts.mk after defining specific MK_FOO options that 105e84b765SWarner Losh# are applicable for that Makefile (typically there are none, but sometimes there 115e84b765SWarner Losh# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish 125e84b765SWarner Losh# to omit from that make. 135e84b765SWarner Losh# 145e84b765SWarner Losh# Makefiles must include bsd.srcpot.mk before they test the value of any MK_FOO 155e84b765SWarner Losh# variable. 165e84b765SWarner Losh# 17c6063d0dSWarner Losh# Makefiles may also assume that this file is included by src.opts.mk should it 185e84b765SWarner Losh# need variables defined there prior to the end of the Makefile where 195e84b765SWarner Losh# bsd.{subdir,lib.bin}.mk is traditionally included. 205e84b765SWarner Losh# 215e84b765SWarner Losh# The old-style YES_FOO and NO_FOO are being phased out. No new instances of them 225e84b765SWarner Losh# should be added. Old instances should be removed since they were just to 235e84b765SWarner Losh# bridge the gap between FreeBSD 4 and FreeBSD 5. 245e84b765SWarner Losh# 255e84b765SWarner Losh# Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an 265e84b765SWarner Losh# exception is made for _WITHOUT_SRCONF which turns off this mechanism 275e84b765SWarner Losh# completely). 285e84b765SWarner Losh# 295e84b765SWarner Losh 305e84b765SWarner Losh.if !target(__<src.opts.mk>__) 315e84b765SWarner Losh__<src.opts.mk>__: 325e84b765SWarner Losh 33*f9798cc7SWarner Losh# Allow user to configure things that only effect src tree builds. 345e84b765SWarner LoshSRCCONF?= /etc/src.conf 355e84b765SWarner Losh.if exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf" 365e84b765SWarner Losh.include "${SRCCONF}" 375e84b765SWarner Losh.endif 385e84b765SWarner Losh 39*f9798cc7SWarner Losh# Must be included after src.conf 40*f9798cc7SWarner Losh.include <bsd.own.mk> 41*f9798cc7SWarner Losh 425e84b765SWarner Losh# 435e84b765SWarner Losh# Define MK_* variables (which are either "yes" or "no") for users 445e84b765SWarner Losh# to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the 455e84b765SWarner Losh# make(1) environment. 465e84b765SWarner Losh# These should be tested with `== "no"' or `!= "no"' in makefiles. 475e84b765SWarner Losh# The NO_* variables should only be set by makefiles for variables 485e84b765SWarner Losh# that haven't been converted over. 495e84b765SWarner Losh# 505e84b765SWarner Losh 515e84b765SWarner Losh# These options are used by src the builds 525e84b765SWarner Losh 535e84b765SWarner Losh__DEFAULT_YES_OPTIONS = \ 545e84b765SWarner Losh ACCT \ 555e84b765SWarner Losh ACPI \ 565e84b765SWarner Losh AMD \ 575e84b765SWarner Losh APM \ 585e84b765SWarner Losh ARM_EABI \ 595e84b765SWarner Losh AT \ 605e84b765SWarner Losh ATM \ 615e84b765SWarner Losh AUDIT \ 625e84b765SWarner Losh AUTHPF \ 635e84b765SWarner Losh BINUTILS \ 645e84b765SWarner Losh BINUTILS_BOOTSTRAP \ 655e84b765SWarner Losh BLUETOOTH \ 665e84b765SWarner Losh BOOT \ 675e84b765SWarner Losh BSD_CPIO \ 685e84b765SWarner Losh BSNMP \ 695e84b765SWarner Losh BZIP2 \ 705e84b765SWarner Losh CALENDAR \ 715e84b765SWarner Losh CAPSICUM \ 725e84b765SWarner Losh CASPER \ 735e84b765SWarner Losh CDDL \ 745e84b765SWarner Losh CPP \ 755e84b765SWarner Losh CROSS_COMPILER \ 765e84b765SWarner Losh CRYPT \ 775e84b765SWarner Losh CTM \ 785e84b765SWarner Losh CXX \ 795e84b765SWarner Losh DICT \ 805e84b765SWarner Losh DMAGENT \ 815e84b765SWarner Losh DYNAMICROOT \ 825e84b765SWarner Losh ED_CRYPTO \ 835e84b765SWarner Losh EXAMPLES \ 845e84b765SWarner Losh FDT \ 855e84b765SWarner Losh FLOPPY \ 865e84b765SWarner Losh FMTREE \ 875e84b765SWarner Losh FORMAT_EXTENSIONS \ 885e84b765SWarner Losh FORTH \ 895e84b765SWarner Losh FP_LIBC \ 905e84b765SWarner Losh FREEBSD_UPDATE \ 915e84b765SWarner Losh GAMES \ 925e84b765SWarner Losh GCOV \ 935e84b765SWarner Losh GDB \ 945e84b765SWarner Losh GNU \ 955e84b765SWarner Losh GNU_GREP_COMPAT \ 965e84b765SWarner Losh GPIB \ 975e84b765SWarner Losh GPIO \ 985e84b765SWarner Losh GPL_DTC \ 995e84b765SWarner Losh GROFF \ 1005e84b765SWarner Losh HTML \ 1015e84b765SWarner Losh ICONV \ 1025e84b765SWarner Losh INET \ 1035e84b765SWarner Losh INET6 \ 1045e84b765SWarner Losh IPFILTER \ 1055e84b765SWarner Losh IPFW \ 1065e84b765SWarner Losh JAIL \ 1075e84b765SWarner Losh KDUMP \ 1085e84b765SWarner Losh KERNEL_SYMBOLS \ 1095e84b765SWarner Losh KVM \ 1105e84b765SWarner Losh LDNS \ 1115e84b765SWarner Losh LDNS_UTILS \ 1125e84b765SWarner Losh LEGACY_CONSOLE \ 1135e84b765SWarner Losh LIB32 \ 1145e84b765SWarner Losh LIBPTHREAD \ 1155e84b765SWarner Losh LIBTHR \ 1165e84b765SWarner Losh LOCALES \ 1175e84b765SWarner Losh LOCATE \ 1185e84b765SWarner Losh LPR \ 1195e84b765SWarner Losh LS_COLORS \ 1205e84b765SWarner Losh LZMA_SUPPORT \ 1215e84b765SWarner Losh MAIL \ 1225e84b765SWarner Losh MAILWRAPPER \ 1235e84b765SWarner Losh MAKE \ 1245e84b765SWarner Losh NCURSESW \ 1255e84b765SWarner Losh NDIS \ 1265e84b765SWarner Losh NETCAT \ 1275e84b765SWarner Losh NETGRAPH \ 1285e84b765SWarner Losh NLS_CATALOGS \ 1295e84b765SWarner Losh NS_CACHING \ 1305e84b765SWarner Losh NTP \ 1315e84b765SWarner Losh OPENSSL \ 1325e84b765SWarner Losh PAM \ 1335e84b765SWarner Losh PC_SYSINSTALL \ 1345e84b765SWarner Losh PF \ 1355e84b765SWarner Losh PKGBOOTSTRAP \ 1365e84b765SWarner Losh PMC \ 1375e84b765SWarner Losh PORTSNAP \ 1385e84b765SWarner Losh PPP \ 1395e84b765SWarner Losh QUOTAS \ 1405e84b765SWarner Losh RCMDS \ 1415e84b765SWarner Losh RCS \ 1425e84b765SWarner Losh RESCUE \ 1435e84b765SWarner Losh ROUTED \ 1445e84b765SWarner Losh SENDMAIL \ 1455e84b765SWarner Losh SETUID_LOGIN \ 1465e84b765SWarner Losh SHAREDOCS \ 1475e84b765SWarner Losh SOURCELESS \ 1485e84b765SWarner Losh SOURCELESS_HOST \ 1495e84b765SWarner Losh SOURCELESS_UCODE \ 1505e84b765SWarner Losh SVNLITE \ 1515e84b765SWarner Losh SYSCALL_COMPAT \ 1525e84b765SWarner Losh SYSCONS \ 1535e84b765SWarner Losh SYSINSTALL \ 1545e84b765SWarner Losh TCSH \ 1555e84b765SWarner Losh TELNET \ 1565e84b765SWarner Losh TEXTPROC \ 1575e84b765SWarner Losh UNBOUND \ 1585e84b765SWarner Losh USB \ 1595e84b765SWarner Losh UTMPX \ 1605e84b765SWarner Losh VI \ 1615e84b765SWarner Losh WIRELESS \ 1625e84b765SWarner Losh WPA_SUPPLICANT_EAPOL \ 1635e84b765SWarner Losh ZFS \ 1645e84b765SWarner Losh ZONEINFO 1655e84b765SWarner Losh 1665e84b765SWarner Losh__DEFAULT_NO_OPTIONS = \ 1675e84b765SWarner Losh BSD_GREP \ 1685e84b765SWarner Losh CLANG_EXTRAS \ 1695e84b765SWarner Losh EISA \ 1705e84b765SWarner Losh HESIOD \ 1715e84b765SWarner Losh LLDB \ 1725e84b765SWarner Losh NAND \ 1735e84b765SWarner Losh OFED \ 1745e84b765SWarner Losh OPENLDAP \ 1755e84b765SWarner Losh OPENSSH_NONE_CIPHER \ 1765e84b765SWarner Losh SHARED_TOOLCHAIN \ 1775e84b765SWarner Losh SORT_THREADS \ 1785e84b765SWarner Losh SVN \ 1795e84b765SWarner Losh TESTS \ 1805e84b765SWarner Losh USB_GADGET_EXAMPLES 1815e84b765SWarner Losh 1825e84b765SWarner Losh# 1835e84b765SWarner Losh# Default behaviour of some options depends on the architecture. Unfortunately 1845e84b765SWarner Losh# this means that we have to test TARGET_ARCH (the buildworld case) as well 1855e84b765SWarner Losh# as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not 1865e84b765SWarner Losh# used at all in bsd.*.mk, but we have to make an exception here if we want 1875e84b765SWarner Losh# to allow defaults for some things like clang to vary by target architecture. 1885e84b765SWarner Losh# Additional, per-target behavior should be rarely added only after much 1895e84b765SWarner Losh# gnashing of teeth and grinding of gears. 1905e84b765SWarner Losh# 1915e84b765SWarner Losh.if defined(TARGET_ARCH) 1925e84b765SWarner Losh__T=${TARGET_ARCH} 1935e84b765SWarner Losh.else 1945e84b765SWarner Losh__T=${MACHINE_ARCH} 1955e84b765SWarner Losh.endif 1965e84b765SWarner Losh.if defined(TARGET) 1975e84b765SWarner Losh__TT=${TARGET} 1985e84b765SWarner Losh.else 1995e84b765SWarner Losh__TT=${MACHINE} 2005e84b765SWarner Losh.endif 2015e84b765SWarner Losh# Clang is only for x86, powerpc and little-endian arm right now, by default. 2025e84b765SWarner Losh.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*} 2035e84b765SWarner Losh__DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP 2045e84b765SWarner Losh.elif ${__T} == "arm" || ${__T} == "armv6" || ${__T} == "armv6hf" 2055e84b765SWarner Losh__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP 2065e84b765SWarner Losh# GCC is unable to build the full clang on arm, disable it by default. 2075e84b765SWarner Losh__DEFAULT_NO_OPTIONS+=CLANG_FULL 2085e84b765SWarner Losh.else 2095e84b765SWarner Losh__DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP 2105e84b765SWarner Losh.endif 2115e84b765SWarner Losh# Clang the default system compiler only on little-endian arm and x86. 2125e84b765SWarner Losh.if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \ 2135e84b765SWarner Losh ${__T} == "armv6hf" || ${__T} == "i386" 2145e84b765SWarner Losh__DEFAULT_YES_OPTIONS+=CLANG_IS_CC 2155e84b765SWarner Losh__DEFAULT_NO_OPTIONS+=GNUCXX 2165e84b765SWarner Losh# The pc98 bootloader requires gcc to build and so we must leave gcc enabled 2175e84b765SWarner Losh# for pc98 for now. 2185e84b765SWarner Losh.if ${__TT} == "pc98" 2195e84b765SWarner Losh__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP 2205e84b765SWarner Losh.else 2215e84b765SWarner Losh__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP 2225e84b765SWarner Losh.endif 2235e84b765SWarner Losh.else 2245e84b765SWarner Losh# If clang is not cc, then build gcc by default 2255e84b765SWarner Losh__DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP 2265e84b765SWarner Losh__DEFAULT_YES_OPTIONS+=GCC GNUCXX GCC_BOOTSTRAP 2275e84b765SWarner Losh.endif 2285e84b765SWarner Losh 2295e84b765SWarner Losh.include <bsd.mkopt.mk> 2305e84b765SWarner Losh 2315e84b765SWarner Losh# 2325e84b765SWarner Losh# MK_* options that default to "yes" if the compiler is a C++11 compiler. 2335e84b765SWarner Losh# 2345e84b765SWarner Losh.include <bsd.compiler.mk> 2355e84b765SWarner Losh.for var in \ 2365e84b765SWarner Losh LIBCPLUSPLUS 2375e84b765SWarner Losh.if !defined(MK_${var}) 2385e84b765SWarner Losh.if ${COMPILER_FEATURES:Mc++11} 2395e84b765SWarner Losh.if defined(WITHOUT_${var}) 2405e84b765SWarner LoshMK_${var}:= no 2415e84b765SWarner Losh.else 2425e84b765SWarner LoshMK_${var}:= yes 2435e84b765SWarner Losh.endif 2445e84b765SWarner Losh.else 2455e84b765SWarner Losh.if defined(WITH_${var}) 2465e84b765SWarner LoshMK_${var}:= yes 2475e84b765SWarner Losh.else 2485e84b765SWarner LoshMK_${var}:= no 2495e84b765SWarner Losh.endif 2505e84b765SWarner Losh.endif 2515e84b765SWarner Losh.endif 2525e84b765SWarner Losh.endfor 2535e84b765SWarner Losh 2545e84b765SWarner Losh# 2555e84b765SWarner Losh# Force some options off if their dependencies are off. 2565e84b765SWarner Losh# Order is somewhat important. 2575e84b765SWarner Losh# 2585e84b765SWarner Losh.if ${MK_LIBPTHREAD} == "no" 2595e84b765SWarner LoshMK_LIBTHR:= no 2605e84b765SWarner Losh.endif 2615e84b765SWarner Losh 2625e84b765SWarner Losh.if ${MK_LDNS} == "no" 2635e84b765SWarner LoshMK_LDNS_UTILS:= no 2645e84b765SWarner LoshMK_UNBOUND:= no 2655e84b765SWarner Losh.endif 2665e84b765SWarner Losh 2675e84b765SWarner Losh.if ${MK_SOURCELESS} == "no" 2685e84b765SWarner LoshMK_SOURCELESS_HOST:= no 2695e84b765SWarner LoshMK_SOURCELESS_UCODE:= no 2705e84b765SWarner Losh.endif 2715e84b765SWarner Losh 2725e84b765SWarner Losh.if ${MK_CDDL} == "no" 2735e84b765SWarner LoshMK_ZFS:= no 2745e84b765SWarner LoshMK_CTF:= no 2755e84b765SWarner Losh.endif 2765e84b765SWarner Losh 2775e84b765SWarner Losh.if ${MK_CRYPT} == "no" 2785e84b765SWarner LoshMK_OPENSSL:= no 2795e84b765SWarner LoshMK_OPENSSH:= no 2805e84b765SWarner LoshMK_KERBEROS:= no 2815e84b765SWarner Losh.endif 2825e84b765SWarner Losh 2835e84b765SWarner Losh.if ${MK_CXX} == "no" 2845e84b765SWarner LoshMK_CLANG:= no 2855e84b765SWarner LoshMK_GROFF:= no 2865e84b765SWarner Losh.endif 2875e84b765SWarner Losh 2885e84b765SWarner Losh.if ${MK_MAIL} == "no" 2895e84b765SWarner LoshMK_MAILWRAPPER:= no 2905e84b765SWarner LoshMK_SENDMAIL:= no 2915e84b765SWarner LoshMK_DMAGENT:= no 2925e84b765SWarner Losh.endif 2935e84b765SWarner Losh 2945e84b765SWarner Losh.if ${MK_NETGRAPH} == "no" 2955e84b765SWarner LoshMK_ATM:= no 2965e84b765SWarner LoshMK_BLUETOOTH:= no 2975e84b765SWarner Losh.endif 2985e84b765SWarner Losh 2995e84b765SWarner Losh.if ${MK_OPENSSL} == "no" 3005e84b765SWarner LoshMK_OPENSSH:= no 3015e84b765SWarner LoshMK_KERBEROS:= no 3025e84b765SWarner Losh.endif 3035e84b765SWarner Losh 3045e84b765SWarner Losh.if ${MK_PF} == "no" 3055e84b765SWarner LoshMK_AUTHPF:= no 3065e84b765SWarner Losh.endif 3075e84b765SWarner Losh 3085e84b765SWarner Losh.if ${MK_TEXTPROC} == "no" 3095e84b765SWarner LoshMK_GROFF:= no 3105e84b765SWarner Losh.endif 3115e84b765SWarner Losh 3125e84b765SWarner Losh.if ${MK_CROSS_COMPILER} == "no" 3135e84b765SWarner LoshMK_BINUTILS_BOOTSTRAP:= no 3145e84b765SWarner LoshMK_CLANG_BOOTSTRAP:= no 3155e84b765SWarner LoshMK_GCC_BOOTSTRAP:= no 3165e84b765SWarner Losh.endif 3175e84b765SWarner Losh 3185e84b765SWarner Losh.if ${MK_TOOLCHAIN} == "no" 3195e84b765SWarner LoshMK_BINUTILS:= no 3205e84b765SWarner LoshMK_CLANG:= no 3215e84b765SWarner LoshMK_GCC:= no 3225e84b765SWarner LoshMK_GDB:= no 3235e84b765SWarner Losh.endif 3245e84b765SWarner Losh 3255e84b765SWarner Losh.if ${MK_CLANG} == "no" 3265e84b765SWarner LoshMK_CLANG_EXTRAS:= no 3275e84b765SWarner LoshMK_CLANG_FULL:= no 3285e84b765SWarner Losh.endif 3295e84b765SWarner Losh 3305e84b765SWarner Losh# 3315e84b765SWarner Losh# Set defaults for the MK_*_SUPPORT variables. 3325e84b765SWarner Losh# 3335e84b765SWarner Losh 3345e84b765SWarner Losh# 3355e84b765SWarner Losh# MK_*_SUPPORT options which default to "yes" unless their corresponding 3365e84b765SWarner Losh# MK_* variable is set to "no". 3375e84b765SWarner Losh# 3385e84b765SWarner Losh.for var in \ 3395e84b765SWarner Losh BZIP2 \ 3405e84b765SWarner Losh GNU \ 3415e84b765SWarner Losh INET \ 3425e84b765SWarner Losh INET6 \ 3435e84b765SWarner Losh KERBEROS \ 3445e84b765SWarner Losh KVM \ 3455e84b765SWarner Losh NETGRAPH \ 3465e84b765SWarner Losh PAM \ 3475e84b765SWarner Losh WIRELESS 3485e84b765SWarner Losh.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" 3495e84b765SWarner LoshMK_${var}_SUPPORT:= no 3505e84b765SWarner Losh.else 3515e84b765SWarner LoshMK_${var}_SUPPORT:= yes 3525e84b765SWarner Losh.endif 3535e84b765SWarner Losh.endfor 3545e84b765SWarner Losh 3555e84b765SWarner Losh# 3565e84b765SWarner Losh# MK_* options whose default value depends on another option. 3575e84b765SWarner Losh# 3585e84b765SWarner Losh.for vv in \ 3595e84b765SWarner Losh GSSAPI/KERBEROS \ 3605e84b765SWarner Losh MAN_UTILS/MAN 3615e84b765SWarner Losh.if defined(WITH_${vv:H}) 3625e84b765SWarner LoshMK_${vv:H}:= yes 3635e84b765SWarner Losh.elif defined(WITHOUT_${vv:H}) 3645e84b765SWarner LoshMK_${vv:H}:= no 3655e84b765SWarner Losh.else 3665e84b765SWarner LoshMK_${vv:H}:= ${MK_${vv:T}} 3675e84b765SWarner Losh.endif 3685e84b765SWarner Losh.endfor 3695e84b765SWarner Losh 3705e84b765SWarner Losh.if !${COMPILER_FEATURES:Mc++11} 3715e84b765SWarner LoshMK_LLDB:= no 3725e84b765SWarner Losh.endif 3735e84b765SWarner Losh 3745e84b765SWarner Losh.endif 375