diff --git a/share/mk/bsd.clang-analyze.mk b/share/mk/bsd.clang-analyze.mk index 474d2d1e8166..8a49670df573 100644 --- a/share/mk/bsd.clang-analyze.mk +++ b/share/mk/bsd.clang-analyze.mk @@ -1,99 +1,99 @@ # # Support Clang static analyzer on SRCS. # # # +++ variables +++ # # CLANG_ANALYZE_CHECKERS Which checkers to run for all sources. # # CLANG_ANALYZE_CXX_CHECKERS Which checkers to run for C++ sources. # # CLANG_ANALYZE_OUTPUT Output format for generated files. # text - don't generate extra files. # html - generate html in obj.plist/ directories. # plist - generate xml obj.plist files. # See also: # contrib/llvm-project/clang/include/clang/StaticAnalyzer/Core/Analyses.def # # CLANG_ANALYZE_OUTPUT_DIR Sets which directory output set by # CLANG_ANALYZE_OUTPUT is placed into. # # +++ targets +++ # # analyze: # Run the Clang static analyzer against all sources and present # output on stdout. .if !target(____) -____: +____: .NOTMAIN .include .if ${COMPILER_TYPE} != "clang" && (make(analyze) || make(*.clang-analyzer)) .error Clang static analyzer requires clang but found that compiler '${CC}' is ${COMPILER_TYPE} .endif CLANG_ANALYZE_OUTPUT?= text CLANG_ANALYZE_OUTPUT_DIR?= clang-analyze CLANG_ANALYZE_FLAGS+= --analyze \ -Xanalyzer -analyzer-output=${CLANG_ANALYZE_OUTPUT} \ -o ${CLANG_ANALYZE_OUTPUT_DIR} CLANG_ANALYZE_CHECKERS+= core deadcode security unix CLANG_ANALYZE_CXX_CHECKERS+= cplusplus .for checker in ${CLANG_ANALYZE_CHECKERS} CLANG_ANALYZE_FLAGS+= -Xanalyzer -analyzer-checker=${checker} .endfor CLANG_ANALYZE_CXX_FLAGS+= ${CLANG_ANALYZE_FLAGS} .for checker in ${CLANG_ANALYZE_CXX_CHECKERS} CLANG_ANALYZE_CXX_FLAGS+= -Xanalyzer -analyzer-checker=${checker} .endfor .SUFFIXES: .c .cc .cpp .cxx .C .clang-analyzer CLANG_ANALYZE_CFLAGS= ${CFLAGS:N-Wa,--fatal-warnings} CLANG_ANALYZE_CXXFLAGS= ${CXXFLAGS:N-Wa,--fatal-warnings} .c.clang-analyzer: ${CC:N${CCACHE_BIN}} ${CLANG_ANALYZE_FLAGS} \ ${CLANG_ANALYZE_CFLAGS} \ ${.IMPSRC} .cc.clang-analyzer .cpp.clang-analyzer .cxx.clang-analyzer .C.clang-analyzer: ${CXX:N${CCACHE_BIN}} ${CLANG_ANALYZE_CXX_FLAGS} \ ${CLANG_ANALYZE_CXXFLAGS} \ ${.IMPSRC} CLANG_ANALYZE_SRCS= \ ${SRCS:M*.[cC]} ${SRCS:M*.cc} \ ${SRCS:M*.cpp} ${SRCS:M*.cxx} \ ${DPSRCS:M*.[cC]} ${DPSRCS:M*.cc} \ ${DPSRCS:M*.cpp} ${DPSRCS:M*.cxx} .if !empty(CLANG_ANALYZE_SRCS) CLANG_ANALYZE_OBJS= ${CLANG_ANALYZE_SRCS:O:u:${OBJS_SRCS_FILTER:ts:}:S,$,.clang-analyzer,} .NOPATH: ${CLANG_ANALYZE_OBJS} .endif # .depend files aren't relevant here since they reference obj.o rather than # obj.clang-analyzer, so add in some guesses in case 'make depend' wasn't ran, # for when directly building 'obj.clang-analyzer'. .for __obj in ${CLANG_ANALYZE_OBJS} ${__obj}: ${OBJS_DEPEND_GUESS} ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} .endfor beforeanalyze: depend .PHONY .if !defined(_RECURSING_PROGS) && !empty(CLANG_ANALYZE_SRCS) && \ ${CLANG_ANALYZE_OUTPUT} != "text" mkdir -p ${CLANG_ANALYZE_OUTPUT_DIR} .endif .if !target(analyze) analyze: beforeanalyze .WAIT ${CLANG_ANALYZE_OBJS} .endif .if exists(${CLANG_ANALYZE_OUTPUT_DIR}) CLEANDIRS+= ${CLANG_ANALYZE_OUTPUT_DIR} .endif .endif # !target(____) diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk index c41cfda5f01c..6fa732fd730b 100644 --- a/share/mk/bsd.compat.mk +++ b/share/mk/bsd.compat.mk @@ -1,182 +1,182 @@ .if !targets(__<${_this:T}>__) -__<${_this:T}>__: +__<${_this:T}>__: .NOTMAIN .include .if defined(_LIBCOMPATS) COMPAT_ARCH?= ${TARGET_ARCH} .for _LIBCOMPAT in ${_ALL_LIBCOMPATS} LIB${_LIBCOMPAT}CPUTYPE?= ${CPUTYPE_${_LIBCOMPAT}} .endfor .if (defined(WANT_COMPILER_TYPE) && ${WANT_COMPILER_TYPE} == gcc) || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) COMPAT_COMPILER_TYPE= gcc .else COMPAT_COMPILER_TYPE= clang .endif .else COMPAT_ARCH= ${MACHINE_ARCH} .for _LIBCOMPAT in ${_ALL_LIBCOMPATS} LIB${_LIBCOMPAT}CPUTYPE= ${CPUTYPE} .endfor .endif # ------------------------------------------------------------------- # 32 bit world .if ${COMPAT_ARCH} == "amd64" HAS_COMPAT+= 32 .if empty(LIB32CPUTYPE) LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2 .else LIB32CPUFLAGS= -march=${LIB32CPUTYPE} .endif LIB32CPUFLAGS.clang+= -target x86_64-unknown-freebsd${OS_REVISION} LIB32CPUFLAGS+= -m32 LIB32_MACHINE= i386 LIB32_MACHINE_ARCH= i386 LIB32WMAKEENV= MACHINE_CPU="i686 mmx sse sse2" LIB32WMAKEFLAGS= \ LD="${XLD} -m elf_i386_fbsd" .elif ${COMPAT_ARCH} == "powerpc64" HAS_COMPAT+= 32 .if empty(LIB32CPUTYPE) LIB32CPUFLAGS= -mcpu=powerpc .else LIB32CPUFLAGS= -mcpu=${LIB32CPUTYPE} .endif LIB32CPUFLAGS.gcc+= -m32 LIB32CPUFLAGS.clang+= -target powerpc-unknown-freebsd${OS_REVISION} LIB32_MACHINE= powerpc LIB32_MACHINE_ARCH= powerpc LIB32WMAKEFLAGS= \ LD="${XLD} -m elf32ppc_fbsd" .elif ${COMPAT_ARCH} == "aarch64" HAS_COMPAT+= 32 .if empty(LIB32CPUTYPE) LIB32CPUFLAGS= -march=armv7 .else LIB32CPUFLAGS= -mcpu=${LIB32CPUTYPE} .endif LIB32CPUFLAGS+= -m32 LIB32CPUFLAGS.clang+= -target armv7-unknown-freebsd${OS_REVISION}-gnueabihf LIB32_MACHINE= arm LIB32_MACHINE_ARCH= armv7 LIB32WMAKEFLAGS= \ LD="${XLD} -m armelf_fbsd" .endif LIB32WMAKEFLAGS+= NM="${XNM}" LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}" LIB32DTRACE= ${DTRACE} -32 LIB32_MACHINE_ABI= ${MACHINE_ABI:N*64} long32 ptr32 .if ${COMPAT_ARCH} == "amd64" LIB32_MACHINE_ABI+= time32 .else LIB32_MACHINE_ABI+= time64 .endif # ------------------------------------------------------------------- # In the program linking case, select LIBCOMPAT .if defined(NEED_COMPAT) .ifndef HAS_COMPAT .warning NEED_COMPAT defined, but no LIBCOMPAT is available (COMPAT_ARCH == ${COMPAT_ARCH}) .elif !${HAS_COMPAT:M${NEED_COMPAT}} && ${NEED_COMPAT} != "any" .error NEED_COMPAT (${NEED_COMPAT}) defined, but not in HAS_COMPAT (${HAS_COMPAT}) .elif ${NEED_COMPAT} == "any" .endif .ifdef WANT_COMPAT .error Both WANT_COMPAT and NEED_COMPAT defined .endif WANT_COMPAT:= ${NEED_COMPAT} .endif .if defined(HAS_COMPAT) && defined(WANT_COMPAT) .if ${WANT_COMPAT} == "any" USE_COMPAT:= ${HAS_COMPAT:[1]} .else USE_COMPAT:= ${WANT_COMPAT} .endif _LIBCOMPATS= ${USE_COMPAT} .endif libcompats= ${_LIBCOMPATS:tl} # Update MACHINE and MACHINE_ARCH so they can be used in bsd.opts.mk via # bsd.compiler.mk .if defined(USE_COMPAT) _LIBCOMPAT_MAKEVARS= _MACHINE _MACHINE_ARCH .for _var in ${_LIBCOMPAT_MAKEVARS} .if !empty(LIB${USE_COMPAT}${_var}) LIBCOMPAT${_var}?= ${LIB${USE_COMPAT}${_var}} .endif .endfor MACHINE= ${LIBCOMPAT_MACHINE} MACHINE_ARCH= ${LIBCOMPAT_MACHINE_ARCH} .endif .if !defined(COMPAT_COMPILER_TYPE) .include COMPAT_COMPILER_TYPE=${COMPILER_TYPE} .endif # ------------------------------------------------------------------- # Generic code for each type. # Set defaults based on type. .for _LIBCOMPAT _libcompat in ${_LIBCOMPATS:@v@${v} ${v:tl}@} WORLDTMP?= ${SYSROOT} # Shared flags LIB${_LIBCOMPAT}_OBJTOP?= ${OBJTOP}/obj-lib${_libcompat} LIB${_LIBCOMPAT}CFLAGS+= ${LIB${_LIBCOMPAT}CPUFLAGS} \ ${LIB${_LIBCOMPAT}CPUFLAGS.${COMPAT_COMPILER_TYPE}} \ -DCOMPAT_LIBCOMPAT=\"${_LIBCOMPAT}\" \ -DCOMPAT_libcompat=\"${_libcompat}\" \ -DCOMPAT_LIB${_LIBCOMPAT} \ --sysroot=${WORLDTMP} \ ${BFLAGS} LIB${_LIBCOMPAT}LDFLAGS+= -L${WORLDTMP}/usr/lib${_libcompat} LIB${_LIBCOMPAT}WMAKEFLAGS+= COMPAT_LIBCOMPAT=${_LIBCOMPAT} \ COMPAT_libcompat=${_libcompat} LIB${_LIBCOMPAT}WMAKEENV+= MACHINE=${LIB${_LIBCOMPAT}_MACHINE} LIB${_LIBCOMPAT}WMAKEENV+= MACHINE_ARCH=${LIB${_LIBCOMPAT}_MACHINE_ARCH} # -B is needed to find /usr/lib32/crti.o for gcc. LIB${_LIBCOMPAT}CFLAGS+= -B${WORLDTMP}/usr/lib${_libcompat} .endfor .if defined(USE_COMPAT) LIB${USE_COMPAT}CPUFLAGS+= ${LIB${USE_COMPAT}CPUFLAGS.${COMPAT_COMPILER_TYPE}} libcompat= ${USE_COMPAT:tl} _LIBCOMPAT_MAKEVARS= _OBJTOP TMP CPUFLAGS CFLAGS CXXFLAGS LDFLAGS \ _MACHINE_ABI \ WMAKEENV WMAKEFLAGS WMAKE WORLDTMP .for _var in ${_LIBCOMPAT_MAKEVARS} .if !empty(LIB${USE_COMPAT}${_var}) LIBCOMPAT${_var}?= ${LIB${USE_COMPAT}${_var}} .endif .endfor LIBDIR_BASE:= /usr/lib${libcompat} LIBDATADIR:= /usr/lib${libcompat} _LIB_OBJTOP= ${LIBCOMPAT_OBJTOP} CFLAGS+= ${LIBCOMPATCFLAGS} LDFLAGS+= ${CFLAGS} ${LIBCOMPATLDFLAGS} .endif .endif diff --git a/share/mk/bsd.compat.pre.mk b/share/mk/bsd.compat.pre.mk index 05bdcb8a9f45..92ff6013c040 100644 --- a/share/mk/bsd.compat.pre.mk +++ b/share/mk/bsd.compat.pre.mk @@ -1,13 +1,13 @@ .if !targets(__<${_this:T}>__) -__<${_this:T}>__: +__<${_this:T}>__: .NOTMAIN _ALL_LIBCOMPATS:= 32 _ALL_libcompats:= ${_ALL_LIBCOMPATS:tl} # List of LIBCOMPAT libcompat pairs to avoid repeating this ugly expression. # Can be used as: .for LIBCOMPAT libcompat in ${_ALL_LIBCOMPATS_libcompats} _ALL_LIBCOMPATS_libcompats:= \ ${_ALL_LIBCOMPATS:range:@i@${_ALL_LIBCOMPATS:[$i]} ${_ALL_libcompats:[$i]}@} .endif diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index f93d3495b1aa..e8d48cf0b5bf 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -1,314 +1,314 @@ # Setup variables for the compiler # # COMPILER_TYPE is the major type of compiler. Currently gcc and clang support # automatic detection. Other compiler types can be shoe-horned in, but require # explicit setting of the compiler type. The compiler type can also be set # explicitly if, say, you install gcc as clang... # # COMPILER_VERSION is a numeric constant equal to: # major * 10000 + minor * 100 + tiny # It too can be overridden on the command line. When testing it, be sure to # make sure that you are limiting the test to a specific compiler. Testing # against 30300 for gcc likely isn't what you wanted (since versions of gcc # prior to 4.2 likely have no prayer of working). # # COMPILER_FREEBSD_VERSION is the compiler's __FreeBSD_cc_version value. # # COMPILER_FEATURES will contain one or more of the following, based on # compiler support for that feature: # # - c++17: supports full (or nearly full) C++17 programming environment. # - c++14: supports full (or nearly full) C++14 programming environment. # - c++11: supports full (or nearly full) C++11 programming environment. # - retpoline: supports the retpoline speculative execution vulnerability # mitigation. # - init-all: supports stack variable initialization. # - stackclash:supports stack clash protection # - zeroregs: supports zeroing used registers on return # - aarch64-sha512: supports the AArch64 sha512 intrinsic functions. # # When bootstrapping on macOS, 'apple-clang' will be set in COMPILER_FEATURES # to differentiate Apple's version of Clang. Apple Clang uses a different # versioning scheme and may not support the same -W/-Wno warning flags. For a # mapping of Apple Clang versions to upstream clang versions see # https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_12.x_(since_Free_On-Device_Development) # # These variables with an X_ prefix will also be provided if XCC is set. # # This file may be included multiple times, but only has effect the first time. # .if !target(____) -____: +____: .NOTMAIN .include .if defined(_NO_INCLUDE_COMPILERMK) # If _NO_INCLUDE_COMPILERMK is set we are doing a make obj/cleandir/cleanobj # and might not have a valid compiler in $PATH yet. In this case just set the # variables that are expected by the other .mk files and return COMPILER_TYPE=none X_COMPILER_TYPE=none COMPILER_VERSION=0 X_COMPILER_VERSION=0 COMPILER_FEATURES=none .else # command = /usr/local/bin/ccache cc ... # wrapper = /usr/local/libexec/ccache/cc ... CCACHE_BUILD_TYPE?= command # Handle ccache after CC is determined, but not if CC/CXX are already # overridden with a manual setup. .if ${MK_CCACHE_BUILD:Uno} == "yes" && \ !make(test-system-*) && !make(print-dir) && !make(showconfig) && \ (${CC:M*ccache/world/*} == "" || ${CXX:M*ccache/world/*} == "") # CC is always prepended with the ccache wrapper rather than modifying # PATH since it is more clear that ccache is used and avoids wasting time # for mkdep/linking/asm builds. LOCALBASE?= /usr/local CCACHE_PKG_PREFIX?= ${LOCALBASE} CCACHE_WRAPPER_PATH?= ${CCACHE_PKG_PREFIX}/libexec/ccache CCACHE_BIN?= ${CCACHE_PKG_PREFIX}/bin/ccache .if exists(${CCACHE_BIN}) # Export to ensure sub-makes can filter it out for mkdep/linking and # to chain down into kernel build which won't include this file. .export CCACHE_BIN # Expand and export some variables so they may be based on make vars. # This allows doing something like the following in the environment: # CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj' .for var in CCACHE_LOGFILE CCACHE_BASEDIR .if defined(${var}) ${var}:= ${${var}} .export ${var} .endif .endfor # Handle bootstrapped compiler changes properly by hashing their content # rather than checking mtime. For external compilers it should be safe # to use the more optimal mtime check. # XXX: CCACHE_COMPILERCHECK= string: .if ${CC:N${CCACHE_BIN}:[1]:M/*} == "" CCACHE_COMPILERCHECK?= content .else CCACHE_COMPILERCHECK?= mtime .endif .export CCACHE_COMPILERCHECK # Ensure no bogus CCACHE_PATH leaks in which might avoid the in-tree compiler. .if !empty(CCACHE_PATH) CCACHE_PATH= .export CCACHE_PATH .endif .if ${CCACHE_BUILD_TYPE} == "command" # Remove ccache from the PATH to prevent double calls and wasted CPP/LD time. PATH:= ${PATH:C,:?${CCACHE_WRAPPER_PATH}(/world)?(:$)?,,g} # Override various toolchain vars. .for var in CC CXX HOST_CC HOST_CXX .if defined(${var}) && ${${var}:M${CCACHE_BIN}} == "" ${var}:= ${CCACHE_BIN} ${${var}} .endif .endfor .else # Need to ensure CCACHE_WRAPPER_PATH is the first in ${PATH} PATH:= ${PATH:C,:?${CCACHE_WRAPPER_PATH}(/world)?(:$)?,,g} PATH:= ${CCACHE_WRAPPER_PATH}:${PATH} CCACHE_WRAPPER_PATH_PFX= ${CCACHE_WRAPPER_PATH}: .endif # ${CCACHE_BUILD_TYPE} == "command" # GCC does not need the CCACHE_CPP2 hack enabled by default in devel/ccache. # The port enables it due to ccache passing preprocessed C to clang # which fails with -Wparentheses-equality, -Wtautological-compare, and # -Wself-assign on macro-expanded lines. .if defined(COMPILER_TYPE) && ${COMPILER_TYPE} == "gcc" CCACHE_NOCPP2= 1 .export CCACHE_NOCPP2 .endif # Canonicalize CCACHE_DIR for meta mode usage. .if !defined(CCACHE_DIR) CCACHE_DIR!= ${CCACHE_BIN} -p | awk '$$2 == "cache_dir" {print $$4}' .export CCACHE_DIR .endif .if !empty(CCACHE_DIR) && empty(.MAKE.META.IGNORE_PATHS:M${CCACHE_DIR}) CCACHE_DIR:= ${CCACHE_DIR:tA} .MAKE.META.IGNORE_PATHS+= ${CCACHE_DIR} .export CCACHE_DIR .endif # ccache doesn't affect build output so let it slide for meta mode # comparisons. .MAKE.META.IGNORE_PATHS+= ${CCACHE_BIN} ccache-print-options: .PHONY @${CCACHE_BIN} -p .endif # exists(${CCACHE_BIN}) .endif # ${MK_CCACHE_BUILD} == "yes" _cc_vars=CC $${_empty_var_} .if !empty(_WANT_TOOLCHAIN_CROSS_VARS) # Only the toplevel makefile needs to compute the X_COMPILER_* variables. # Skipping the computation of the unused X_COMPILER_* in the subdirectory # makefiles can save a noticeable amount of time when walking the whole source # tree (e.g. during make includes, etc.). _cc_vars+=XCC X_ .endif .for cc X_ in ${_cc_vars} .if ${cc} == "CC" || !empty(XCC) # Try to import COMPILER_TYPE and COMPILER_VERSION from parent make. # The value is only used/exported for the same environment that impacts # CC and COMPILER_* settings here. _exported_vars= ${X_}COMPILER_TYPE ${X_}COMPILER_VERSION \ ${X_}COMPILER_FREEBSD_VERSION ${X_}COMPILER_RESOURCE_DIR ${X_}_cc_hash= ${${cc}}${MACHINE}${PATH} ${X_}_cc_hash:= ${${X_}_cc_hash:hash} # Only import if none of the vars are set differently somehow else. _can_export= yes .for var in ${_exported_vars} .if defined(${var}) && (!defined(${var}__${${X_}_cc_hash}) || ${${var}__${${X_}_cc_hash}} != ${${var}}) .if defined(${var}__${${X_}_ld_hash}) .info Cannot import ${X_}COMPILER variables since cached ${var} is different: ${${var}__${${X_}_cc_hash}} != ${${var}} .endif _can_export= no .endif .endfor .if ${_can_export} == yes .for var in ${_exported_vars} .if defined(${var}__${${X_}_cc_hash}) ${var}= ${${var}__${${X_}_cc_hash}} .endif .endfor .endif .if ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC}) .if ${MACHINE} == "common" # common is a pseudo machine for architecture independent # generated files - thus there is no compiler. ${X_}COMPILER_TYPE= none ${X_}COMPILER_VERSION= 0 ${X_}COMPILER_FREEBSD_VERSION= 0 .elif !defined(${X_}COMPILER_TYPE) || !defined(${X_}COMPILER_VERSION) _v!= ${${cc}:N${CCACHE_BIN}} --version || echo 0.0.0 .if !defined(${X_}COMPILER_TYPE) . if ${${cc}:T:M*gcc*} ${X_}COMPILER_TYPE:= gcc . elif ${${cc}:T:M*clang*} ${X_}COMPILER_TYPE:= clang . elif ${_v:Mgcc} ${X_}COMPILER_TYPE:= gcc . elif ${_v:M\(GCC\)} || ${_v:M*GNU} ${X_}COMPILER_TYPE:= gcc . elif ${_v:Mclang} || ${_v:M(clang-*.*.*)} ${X_}COMPILER_TYPE:= clang . else # With GCC, cc --version prints "cc $VERSION ($PKGVERSION)", so if a # distribution overrides the default GCC PKGVERSION it is not identified. # However, its -v output always says "gcc version" in it, so fall back on that. _gcc_version!= ${${cc}:N${CCACHE_BIN}} -v 2>&1 | grep "gcc version" . if !empty(_gcc_version) ${X_}COMPILER_TYPE:= gcc . else .error Unable to determine compiler type for ${cc}=${${cc}}. Consider setting ${X_}COMPILER_TYPE. . endif .undef _gcc_version . endif .endif .if !defined(${X_}COMPILER_VERSION) ${X_}COMPILER_VERSION!=echo "${_v:M[1-9]*.[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .endif # Detect apple clang when bootstrapping to select appropriate warning flags. .if !defined(${X_}COMPILER_FEATURES) && ${_v:[*]:M*Apple clang version*} ${X_}COMPILER_FEATURES= apple-clang .endif .undef _v .endif .if !defined(${X_}COMPILER_FREEBSD_VERSION) ${X_}COMPILER_FREEBSD_VERSION!= { echo "__FreeBSD_cc_version" | ${${cc}:N${CCACHE_BIN}} -E - 2>/dev/null || echo __FreeBSD_cc_version; } | sed -n '$$p' # If we get a literal "__FreeBSD_cc_version" back then the compiler # is a non-FreeBSD build that doesn't support it or some other error # occurred. .if ${${X_}COMPILER_FREEBSD_VERSION} == "__FreeBSD_cc_version" ${X_}COMPILER_FREEBSD_VERSION= unknown .endif .endif .if !defined(${X_}COMPILER_RESOURCE_DIR) ${X_}COMPILER_RESOURCE_DIR!= ${${cc}:N${CCACHE_BIN}} -print-resource-dir 2>/dev/null || echo unknown .endif ${X_}COMPILER_FEATURES+= c++11 c++14 .if ${${X_}COMPILER_TYPE} == "clang" || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 70000) ${X_}COMPILER_FEATURES+= c++17 .endif .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 100000) || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 100100) ${X_}COMPILER_FEATURES+= c++20 .endif .if ${${X_}COMPILER_TYPE} == "clang" || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 120000) ${X_}COMPILER_FEATURES+= init-all .endif .if ${${X_}COMPILER_TYPE} == "clang" ${X_}COMPILER_FEATURES+= retpoline # PR257638 lld fails with BE compressed debug. Fixed in main but external tool # chains will initially not have the fix. For now limit the feature to LE # targets. # When compiling bootstrap tools on non-FreeBSD, the various MACHINE variables # for the host can be missing or not match FreeBSD's naming (e.g. Linux/amd64 # reports as MACHINE=x86_64 MACHINE_ARCH=x86_64), causing TARGET_ENDIANNESS to # be undefined; be conservative and default to off until we turn this on by # default everywhere. .include .if (${.MAKE.OS} == "FreeBSD" || defined(TARGET_ENDIANNESS)) && \ ${TARGET_ENDIANNESS} == "1234" ${X_}COMPILER_FEATURES+= compressed-debug .endif .endif .if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 100000 || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 80100) ${X_}COMPILER_FEATURES+= fileprefixmap .endif .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 70000 \ && ${MACHINE_ARCH:Mriscv*} != "" && ${MACHINE_ARCH:Mpower*} != "") || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 81000 \ && ${MACHINE_ARCH:Mriscv*} != "") ${X_}COMPILER_FEATURES+= stackclash .endif .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 150000) || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 110000) && \ ${MACHINE_ARCH:Mriscv*} != "" && ${MACHINE_ARCH:Mpower*} != "" && \ ${MACHINE_ARCH:Marmv7*} != "" ${X_}COMPILER_FEATURES+= zeroregs .endif .if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 130000) || \ (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 90000) # AArch64 sha512 intrinsics are supported (and have been tested) in # clang 13 and gcc 9. ${X_}COMPILER_FEATURES+= aarch64-sha512 .endif .else # Use CC's values X_COMPILER_TYPE= ${COMPILER_TYPE} X_COMPILER_VERSION= ${COMPILER_VERSION} X_COMPILER_FREEBSD_VERSION= ${COMPILER_FREEBSD_VERSION} X_COMPILER_FEATURES= ${COMPILER_FEATURES} X_COMPILER_RESOURCE_DIR= ${COMPILER_RESOURCE_DIR} .endif # ${cc} == "CC" || (${cc} == "XCC" && ${XCC} != ${CC}) # Export the values so sub-makes don't have to look them up again, using the # hash key computed above. .for var in ${_exported_vars} ${var}__${${X_}_cc_hash}:= ${${var}} .export-env ${var}__${${X_}_cc_hash} .undef ${var}__${${X_}_cc_hash} .endfor .endif # ${cc} == "CC" || !empty(XCC) .endfor # .for cc in CC XCC .if !defined(_NO_INCLUDE_LINKERMK) .include .endif .endif # defined(_NO_INCLUDE_COMPILERMK) .endif # !target(____) diff --git a/share/mk/bsd.confs.mk b/share/mk/bsd.confs.mk index c4fb62782b75..ea702cece28d 100644 --- a/share/mk/bsd.confs.mk +++ b/share/mk/bsd.confs.mk @@ -1,145 +1,145 @@ .if !target(____) . error bsd.conf.mk cannot be included directly. .endif .if !target(____) . if target(____) . error bsd.dirs.mk must be included after bsd.confs.mk. . endif -____: +____: .NOTMAIN CONFGROUPS?= CONFS . if !target(buildconfig) . for group in ${CONFGROUPS} buildconfig: ${${group}} . endfor . endif . if !defined(_SKIP_BUILD) all: buildconfig . endif . for group in ${CONFGROUPS} . if defined(${group}) && !empty(${group}) . if !target(afterinstallconfig) afterinstallconfig: . endif . if !target(beforeinstallconfig) beforeinstallconfig: . endif installconfig: beforeinstallconfig realinstallconfig afterinstallconfig .ORDER: beforeinstallconfig realinstallconfig afterinstallconfig ${group}OWN?= ${SHAREOWN} ${group}GRP?= ${SHAREGRP} ${group}MODE?= ${CONFMODE} ${group}DIR?= ${CONFDIR} STAGE_SETS+= ${group:C,[/*],_,g} . if defined(NO_ROOT) . if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} . if defined(${group}PACKAGE) ${group}TAGS+= package=${${group}PACKAGE:Uutilities} . else ${group}TAGS+= package=${PACKAGE:Uutilities} . endif . endif ${group}TAGS+= config ${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g} . endif . if ${${group}DIR:S/^\///} == ${${group}DIR} # ${group}DIR specifies a variable that specifies a path DIRS+= ${${group}DIR} _${group}DIR= ${${group}DIR} . else # ${group}DIR specifies a path DIRS+= ${group}DIR _${group}DIR= ${group}DIR . endif STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}} . for cnf in ${${group}} ${group}OWN_${cnf}?= ${${group}OWN} ${group}GRP_${cnf}?= ${${group}GRP} ${group}MODE_${cnf}?= ${${group}MODE} ${group}DIR_${cnf}?= ${${group}DIR} . if defined(${group}NAME) ${group}NAME_${cnf}?= ${${group}NAME} . else ${group}NAME_${cnf}?= ${cnf:T} . endif # Determine the directory for the current file. Default to the parent group # DIR, then check to see how to pass that variable on below. ${group}DIR_${cnf}?= ${${group}DIR} . if ${${group}DIR_${cnf}:S/^\///} == ${${group}DIR_${cnf}} # DIR specifies a variable that specifies a path _${group}DIR_${cnf}= ${${group}DIR_${cnf}} . else # DIR directly specifies a path _${group}DIR_${cnf}= ${group}DIR_${cnf} . endif ${group}PREFIX_${cnf}= ${DESTDIR}${${_${group}DIR_${cnf}}} # Append DIR to DIRS if not already in place -- DIRS is already filtered, so # this is primarily to ease inspection. . for d in ${DIRS} _DIRS+= ${${d}} . endfor . if ${DIRS:M${_${group}DIR_${cnf}}} == "" . if ${_DIRS:M${${_${group}DIR_${cnf}}}} == "" DIRS+= ${_${group}DIR_${cnf}} . else _${group}DIR_${cnf}= ${group}DIR . endif . endif . if defined(${group}NAME) ${group}NAME_${cnf}?= ${${group}NAME} . else ${group}NAME_${cnf}?= ${cnf:T} . endif # defined(${group}NAME) # Work around a bug with install(1) -C and /dev/null . if ${cnf} == "/dev/null" INSTALL_COPY= . else INSTALL_COPY= -C . endif STAGE_AS_SETS+= ${cnf:T} STAGE_AS_${cnf:T}= ${${group}NAME_${cnf:T}} # XXX {group}OWN,GRP,MODE STAGE_DIR.${cnf:T}= ${STAGE_OBJTOP}${${_${group}DIR_${cnf}}} stage_as.${cnf:T}: ${cnf} realinstallconfig: installdirs-${_${group}DIR_${cnf}} _${group}INS_${cnf:T} _${group}INS_${cnf:T}: ${cnf} ${INSTALL} ${${group}TAG_ARGS} ${INSTALL_COPY} -o ${${group}OWN_${cnf}} \ -g ${${group}GRP_${cnf}} -m ${${group}MODE_${cnf}} \ ${.ALLSRC} ${${group}PREFIX_${cnf}}/${${group}NAME_${cnf}} . endfor # for cnf in ${${group}} . endif # defined(${group}) && !empty(${group}) . endfor .if ${MK_STAGING} != "no" . if !empty(STAGE_SETS) buildconfig: stage_files stage_files: . if !empty(STAGE_AS_SETS) buildconfig: stage_as stage_as: . endif . endif .endif .endif # !target(____) diff --git a/share/mk/bsd.dirs.mk b/share/mk/bsd.dirs.mk index 8e090d3f2cbd..317ff61cd604 100644 --- a/share/mk/bsd.dirs.mk +++ b/share/mk/bsd.dirs.mk @@ -1,54 +1,54 @@ # # Directory permissions management. .if !target(____) -____: +____: .NOTMAIN # List of directory variable names to install. Each variable name's value # must be a full path. If non-default permissions are desired, _MODE, # _OWN, and _GRP may be specified. DIRS?= . for dir in ${DIRS:O:u} . if defined(${dir}) && !empty(${dir}) # Set default permissions for a directory ${dir}_MODE?= 0755 ${dir}_OWN?= root ${dir}_GRP?= wheel . if defined(${dir}_FLAGS) && !empty(${dir}_FLAGS) ${dir}_FLAG= -f ${${dir}_FLAGS} . endif . if defined(NO_ROOT) . if !defined(${dir}TAGS) || ! ${${dir}TAGS:Mpackage=*} ${dir}TAGS+= package=${${dir}PACKAGE:Uutilities} . endif ${dir}TAG_ARGS= -T ${${dir}TAGS:[*]:S/ /,/g} . endif installdirs: installdirs-${dir} # Coalesce duplicate destdirs . if !defined(_uniquedirs_${${dir}}) _uniquedirs_${${dir}}= ${dir} _alldirs_${dir}= ${dir} installdirs-${dir}: .PHONY @${ECHO} installing DIRS ${_alldirs_${dir}} ${INSTALL} ${${dir}TAG_ARGS} -d -m ${${dir}_MODE} -o ${${dir}_OWN} \ -g ${${dir}_GRP} ${${dir}_FLAG} ${DESTDIR}${${dir}} . else _uniquedir:= ${_uniquedirs_${${dir}}} _alldirs_${_uniquedir}+=${dir} # Connect to the single target installdirs-${dir}: installdirs-${_uniquedir} # Validate that duplicate dirs have the same metadata. . for v in TAG_ARGS _MODE _OWN _GRP _FLAG . if ${${dir}${v}:Uunset} != ${${_uniquedir}${v}:Uunset} . warning ${RELDIR}: ${dir}${v} (${${dir}${v}:U}) does not match ${_uniquedir}${v} (${${_uniquedir}${v}:U}) but both install to ${${dir}} . endif . endfor . endif # !defined(_uniquedirs_${${dir}}) . endif # defined(${dir}) && !empty(${dir}) . endfor realinstall: installdirs .endif diff --git a/share/mk/bsd.files.mk b/share/mk/bsd.files.mk index a330a8dddbbd..aedc414d6a28 100644 --- a/share/mk/bsd.files.mk +++ b/share/mk/bsd.files.mk @@ -1,147 +1,147 @@ .if !target(____) .error bsd.files.mk cannot be included directly. .endif .if !target(____) .if target(____) .error bsd.dirs.mk must be included after bsd.files.mk. .endif -____: +____: .NOTMAIN FILESGROUPS?= FILES .for group in ${FILESGROUPS} # Add in foo.yes and remove duplicates from all the groups ${${group}}:= ${${group}} ${${group}.yes} ${${group}}:= ${${group}:O:u} buildfiles: ${${group}} .endfor .if !defined(_SKIP_BUILD) all: buildfiles .endif .for group in ${FILESGROUPS} .if defined(${group}) && !empty(${group}) installfiles: installfiles-${group} ${group}OWN?= ${SHAREOWN} ${group}GRP?= ${SHAREGRP} .if ${MK_INSTALL_AS_USER} == "yes" ${group}OWN= ${SHAREOWN} ${group}GRP= ${SHAREGRP} .endif ${group}MODE?= ${SHAREMODE} ${group}DIR?= BINDIR STAGE_SETS+= ${group:C,[/*],_,g} .if ${group} == "FILES" FILESPACKAGE?= ${PACKAGE:Uutilities} FILESTAGS+= ${TAGS} .endif .if defined(NO_ROOT) .if !defined(${group}TAGS) || ! ${${group}TAGS:Mpackage=*} ${group}TAGS+= package=${${group}PACKAGE:Uutilities} .endif ${group}TAG_ARGS= -T ${${group}TAGS:[*]:S/ /,/g} .endif .if ${${group}DIR:S/^\///} == ${${group}DIR} # ${group}DIR specifies a variable that specifies a path DIRS+= ${${group}DIR} ${group}DIRTAGS= ${group}TAGS _${group}DIR= ${${group}DIR} .else # ${group}DIR specifies a path DIRS+= ${group}DIR ${group}DIRTAGS= ${${group}TAGS} _${group}DIR= ${group}DIR .endif STAGE_DIR.${group:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR}} .for file in ${${group}} ${group}OWN_${file}?= ${${group}OWN} ${group}GRP_${file}?= ${${group}GRP} .if ${MK_INSTALL_AS_USER} == "yes" ${group}OWN_${file}= ${SHAREOWN} ${group}GRP_${file}= ${SHAREGRP} .endif # ${MK_INSTALL_AS_USER} == "yes" ${group}MODE_${file}?= ${${group}MODE} # Determine the directory for the current file. Default to the parent group # DIR, then check to see how to pass that variable on below. ${group}DIR_${file}?= ${${group}DIR} .if ${${group}DIR_${file}:S/^\///} == ${${group}DIR_${file}} # DIR specifies a variable that specifies a path _${group}DIR_${file}= ${${group}DIR_${file}} .else # DIR directly specifies a path _${group}DIR_${file}= ${group}DIR_${file} .endif ${group}PREFIX_${file}= ${DESTDIR}${${_${group}DIR_${file}}} # Append DIR to DIRS if not already in place -- DIRS is already filtered, so # this is primarily to ease inspection. .for d in ${DIRS} _DIRS+= ${${d}} .endfor .if ${DIRS:M${_${group}DIR_${file}}} == "" .if ${_DIRS:M${${_${group}DIR_${file}}}} == "" DIRS+= ${_${group}DIR_${file}} .else _${group}DIR_${file}= ${group}DIR .endif .endif .if defined(${group}NAME) ${group}NAME_${file}?= ${${group}NAME} .else ${group}NAME_${file}?= ${file:T} .endif # defined(${group}NAME) STAGE_AS_${file}= ${${group}NAME_${file}} # we cannot use file safely as a set name # since we cannot? apply :T # but we can use the ${group}DIR_${file} # as a set - meta.stage.mk will :O:u for us # we need to expand ${group}DIR_${file} and replace # all '/' and '*' with '_' to make a safe target name. STAGE_AS_SETS+= ${${_${group}DIR_${file}}:C,[/*],_,g} STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}} stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file} installfiles-${group}: _${group}INS_${file} _${group}INS_${file}: ${file} installdirs-${_${group}DIR_${file}} ${INSTALL} -C ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \ -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \ ${.ALLSRC:Ninstalldirs-*} ${${group}PREFIX_${file}}/${${group}NAME_${file}} .endfor # file in ${${group}} .endif # defined(${group}) && !empty(${group}) .endfor # .for group in ${FILESGROUPS} realinstall: installfiles .ORDER: beforeinstall installfiles .if ${MK_STAGING} != "no" .if ${FILESGROUPS:@g@${$g}@} != "" .if !empty(STAGE_SETS) buildfiles: stage_files STAGE_TARGETS+= stage_files stage_files: .if !empty(STAGE_AS_SETS) buildfiles: stage_as STAGE_TARGETS+= stage_as stage_as: .endif .endif .endif .endif .include .endif # !target(____) diff --git a/share/mk/bsd.init.mk b/share/mk/bsd.init.mk index 64fdd23ce7ad..4d3acc3a1148 100644 --- a/share/mk/bsd.init.mk +++ b/share/mk/bsd.init.mk @@ -1,94 +1,94 @@ # The include file includes , # ../Makefile.inc and ; this is used at the # top of all files that actually "build something". # bsd.opts.mk is included early so Makefile.inc can use the # MK_FOO variables. .if !target(____) -____: +____: .NOTMAIN .include .-include "local.init.mk" # This is also done in bsd.obj.mk .if defined(NO_OBJ) && ${.OBJDIR} != ${.CURDIR} .OBJDIR: ${.CURDIR} .endif .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" .endif .include .MAIN: all # This is used in bsd.{dep,lib,prog}.mk as ${OBJS_SRCS_FILTER:ts:} # Some makefiles may want T as well to avoid nested objdirs. OBJS_SRCS_FILTER+= R # Handle INSTALL_AS_USER here to maximize the chance that # it has final authority over fooOWN and fooGRP. .if ${MK_INSTALL_AS_USER} != "no" .if !defined(_uid) _uid!= id -u .export _uid .endif .if ${_uid} != 0 .if !defined(_gid) _gid!= id -g .export _gid .endif .for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE $xOWN= ${_uid} $xGRP= ${_gid} .endfor .endif .endif # Some targets need to know when something may build. This is used to # optimize targets that are only needed when building something, such as # (not) reading in depend files. For DIRDEPS_BUILD, it will only calculate # the dependency graph at .MAKE.LEVEL==0, so nothing should be built there. # Skip "build" logic if: # - DIRDEPS_BUILD at MAKELEVEL 0 # - make -V is used without an override # - make install is used without other targets. This is to avoid breaking # things like 'make all install' or 'make foo install'. # - non-build targets are called .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} == 0 # targets that are ok at level 0 DIRDEPS_BUILD_LEVEL0_TARGETS += clean* destroy* M_ListToSkip?= O:u:S,^,N,:ts: .if ${.TARGETS:Uall:${DIRDEPS_BUILD_LEVEL0_TARGETS:${M_ListToSkip}}} != "" _SKIP_BUILD= not building at level 0 .endif .elif !empty(.MAKEFLAGS:M-V${_V_DO_BUILD}) || \ ${.TARGETS:M*install*} == ${.TARGETS} || \ ${.TARGETS:Mclean*} == ${.TARGETS} || \ ${.TARGETS:M*clean} == ${.TARGETS} || \ ${.TARGETS:Mdestroy*} == ${.TARGETS} || \ ${.TARGETS:Mobj} == ${.TARGETS} || \ make(analyze) || make(print-dir) # Skip building, but don't show a warning. _SKIP_BUILD= .endif .if ${MK_DIRDEPS_BUILD} == "yes" && ${.MAKE.LEVEL} > 0 && !empty(_SKIP_BUILD) .warning ${_SKIP_BUILD} .endif beforebuild: .PHONY .NOTMAIN .if !defined(_SKIP_BUILD) all: beforebuild .WAIT .endif .if ${MK_META_MODE} == "yes" .if !exists(/dev/filemon) && \ ${UPDATE_DEPENDFILE:Uyes:tl} != "no" && !defined(NO_FILEMON) && \ !make(test-system-*) && !make(showconfig) && !make(print-dir) && \ ${.MAKEFLAGS:M-V} == "" .warning The filemon module (/dev/filemon) is not loaded. .warning META_MODE is less useful for incremental builds without filemon. .warning 'kldload filemon' or pass -DNO_FILEMON to suppress this warning. .endif .endif # ${MK_META_MODE} == "yes" .endif # !target(____) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index d6e271ce0a06..b33366604b4c 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -1,579 +1,579 @@ .include .include .include .include -____: +____: .NOTMAIN .if defined(LIB_CXX) || defined(SHLIB_CXX) _LD= ${CXX} .else _LD= ${CC} .endif .if defined(LIB_CXX) LIB= ${LIB_CXX} .endif .if defined(SHLIB_CXX) SHLIB= ${SHLIB_CXX} .endif LIB_PRIVATE= ${PRIVATELIB:Dprivate} # Set up the variables controlling shared libraries. After this section, # SHLIB_NAME will be defined only if we are to create a shared library. # SHLIB_LINK will be defined only if we are to create a link to it. # INSTALL_PIC_ARCHIVE will be defined only if we are to create a PIC archive. # BUILD_NOSSP_PIC_ARCHIVE will be defined only if we are to create a PIC archive. .if defined(NO_PIC) .undef SHLIB_NAME .undef INSTALL_PIC_ARCHIVE .undef BUILD_NOSSP_PIC_ARCHIVE .else .if !defined(SHLIB) && defined(LIB) SHLIB= ${LIB} .endif .if !defined(SHLIB_NAME) && defined(SHLIB) && defined(SHLIB_MAJOR) SHLIB_NAME= lib${LIB_PRIVATE}${SHLIB}.so.${SHLIB_MAJOR} .endif .if defined(SHLIB_NAME) && !empty(SHLIB_NAME:M*.so.*) SHLIB_LINK?= ${SHLIB_NAME:R} .endif SONAME?= ${SHLIB_NAME} .endif .if defined(CRUNCH_CFLAGS) CFLAGS+= ${CRUNCH_CFLAGS} .endif .if ${MK_ASSERT_DEBUG} == "no" CFLAGS+= -DNDEBUG # XXX: shouldn't we ensure that !asserts marks potentially unused variables as # __unused instead of disabling -Werror globally? MK_WERROR= no .endif .if defined(DEBUG_FLAGS) CFLAGS+= ${DEBUG_FLAGS} .if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != "" CTFFLAGS+= -g .endif .else STRIP?= -s .endif .for _libcompat in ${_ALL_libcompats} .if ${SHLIBDIR:M*/lib${_libcompat}} || ${SHLIBDIR:M*/lib${_libcompat}/*} TAGS+= lib${_libcompat} .endif .endfor .if defined(NO_ROOT) .if !defined(TAGS) || ! ${TAGS:Mpackage=*} TAGS+= package=${PACKAGE:Uutilities} .endif TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} .endif # ELF hardening knobs .if ${MK_BIND_NOW} != "no" LDFLAGS+= -Wl,-znow .endif .if ${LINKER_TYPE} != "mac" .if ${MK_RELRO} == "no" LDFLAGS+= -Wl,-znorelro .else LDFLAGS+= -Wl,-zrelro .endif .endif .if ${MK_RETPOLINE} != "no" .if ${COMPILER_FEATURES:Mretpoline} && ${LINKER_FEATURES:Mretpoline} CFLAGS+= -mretpoline CXXFLAGS+= -mretpoline LDFLAGS+= -Wl,-zretpolineplt .else .warning Retpoline requested but not supported by compiler or linker .endif .endif # LLD sensibly defaults to -znoexecstack, so do the same for BFD LDFLAGS.bfd+= -Wl,-znoexecstack .if ${MK_BRANCH_PROTECTION} != "no" CFLAGS+= -mbranch-protection=standard .if ${LINKER_FEATURES:Mbti-report} && defined(BTI_REPORT_ERROR) LDFLAGS+= -Wl,-zbti-report=error .endif .endif # Initialize stack variables on function entry .if ${OPT_INIT_ALL} != "none" .if ${COMPILER_FEATURES:Minit-all} CFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} CXXFLAGS+= -ftrivial-auto-var-init=${OPT_INIT_ALL} .if ${OPT_INIT_ALL} == "zero" && ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 160000 CFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang CXXFLAGS+= -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang .endif .else .warning INIT_ALL (${OPT_INIT_ALL}) requested but not supported by compiler .endif .endif # Zero used registers on return (mitigate some ROP) .if ${MK_ZEROREGS} != "no" .if ${COMPILER_FEATURES:Mzeroregs} ZEROREG_TYPE?= used CFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} CXXFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE} .endif .endif # bsd.sanitizer.mk is not installed, so don't require it (e.g. for ports). .sinclude "bsd.sanitizer.mk" .if ${MK_DEBUG_FILES} != "no" && empty(DEBUG_FLAGS:M-g) && \ empty(DEBUG_FLAGS:M-gdwarf*) .if !${COMPILER_FEATURES:Mcompressed-debug} CFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} CXXFLAGS+= ${DEBUG_FILES_CFLAGS:N-gz*} .else CFLAGS+= ${DEBUG_FILES_CFLAGS} CXXFLAGS+= ${DEBUG_FILES_CFLAGS} .endif CTFFLAGS+= -g .endif .if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == "" CFLAGS += -mno-relax .endif .include # prefer .s to a .c, remove stuff not used in the BSD libraries # .pico used for PIC object files # .nossppico used for NOSSP PIC object files # .pieo used for PIE object files .SUFFIXES: .out .o .bc .ll .pico .nossppico .pieo .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln .if !defined(PICFLAG) PICFLAG=-fpic PIEFLAG=-fpie .endif .c.pico: ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .c.nossppico: ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} ${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .c.pieo: ${CC} ${PIEFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .cc.pico .C.pico .cpp.pico .cxx.pico: ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico: ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//:C/^-fsanitize.*$//} -c ${.IMPSRC} -o ${.TARGET} .cc.pieo .C.pieo .cpp.pieo .cxx.pieo: ${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} .f.pico: ${FC} ${PICFLAG} -DPIC ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} ${CTFCONVERT_CMD} .f.nossppico: ${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} -o ${.TARGET} -c ${.IMPSRC} ${CTFCONVERT_CMD} .s.pico .s.nossppico .s.pieo: ${CC:N${CCACHE_BIN}} -x assembler ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .asm.pico: ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .asm.nossppico: ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PICFLAG} -DPIC \ ${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .asm.pieo: ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PIEFLAG} -DPIC \ ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .S.pico: ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .S.nossppico: ${CC:N${CCACHE_BIN}} ${PICFLAG} -DPIC ${CFLAGS:C/^-fstack-protector.*$//:C/^-fstack-clash-protection.*$//} ${ACFLAGS} \ -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} .S.pieo: ${CC:N${CCACHE_BIN}} ${PIEFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} _LIBDIR:=${LIBDIR} _SHLIBDIR:=${SHLIBDIR} .if defined(SHLIB_NAME) .if ${MK_DEBUG_FILES} != "no" SHLIB_NAME_FULL=${SHLIB_NAME}.full # Use ${DEBUGDIR} for base system debug files, else .debug subdirectory .if ${_SHLIBDIR} == "/boot" ||\ ${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\ ${SHLIBDIR:C%/usr/lib(32|exec)?(/.*)?%/usr/lib%} == "/usr/lib" ||\ ${SHLIBDIR:C%/usr/tests(/.*)?%/usr/tests%} == "/usr/tests" DEBUGFILEDIR=${DEBUGDIR}${_SHLIBDIR} .else DEBUGFILEDIR=${_SHLIBDIR}/.debug .endif .if !exists(${DESTDIR}${DEBUGFILEDIR}) DEBUGMKDIR= .endif .else SHLIB_NAME_FULL=${SHLIB_NAME} .endif .endif .include # Allow libraries to specify their own version map or have it # automatically generated (see bsd.symver.mk above). .if !empty(VERSION_MAP) ${SHLIB_NAME_FULL}: ${VERSION_MAP} LDFLAGS+= -Wl,--version-script=${VERSION_MAP} # Ideally we'd always enable --no-undefined-version (default for lld >= 16), # but we have several symbols in our version maps that may or may not exist, # depending on compile-time defines and that needs to be handled first. .if ${MK_UNDEFINED_VERSION} == "no" LDFLAGS+= -Wl,--no-undefined-version .else LDFLAGS+= -Wl,--undefined-version .endif .endif .if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/} BCOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g} LLOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g} CLEANFILES+= ${OBJS} ${BCOBJS} ${LLOBJS} ${STATICOBJS} .endif .if defined(LIB) && !empty(LIB) .if defined(STATIC_LDSCRIPT) _STATICLIB_SUFFIX= _real .endif _LIBS= lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a: ${OBJS} ${STATICOBJS} @${ECHO} Building static ${LIB} library @rm -f ${.TARGET} ${AR} ${ARFLAGS} ${.TARGET} ${OBJS} ${STATICOBJS} ${ARADD} .endif .if !defined(INTERNALLIB) .if defined(LLVM_LINK) lib${LIB_PRIVATE}${LIB}.bc: ${BCOBJS} ${LLVM_LINK} -o ${.TARGET} ${BCOBJS} lib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS} ${LLVM_LINK} -S -o ${.TARGET} ${LLOBJS} CLEANFILES+= lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll .endif .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) SOBJS+= ${OBJS:.o=.pico} DEPENDOBJS+= ${SOBJS} CLEANFILES+= ${SOBJS} .endif .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} SOLINKOPTS+= -shared -Wl,-x .if defined(LD_FATAL_WARNINGS) && ${LD_FATAL_WARNINGS} == "no" SOLINKOPTS+= -Wl,--no-fatal-warnings .else SOLINKOPTS+= -Wl,--fatal-warnings .endif SOLINKOPTS+= -Wl,--warn-shared-textrel .if target(beforelinking) beforelinking: ${SOBJS} ${SHLIB_NAME_FULL}: beforelinking .endif .if defined(SHLIB_LINK) .if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT}) ${SHLIB_LINK:R}.ld: ${.CURDIR}/${SHLIB_LDSCRIPT} sed -e 's,@@SHLIB@@,${_SHLIBDIR}/${SHLIB_NAME},g' \ -e 's,@@LIBDIR@@,${_LIBDIR},g' \ ${.ALLSRC} > ${.TARGET} ${SHLIB_NAME_FULL}: ${SHLIB_LINK:R}.ld CLEANFILES+= ${SHLIB_LINK:R}.ld .endif CLEANFILES+= ${SHLIB_LINK} .endif ${SHLIB_NAME_FULL}: ${SOBJS} @${ECHO} Building shared library ${SHLIB_NAME} @rm -f ${SHLIB_NAME} ${SHLIB_LINK} .if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) && ${MK_DEBUG_FILES} == "no" # Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR @${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK} .endif ${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} ${SOBJS} ${LDADD} .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} .endif .if ${MK_DEBUG_FILES} != "no" CLEANFILES+= ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug ${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.debug ${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.debug \ ${SHLIB_NAME_FULL} ${.TARGET} .if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld) # Note: This uses ln instead of ${INSTALL_LIBSYMLINK} since we are in OBJDIR @${LN:Uln} -fs ${SHLIB_NAME} ${SHLIB_LINK} .endif ${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL} ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} .endif .endif #defined(SHLIB_NAME) .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) _LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a lib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS} @${ECHO} Building special pic ${LIB} library @rm -f ${.TARGET} ${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD} .endif .if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) NOSSPSOBJS+= ${OBJS:.o=.nossppico} DEPENDOBJS+= ${NOSSPSOBJS} CLEANFILES+= ${NOSSPSOBJS} _LIBS+= lib${LIB_PRIVATE}${LIB}_nossp_pic.a lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} @${ECHO} Building special nossp pic ${LIB} library @rm -f ${.TARGET} ${AR} ${ARFLAGS} ${.TARGET} ${NOSSPSOBJS} ${ARADD} .endif .endif # !defined(INTERNALLIB) .if defined(INTERNALLIB) && ${MK_PIE} != "no" && defined(LIB) && !empty(LIB) PIEOBJS+= ${OBJS:.o=.pieo} DEPENDOBJS+= ${PIEOBJS} CLEANFILES+= ${PIEOBJS} _LIBS+= lib${LIB_PRIVATE}${LIB}_pie.a lib${LIB_PRIVATE}${LIB}_pie.a: ${PIEOBJS} @${ECHO} Building pie ${LIB} library @rm -f ${.TARGET} ${AR} ${ARFLAGS} ${.TARGET} ${PIEOBJS} ${ARADD} .endif .if defined(_SKIP_BUILD) all: .else .if defined(_LIBS) && !empty(_LIBS) all: ${_LIBS} .endif .if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) all: all-man .endif .endif CLEANFILES+= ${_LIBS} _EXTRADEPEND: .if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) .if defined(DPADD) && !empty(DPADD) echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE} .endif .endif .if !target(install) INSTALLFLAGS+= -C .if defined(PRECIOUSLIB) .if !defined(NO_FSCHG) SHLINSTALLFLAGS+= -fschg .endif .endif # Install libraries with -S to avoid risk of modifying in-use libraries when # installing to a running system. It is safe to avoid this for NO_ROOT builds # that are only creating an image. # # XXX: Since Makefile.inc1 ends up building lib/libc both as part of # _startup_libs and as part of _generic_libs it ends up getting installed a # second time during the parallel build, and although the .WAIT in lib/Makefile # stops that mattering for lib, other directories like secure/lib are built in # parallel at the top level and are unaffected by that, so can sometimes race # with the libc.so.7 reinstall and see a missing or corrupt file. Ideally the # build system would be fixed to not build/install libc to WORLDTMP the second # time round, but for now using -S ensures the install is atomic and thus we # never see a broken intermediate state, so use it even for NO_ROOT builds. .if !defined(NO_SAFE_LIBINSTALL) #&& !defined(NO_ROOT) SHLINSTALLFLAGS+= -S SHLINSTALLSYMLINKFLAGS+= -S .endif _INSTALLFLAGS:= ${INSTALLFLAGS} .for ie in ${INSTALLFLAGS_EDIT} _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} .endfor _SHLINSTALLFLAGS:= ${SHLINSTALLFLAGS} _SHLINSTALLSYMLINKFLAGS:= ${SHLINSTALLSYMLINKFLAGS} .for ie in ${INSTALLFLAGS_EDIT} _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} .endfor .if defined(PCFILES) .for pcfile in ${PCFILES} installpcfiles: installpcfiles-${pcfile} installpcfiles-${pcfile}: ${pcfile} ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} \ ${.ALLSRC} ${DESTDIR}${LIBDATADIR}/pkgconfig/ .endfor .endif installpcfiles: .PHONY .if !defined(INTERNALLIB) realinstall: _libinstall installpcfiles .ORDER: beforeinstall _libinstall _libinstall: .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a ${DESTDIR}${_LIBDIR}/ .endif .if defined(SHLIB_NAME) ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/ .if ${MK_DEBUG_FILES} != "no" .if defined(DEBUGMKDIR) ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/ .endif ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \ ${_INSTALLFLAGS} \ ${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/ .endif .if defined(SHLIB_LINK) .if commands(${SHLIB_LINK:R}.ld) ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \ ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} .for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS} ${INSTALL_LIBSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${SHLIB_LINK} \ ${DESTDIR}${_LIBDIR}/${_SHLIB_LINK_LINK} .endfor .else .if ${_SHLIBDIR} == ${_LIBDIR} .if ${SHLIB_LINK:Mlib*} ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS:D${TAG_ARGS},dev} \ ${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} .else ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \ ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} .endif .else .if ${SHLIB_LINK:Mlib*} ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS:D${TAG_ARGS},dev} \ ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} .else ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} \ ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK} .endif .if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME}) -chflags noschg ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} rm -f ${DESTDIR}${_LIBDIR}/${SHLIB_NAME} .endif .endif # _SHLIBDIR == _LIBDIR .endif # SHLIB_LDSCRIPT .endif # SHLIB_LINK .endif # SHIB_NAME .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/ .endif .endif # !defined(INTERNALLIB) .if !defined(LIBRARIES_ONLY) .include .include .include #No need to install header for INTERNALLIB .if !defined(INTERNALLIB) .include .endif .endif LINKOWN?= ${LIBOWN} LINKGRP?= ${LIBGRP} LINKMODE?= ${LIBMODE} SYMLINKOWN?= ${LIBOWN} SYMLINKGRP?= ${LIBGRP} LINKTAGS= dev .include .if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) realinstall: maninstall .ORDER: beforeinstall maninstall .endif .endif .if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY) .include .endif .if defined(LIB) && !empty(LIB) OBJS_DEPEND_GUESS+= ${SRCS:M*.h} .endif .if defined(SHLIB_NAME) || \ defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) .for _S in ${SRCS:N*.[hly]} OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S} .endfor .endif .if defined(BUILD_NOSSP_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) .for _S in ${SRCS:N*.[hly]} OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.nossppico+= ${_S} .endfor .endif .if defined(HAS_TESTS) MAKE+= MK_MAKE_CHECK_USE_SANDBOX=yes SUBDIR_TARGETS+= check TESTS_LD_LIBRARY_PATH+= ${.OBJDIR} .endif .include .include .include .include diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk index cceeadd05b94..95d98231b641 100644 --- a/share/mk/bsd.linker.mk +++ b/share/mk/bsd.linker.mk @@ -1,141 +1,141 @@ # Setup variables for the linker. # # LINKER_TYPE is the major type of linker. Currently binutils and lld support # automatic detection. # # LINKER_VERSION is a numeric constant equal to: # major * 10000 + minor * 100 + tiny # It too can be overridden on the command line. # # LINKER_FEATURES may contain one or more of the following, based on # linker support for that feature: # # - build-id: support for generating a Build-ID note # - retpoline: support for generating PLT with retpoline speculative # execution vulnerability mitigation # - bti-report: support for specifying how to report the missing # Branch Target Identification (BTI) property (AArch64) # # LINKER_FREEBSD_VERSION is the linker's internal source version. # # These variables with an X_ prefix will also be provided if XLD is set. # # This file may be included multiple times, but only has effect the first time. # .if !target(____) -____: +____: .NOTMAIN _ld_vars=LD $${_empty_var_} .if !empty(_WANT_TOOLCHAIN_CROSS_VARS) # Only the toplevel makefile needs to compute the X_LINKER_* variables. _ld_vars+=XLD X_ .endif .for ld X_ in ${_ld_vars} .if ${ld} == "LD" || !empty(XLD) # Try to import LINKER_TYPE and LINKER_VERSION from parent make. # The value is only used/exported for the same environment that impacts # LD and LINKER_* settings here. _exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION ${X_}LINKER_FEATURES \ ${X_}LINKER_FREEBSD_VERSION ${X_}_ld_hash= ${${ld}}${MACHINE}${PATH} ${X_}_ld_hash:= ${${X_}_ld_hash:hash} # Only import if none of the vars are set differently somehow else. _can_export= yes .for var in ${_exported_vars} .if defined(${var}) && (!defined(${var}__${${X_}_ld_hash}) || ${${var}__${${X_}_ld_hash}} != ${${var}}) .if defined(${var}__${${X_}_ld_hash}) .info Cannot import ${X_}LINKER variables since cached ${var} is different: ${${var}__${${X_}_ld_hash}} != ${${var}} .endif _can_export= no .endif .endfor .if ${_can_export} == yes .for var in ${_exported_vars} .if defined(${var}__${${X_}_ld_hash}) ${var}= ${${var}__${${X_}_ld_hash}} .endif .endfor .endif .if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) .if !defined(${X_}LINKER_TYPE) || !defined(${X_}LINKER_VERSION) _ld_version!= (${${ld}} -v 2>&1 || echo none) | sed -n 1p .if ${_ld_version} == "none" .warning Unable to determine linker type from ${ld}=${${ld}} .endif .if ${_ld_version:[1..2]} == "GNU ld" ${X_}LINKER_TYPE= bfd ${X_}LINKER_FREEBSD_VERSION= 0 _v= ${_ld_version:M[1-9]*.[0-9]*:[1]} .elif ${_ld_version:MLLD} # Strip any leading PACKAGE_VENDOR string (e.g. "Homebrew") _ld_version:=${_ld_version:[*]:C/^.* LLD /LLD /:[@]} ${X_}LINKER_TYPE= lld _v= ${_ld_version:[2]} .if ${_ld_version:[3]} == "(FreeBSD" ${X_}LINKER_FREEBSD_VERSION:= ${_ld_version:[4]:C/.*-([^-]*)\)/\1/} .else ${X_}LINKER_FREEBSD_VERSION= 0 .endif .elif ${_ld_version:[1]:S/-classic$//} == "@(\#)PROGRAM:ld" # bootstrap linker on MacOS ${X_}LINKER_TYPE= mac _v= ${_ld_version:[2]:C/PROJECT:(ld64|dyld)-//} # Convert version 409.12 to 409.12.0 so that the echo + awk below works .if empty(_v:M[1-9]*.[0-9]*.[0-9]*) && !empty(_v:M[1-9]*.[0-9]*) _v:=${_v}.0 .else # Some versions do not contain a minor version so we need to append .0.0 there _v:=${_v}.0.0 .endif .else .warning Unknown linker from ${ld}=${${ld}}: ${_ld_version}, defaulting to bfd ${X_}LINKER_TYPE= bfd _v= 2.17.50 .endif ${X_}LINKER_VERSION!= echo "${_v:M[1-9]*.[0-9]*}" | \ awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .undef _ld_version .undef _v ${X_}LINKER_FEATURES= .if ${${X_}LINKER_TYPE} != "bfd" || ${${X_}LINKER_VERSION} > 21750 ${X_}LINKER_FEATURES+= build-id ${X_}LINKER_FEATURES+= ifunc .endif .if ${${X_}LINKER_TYPE} == "bfd" && ${${X_}LINKER_VERSION} > 21750 ${X_}LINKER_FEATURES+= riscv-relaxations .endif .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 60000 ${X_}LINKER_FEATURES+= retpoline .endif .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 90000 ${X_}LINKER_FEATURES+= ifunc-noplt .endif .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 140000 ${X_}LINKER_FEATURES+= bti-report .endif .endif .else # Use LD's values X_LINKER_TYPE= ${LINKER_TYPE} X_LINKER_VERSION= ${LINKER_VERSION} X_LINKER_FEATURES= ${LINKER_FEATURES} X_LINKER_FREEBSD_VERSION= ${LINKER_FREEBSD_VERSION} .endif # ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) # Export the values so sub-makes don't have to look them up again, using the # hash key computed above. .for var in ${_exported_vars} ${var}__${${X_}_ld_hash}:= ${${var}} .export-env ${var}__${${X_}_ld_hash} .undef ${var}__${${X_}_ld_hash} .endfor .endif # ${ld} == "LD" || !empty(XLD) .endfor # .for ld in LD XLD .endif # !target(____) diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk index 578423914c6b..91dac6805b12 100644 --- a/share/mk/bsd.obj.mk +++ b/share/mk/bsd.obj.mk @@ -1,248 +1,248 @@ # # The include file handles creating the 'obj' directory # and cleaning up object files, etc. # # +++ variables +++ # # CLEANDIRS Additional directories to remove for the clean target. # # CLEANFILES Additional files to remove for the clean target. # # MAKEOBJDIR A pathname for the directory where the targets # are built. Note: MAKEOBJDIR is an *environment* variable # and works properly only if set as an environment variable, # not as a global or command line variable! # # E.g. use `env MAKEOBJDIR=temp-obj make' # # MAKEOBJDIRPREFIX Specifies somewhere other than /usr/obj to root the object # tree. Note: MAKEOBJDIRPREFIX is an *environment* variable # and works properly only if set as an environment variable, # not as a global or command line variable! # # E.g. use `env MAKEOBJDIRPREFIX=/somewhere/obj make' # # NO_OBJ Do not create object directories. This should not be set # if anything is built. # # +++ targets +++ # # clean: # remove ${CLEANFILES}; remove ${CLEANDIRS} and all contents. # # cleandir: # remove the build directory (and all its contents) created by obj # # obj: # create build directory. # .if !target(____) -____: +____: .NOTMAIN .include # This is also done in bsd.init.mk .if defined(NO_OBJ) && ${.OBJDIR} != ${.CURDIR} # but this makefile does not want it! .OBJDIR: ${.CURDIR} .endif .if ${MK_AUTO_OBJ} == "yes" # it is done by now objwarn: .PHONY obj: .PHONY CANONICALOBJDIR= ${.OBJDIR} # Handle special case where SRCS is full-pathed and requires # nested objdirs. This duplicates some auto.obj.mk logic. .if (!empty(SRCS:M*/*) || !empty(DPSRCS:M*/*)) && \ (${.TARGETS} == "" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} != "") && \ !make(print-dir) && empty(.MAKEFLAGS:M-[nN]) _wantdirs= ${SRCS:M*/*:H} ${DPSRCS:M*/*:H} .if !empty(_wantdirs) _wantdirs:= ${_wantdirs:O:u} _needdirs= .for _dir in ${_wantdirs} .if !exists(${.OBJDIR}/${_dir}/) _needdirs+= ${_dir} .endif .endfor .endif .if !empty(_needdirs) #_mkneededdirs!= umask ${OBJDIR_UMASK:U002}; ${Mkdirs} ${_needdirs} __objdir_made != umask ${OBJDIR_UMASK:U002}; ${Mkdirs}; \ for dir in ${_needdirs}; do \ dir=${.OBJDIR}/$${dir}; \ ${ECHO_TRACE} "[Creating nested objdir $${dir}...]" >&2; \ Mkdirs $${dir}; \ done .endif .endif # !empty(SRCS:M*/*) || !empty(DPSRCS:M*/*) .elif !empty(MAKEOBJDIRPREFIX) CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} .elif defined(MAKEOBJDIR) && ${MAKEOBJDIR:M/*} != "" CANONICALOBJDIR:=${MAKEOBJDIR} OBJTOP?= ${MAKEOBJDIR} .else CANONICALOBJDIR:=/usr/obj${.CURDIR} .endif .if defined(SRCTOP) && defined(RELDIR) && \ (${CANONICALOBJDIR} == /${RELDIR} || ${.OBJDIR} == /${RELDIR}) .error .OBJDIR incorrectly set to /${RELDIR} .endif OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP} # # Warn of unorthodox object directory. # # The following directories are tried in order for ${.OBJDIR}: # # 1. ${MAKEOBJDIRPREFIX}/`pwd` # 2. ${MAKEOBJDIR} # 3. obj.${MACHINE} # 4. obj # 5. /usr/obj/`pwd` # 6. ${.CURDIR} # # If ${.OBJDIR} is constructed using canonical cases 1 or 5, or # case 2 (using MAKEOBJDIR), don't issue a warning. Otherwise, # issue a warning differentiating between cases 6 and (3 or 4). # objwarn: .PHONY .if !defined(NO_OBJ) && ${.OBJDIR} != ${CANONICALOBJDIR} && \ !(defined(MAKEOBJDIRPREFIX) && exists(${CANONICALOBJDIR}/)) && \ !(defined(MAKEOBJDIR) && exists(${MAKEOBJDIR}/)) .if ${.OBJDIR} == ${.CURDIR} @${ECHO} "Warning: Object directory not changed from original ${.CURDIR}" .elif exists(${.CURDIR}/obj.${MACHINE}/) || exists(${.CURDIR}/obj/) @${ECHO} "Warning: Using ${.OBJDIR} as object directory instead of\ canonical ${CANONICALOBJDIR}" .endif .endif beforebuild: objwarn .if !defined(NO_OBJ) .if !target(obj) obj: .PHONY @if ! test -d ${CANONICALOBJDIR}/; then \ mkdir -p ${CANONICALOBJDIR}; \ if ! test -d ${CANONICALOBJDIR}/; then \ ${ECHO} "Unable to create ${CANONICALOBJDIR}."; \ exit 1; \ fi; \ ${ECHO} "${CANONICALOBJDIR} created for ${.CURDIR}"; \ fi .for dir in ${SRCS:H:O:u} ${DPSRCS:H:O:u} @if ! test -d ${CANONICALOBJDIR}/${dir}/; then \ mkdir -p ${CANONICALOBJDIR}/${dir}; \ if ! test -d ${CANONICALOBJDIR}/${dir}/; then \ ${ECHO} "Unable to create ${CANONICALOBJDIR}/${dir}."; \ exit 1; \ fi; \ ${ECHO} "${CANONICALOBJDIR}/${dir} created for ${.CURDIR}"; \ fi .endfor .endif .if !target(objlink) objlink: .PHONY @if test -d ${CANONICALOBJDIR}/; then \ rm -f ${.CURDIR}/obj; \ ln -s ${CANONICALOBJDIR} ${.CURDIR}/obj; \ else \ echo "No ${CANONICALOBJDIR} to link to - do a make obj."; \ fi .endif .endif # !defined(NO_OBJ) # # where would that obj directory be? # .if !target(whereobj) whereobj: .PHONY @echo ${.OBJDIR} .endif # Same check in bsd.progs.mk .if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/) && \ (${MK_AUTO_OBJ} == "no" || ${.TARGETS:Nclean*:N*clean:Ndestroy*} == "") cleanobj: .PHONY -rm -rf ${CANONICALOBJDIR} .else cleanobj: .PHONY clean cleandepend .endif @if [ -L ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi # Tell bmake not to look for generated files via .PATH NOPATH_FILES+= ${CLEANFILES} .if !empty(NOPATH_FILES) .NOPATH: ${NOPATH_FILES} .endif .if !target(clean) clean: .PHONY .if defined(CLEANFILES) && !empty(CLEANFILES) rm -f ${CLEANFILES} .endif .if defined(CLEANDIRS) && !empty(CLEANDIRS) -rm -rf ${CLEANDIRS} .endif .endif .ORDER: clean all .if ${MK_AUTO_OBJ} == "yes" .ORDER: cleanobj all .ORDER: cleandir all .endif .include cleandir: .PHONY .WAIT cleanobj .if make(destroy*) && defined(OBJROOT) # this (rm -rf objdir) is much faster and more reliable than cleaning. # just in case we are playing games with these... _OBJDIR?= ${.OBJDIR} _CURDIR?= ${.CURDIR} # destroy almost everything destroy: .PHONY destroy-all destroy-all: .PHONY # just remove our objdir destroy-arch: .PHONY .NOMETA .if ${_OBJDIR} != ${_CURDIR} cd ${_CURDIR} && rm -rf ${_OBJDIR} .endif .if defined(HOST_OBJTOP) destroy-host: destroy.host destroy.host: .PHONY .NOMETA cd ${_CURDIR} && rm -rf ${HOST_OBJTOP}/${RELDIR:N.} .endif .if make(destroy-all) && ${RELDIR} == "." destroy-all: destroy-stage .endif # remove the stage tree destroy-stage: .PHONY .NOMETA .if defined(STAGE_ROOT) cd ${_CURDIR} && rm -rf ${STAGE_ROOT} .endif # allow parallel destruction _destroy_machine_list = common host ${ALL_MACHINE_LIST} .for m in ${_destroy_machine_list:O:u} destroy-all: destroy.$m .if !target(destroy.$m) destroy.$m: .PHONY .NOMETA .if ${_OBJDIR} != ${_CURDIR} cd ${_CURDIR} && rm -rf ${OBJROOT}$m*/${RELDIR:N.} .endif .endif .endfor .endif .endif # !target(____) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index f79c5bc61a20..a9400186f78a 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -1,124 +1,124 @@ # # Option file for bmake builds. These options are available to all users of # bmake (including the source tree userland and kernel builds). They generally # control how binaries are made, shared vs dynamic, etc and some general options # relevant for all build environments. # # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} # with (usually) sensible defaults. # # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that # are applicable for that Makefile (typically there are none, but sometimes there # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish # to omit from that make. # # Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO # variable. # # Makefiles may also assume that this file is included by bsd.own.mk should it # need variables defined there prior to the end of the Makefile where # bsd.{subdir,lib.bin}.mk is traditionally included. # # The old-style YES_FOO and NO_FOO are being phased out. No new instances of them # should be added. Old instances should be removed since they were just to # bridge the gap between FreeBSD 4 and FreeBSD 5. # # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an # exception is made for _WITHOUT_SRCONF which turns off this mechanism # completely). # .if !target(____) -____: +____: .NOTMAIN .if !defined(_WITHOUT_SRCCONF) # # Define MK_* variables (which are either "yes" or "no") for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the # make(1) environment. # These should be tested with `== "no"' or `!= "no"' in makefiles. # The NO_* variables should only be set by makefiles for variables # that haven't been converted over. # # Only these options are used by bsd.*.mk. KERBEROS and OPENSSH are # unfortunately needed to support statically linking the entire # tree. su(1) wouldn't link since it depends on PAM which depends on # ssh libraries when building with OPENSSH, and likewise for KERBEROS. # All other variables used to build /usr/src live in src.opts.mk # and variables from both files are documented in src.conf(5). __DEFAULT_YES_OPTIONS = \ ASSERT_DEBUG \ DEBUG_FILES \ DOCCOMPRESS \ INCLUDES \ INSTALLLIB \ KERBEROS \ MAKE_CHECK_USE_SANDBOX \ MAN \ MANCOMPRESS \ MANSPLITPKG \ NIS \ NLS \ OPENSSH \ RELRO \ SSP \ TESTS \ TOOLCHAIN \ WARNS \ WERROR __DEFAULT_NO_OPTIONS = \ ASAN \ BIND_NOW \ BRANCH_PROTECTION \ CCACHE_BUILD \ CTF \ INSTALL_AS_USER \ RETPOLINE \ STALE_STAGED \ UBSAN \ UNDEFINED_VERSION \ ZEROREGS __DEFAULT_DEPENDENT_OPTIONS = \ MAKE_CHECK_USE_SANDBOX/TESTS \ STAGING_MAN/STAGING \ STAGING_PROG/STAGING \ STALE_STAGED/STAGING \ # # Default to disabling PIE on 32-bit architectures. The small address space # means that ASLR is of limited effectiveness, and it may cause issues with # some memory-hungry workloads. # .if ${MACHINE_ARCH} == "armv7" \ || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" \ || ${MACHINE_ARCH} == "powerpcspe" __DEFAULT_NO_OPTIONS+= PIE .else __DEFAULT_YES_OPTIONS+=PIE .endif .if ${MACHINE_CPUARCH} != "aarch64" BROKEN_OPTIONS+= BRANCH_PROTECTION .endif __SINGLE_OPTIONS = \ INIT_ALL __INIT_ALL_OPTIONS= none pattern zero __INIT_ALL_DEFAULT= none .-include .include .include .endif # !_WITHOUT_SRCCONF .endif diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index bc53f3679e77..0c47ba9af5c4 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -1,293 +1,293 @@ # # The include file set common variables for owner, # group, mode, and directories. Defaults are in brackets. # # # +++ variables +++ # # DESTDIR Change the tree where the file gets installed. [not set] # # DISTDIR Change the tree where the file for a distribution # gets installed (see /usr/src/release/Makefile). [not set] # # COMPRESS_CMD Program to compress documents. # Output is to stdout. [gzip -cn] # # COMPRESS_EXT File name extension of ${COMPRESS_CMD} command. [.gz] # # BINOWN Binary owner. [root] # # BINGRP Binary group. [wheel] # # BINMODE Binary mode. [555] # # NOBINMODE Mode for non-executable files. [444] # # LIBDIR Base path for libraries. [/usr/lib] # # LIBCOMPATDIR Base path for compat libraries. [/usr/lib/compat] # # LIBDATADIR Base path for misc. utility data files. [/usr/libdata] # # LIBEXECDIR Base path for system daemons and utilities. [/usr/libexec] # # SHLIBDIR Base path for shared libraries. [${LIBDIR}] # # LIBOWN Library owner. [${BINOWN}] # # LIBGRP Library group. [${BINGRP}] # # LIBMODE Library mode. [${NOBINMODE}] # # # DEBUGDIR Base path for standalone debug files. [/usr/lib/debug] # # DEBUGMODE Mode for debug files. [${NOBINMODE}] # # # KMODDIR Base path for loadable kernel modules # (see kld(4)). [/boot/modules] # # KMODOWN Kernel and KLD owner. [${BINOWN}] # # KMODGRP Kernel and KLD group. [${BINGRP}] # # KMODMODE KLD mode. [${BINMODE}] # # # EFIDIR Base path for the UEFI ESP [/boot/efi] # # EFIOWN EFIDIR owner. [root] # # EFIGRP EFIDIR group. [wheel] # # EFIMODE EFIDIR mode. [555] # # # SHAREDIR Base path for architecture-independent ascii # text files. [/usr/share] # # SHAREOWN ASCII text file owner. [root] # # SHAREGRP ASCII text file group. [wheel] # # SHAREMODE ASCII text file mode. [${NOBINMODE}] # # # CONFDIR Base path for configuration files. [/etc] # # CONFOWN Configuration file owner. [root] # # CONFGRP Configuration file group. [wheel] # # CONFMODE Configuration file mode. [644] # # # DIROWN Directory owner. [root] # # DIRGRP Directory group. [wheel] # # DIRMODE Directory mode. [755] # # # DOCDIR Base path for system documentation (e.g. PSD, USD, # handbook, FAQ etc.). [${SHAREDIR}/doc] # # DOCOWN Documentation owner. [${SHAREOWN}] # # DOCGRP Documentation group. [${SHAREGRP}] # # DOCMODE Documentation mode. [${NOBINMODE}] # # # INFODIR Base path for GNU's hypertext system # called Info (see info(1)). [${SHAREDIR}/info] # # INFOOWN Info owner. [${SHAREOWN}] # # INFOGRP Info group. [${SHAREGRP}] # # INFOMODE Info mode. [${NOBINMODE}] # # # MANDIR Base path for manual installation. [${SHAREDIR}/man/man] # # MANOWN Manual owner. [${SHAREOWN}] # # MANGRP Manual group. [${SHAREGRP}] # # MANMODE Manual mode. [${NOBINMODE}] # # # NLSDIR Base path for National Language Support files # installation. [${SHAREDIR}/nls] # # NLSOWN National Language Support files owner. [${SHAREOWN}] # # NLSGRP National Language Support files group. [${SHAREGRP}] # # NLSMODE National Language Support files mode. [${NOBINMODE}] # # INCLUDEDIR Base path for standard C include files [/usr/include] # # PKG_CMD Program for creating and manipulating packages. # [pkg] # # LINKOWN Hard link owner [${BINOWN}] # # LINKGRP Hard link group [${BINGRP}] # # LINKMODE Hard link mode [${NOBINMODE}] # # SYMLINKOWN Symbolic link owner [${BINOWN} or ${LIBOWN}] # # SYMLINKGRP Symbolic link group [${BINGRP} or ${LIBGRP}] # # SYMLINKMODE Symbolic link mode [755] .if !target(____) -____: +____: .NOTMAIN .include # options now here or src.opts.mk .if !defined(_WITHOUT_SRCCONF) .if ${MK_CTF} != "no" CTFCONVERT_CMD= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} .else CTFCONVERT_CMD= .endif .endif # !_WITHOUT_SRCCONF # Binaries BINOWN?= root BINGRP?= wheel BINMODE?= 555 NOBINMODE?= 444 KMODDIR?= /boot/modules KMODOWN?= ${BINOWN} KMODGRP?= ${BINGRP} KMODMODE?= ${NOBINMODE} DTBDIR?= /boot/dtb DTBODIR?= /boot/dtb/overlays DTBOWN?= root DTBGRP?= wheel DTBMODE?= 444 EFIDIR?= /boot/efi EFIOWN?= root EFIGRP?= wheel EFIMODE?= 555 # Use make.conf / environment LIBDIR as default if set... .if !empty(_PREMK_LIBDIR) LIBDIR_BASE?= ${_PREMK_LIBDIR} .endif # otherwise use our expected default value. LIBDIR_BASE?= /usr/lib LIBDIR?= ${LIBDIR_BASE} LIBCOMPATDIR?= /usr/lib/compat LIBDATADIR?= /usr/libdata LIBEXECDIR?= /usr/libexec SHLIBDIR?= ${LIBDIR} LIBOWN?= ${BINOWN} LIBGRP?= ${BINGRP} LIBMODE?= ${NOBINMODE} DEBUGDIR?= /usr/lib/debug DEBUGMODE?= ${NOBINMODE} # Share files SHAREDIR?= /usr/share SHAREOWN?= root SHAREGRP?= wheel SHAREMODE?= ${NOBINMODE} CONFDIR?= /etc CONFOWN?= root CONFGRP?= wheel CONFMODE?= 644 MANDIR?= ${SHAREDIR}/man/man MANOWN?= ${SHAREOWN} MANGRP?= ${SHAREGRP} MANMODE?= ${NOBINMODE} DIROWN?= root DIRGRP?= wheel DIRMODE?= 755 DOCDIR?= ${SHAREDIR}/doc DOCOWN?= ${SHAREOWN} DOCGRP?= ${SHAREGRP} DOCMODE?= ${NOBINMODE} INFODIR?= ${SHAREDIR}/info INFOOWN?= ${SHAREOWN} INFOGRP?= ${SHAREGRP} INFOMODE?= ${NOBINMODE} NLSDIR?= ${SHAREDIR}/nls NLSOWN?= ${SHAREOWN} NLSGRP?= ${SHAREGRP} NLSMODE?= ${NOBINMODE} INCLUDEDIR?= /usr/include # # install(1) parameters. # _LINKOWN?= ${LINKOWN:U${BINOWN}} _LINKGRP?= ${LINKGRP:U${BINGRP}} _LINKMODE?= ${LINKMODE:U${NOBINMODE}} _SYMLINKOWN?= ${SYMLINKOWN:U${BINOWN}} _SYMLINKGRP?= ${SYMLINKGRP:U${BINGRP}} _SYMLINKMODE?= ${SYMLINKMODE:U755} HRDLINK?= -l mr -o ${_LINKOWN} -g ${_LINKGRP} -m ${_LINKMODE} MANHRDLINK?= -l h -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} SYMLINK?= -l s -o ${_SYMLINKOWN} -g ${_SYMLINKGRP} -m ${_SYMLINKMODE} LSYMLINK?= -l s -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} RSYMLINK?= -l rs -o ${_SYMLINKOWN} -g ${_SYMLINKGRP} -m ${_SYMLINKMODE} INSTALL_LINK?= ${INSTALL} ${HRDLINK} INSTALL_MANLINK?= ${INSTALL} ${MANHRDLINK} INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK} INSTALL_LIBSYMLINK?= ${INSTALL} ${LSYMLINK} INSTALL_RSYMLINK?= ${INSTALL} ${RSYMLINK} # Common variables .if !defined(DEBUG_FLAGS) STRIP?= -s .endif TAR_CMD?= tar COMPRESS_CMD?= gzip -cn COMPRESS_EXT?= .gz # Set XZ_THREADS to 1 to disable multi-threading. XZ_THREADS?= 0 .if !empty(XZ_THREADS) XZ_CMD?= xz -T ${XZ_THREADS} .else XZ_CMD?= xz .endif PKG_CMD?= pkg # Pointer to the top directory into which tests are installed. Should not be # overridden by Makefiles, but the user may choose to set this in src.conf(5). TESTSBASE?= /usr/tests DEPENDFILE?= .depend # Compat for the moment -- old bsd.own.mk only included this when _WITHOUT_SRCCONF # wasn't defined. bsd.ports.mk and friends depend on this behavior. Remove in 12. .if !defined(_WITHOUT_SRCCONF) .include .endif # !_WITHOUT_SRCCONF .endif # !target(____) diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 565af41602c0..cf19c9d66201 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -1,209 +1,209 @@ # The include file contains the default targets # for building subdirectories. # # For all of the directories listed in the variable SUBDIRS, the # specified directory will be visited and the target made. There is # also a default target which allows the command "make subdir" where # subdir is any directory listed in the variable SUBDIRS. # # # +++ variables +++ # # DISTRIBUTION Name of distribution. [base] # # SUBDIR A list of subdirectories that should be built as well. # Each of the targets will execute the same target in the # subdirectories. SUBDIR.yes and SUBDIR.yes.yes are # automatically appended to this list. # # +++ targets +++ # # distribute: # This is a variant of install, which will # put the stuff into the right "distribution". # # See SUBDIR_TARGETS for list of targets that will recurse. # # Targets defined in STANDALONE_SUBDIR_TARGETS will always be ran # with SUBDIR_PARALLEL and will not respect .WAIT or SUBDIR_DEPEND_ # values. # # SUBDIR_TARGETS and STANDALONE_SUBDIR_TARGETS can be appended to # via make.conf or src.conf. # .if !target(____) -____: +____: .NOTMAIN .if ${MK_AUTO_OBJ} == "no" _obj= obj .endif SUBDIR_TARGETS+= \ all all-man analyze buildconfig buildfiles buildincludes \ checkdpadd clean cleandepend cleandir cleanilinks \ cleanobj depend distribute files includes installconfig \ installdirs \ installfiles installincludes print-dir realinstall \ maninstall manlint ${_obj} objlink tags \ # Described above. STANDALONE_SUBDIR_TARGETS+= \ all-man buildconfig buildfiles buildincludes check checkdpadd \ clean cleandepend cleandir cleanilinks cleanobj files includes \ installconfig installdirs installincludes installfiles print-dir \ maninstall manlint obj objlink .include .if ${MK_META_MODE} == "yes" .MAKE.JOB.PREFIX= ECHODIR= : .endif .if make(print-dir) NEED_SUBDIR= 1 ECHODIR= : .SILENT: .if ${RELDIR:U.} != "." print-dir: .PHONY @echo ${RELDIR} .endif .endif .if ${MK_AUTO_OBJ} == "yes" && !target(obj) obj: .PHONY .endif .if !defined(NEED_SUBDIR) # .MAKE.DEPENDFILE==/dev/null is set by bsd.dep.mk to avoid reading # Makefile.depend .if ${.MAKE.LEVEL} == 0 && ${MK_DIRDEPS_BUILD} == "yes" && !empty(SUBDIR) && \ ${.MAKE.DEPENDFILE} != "/dev/null" .include # ignore this _SUBDIR: .endif .endif DISTRIBUTION?= base .if !target(distribute) distribute: .MAKE .for dist in ${DISTRIBUTION} ${_+_}cd ${.CURDIR}; \ ${MAKE} install installconfig -DNO_SUBDIR DISTBASE=/${dist} DESTDIR=${DISTDIR}/${dist} SHARED=copies .endfor .endif # Convenience targets to run 'build${target}' and 'install${target}' when # calling 'make ${target}'. .for __target in files includes .if !target(${__target}) ${__target}: build${__target} install${__target} .ORDER: build${__target} install${__target} .endif .endfor # Make 'install' supports a before and after target. Actual install # hooks are placed in 'realinstall'. .if !target(install) .for __stage in before real after .if !target(${__stage}install) ${__stage}install: .endif .endfor install: beforeinstall realinstall afterinstall .ORDER: beforeinstall realinstall afterinstall .endif .ORDER: all install # SUBDIR recursing may be disabled for MK_DIRDEPS_BUILD .if !target(_SUBDIR) .if defined(SUBDIR) || defined(SUBDIR.yes) || defined(SUBDIR.yes.yes) SUBDIR:=${SUBDIR} ${SUBDIR.yes} ${SUBDIR.yes.yes} SUBDIR:=${SUBDIR:u} .endif .if defined(SUBDIR.) .error ${.CURDIR}: Found variable 'SUBDIR.' with value "${SUBDIR.}". This was\ probably caused by using SUBDIR.$${MK_FOO} without including\ or by using an invalid $${MK_FOO} option. .endif # Subdir code shared among 'make ', 'make ' and SUBDIR_PARALLEL. _SUBDIR_SH= \ if test -d ${.CURDIR}/$${dir}.${MACHINE_ARCH}; then \ dir=$${dir}.${MACHINE_ARCH}; \ fi; \ ${ECHODIR} "===> ${DIRPRFX}$${dir} ($${target})"; \ cd ${.CURDIR}/$${dir}; \ ${MAKE} $${target} DIRPRFX=${DIRPRFX}$${dir}/ # This is kept for compatibility only. The normal handling of attaching to # SUBDIR_TARGETS will create a target for each directory. _SUBDIR: .USEBEFORE .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR) @${_+_}target=${.TARGET:realinstall=install}; \ for dir in ${SUBDIR:N.WAIT}; do ( ${_SUBDIR_SH} ); done .endif # Create 'make subdir' targets to run the real 'all' target. .for __dir in ${SUBDIR:N.WAIT} ${__dir}: all_subdir_${DIRPRFX}${__dir} .PHONY .endfor .for __target in ${SUBDIR_TARGETS} # Can ordering be skipped for this and SUBDIR_PARALLEL forced? .if ${STANDALONE_SUBDIR_TARGETS:M${__target}} _is_standalone_target= 1 _subdir_filter= N.WAIT .else _is_standalone_target= 0 _subdir_filter= .endif __subdir_targets= .for __dir in ${SUBDIR:${_subdir_filter}} .if ${__dir} == .WAIT __subdir_targets+= .WAIT .else __deps= .if ${_is_standalone_target} == 0 .if defined(SUBDIR_PARALLEL) # Apply SUBDIR_DEPEND dependencies for SUBDIR_PARALLEL. .for __dep in ${SUBDIR_DEPEND_${__dir}} __deps+= ${__target}_subdir_${DIRPRFX}${__dep} .endfor .else # For non-parallel builds, directories depend on all targets before them. __deps:= ${__subdir_targets} .endif # defined(SUBDIR_PARALLEL) .endif # ${_is_standalone_target} == 0 ${__target}_subdir_${DIRPRFX}${__dir}: .PHONY .MAKE .SILENT ${__deps} @${_+_}target=${__target:realinstall=install}; \ dir=${__dir}; \ ${_SUBDIR_SH}; __subdir_targets+= ${__target}_subdir_${DIRPRFX}${__dir} .endif # ${__dir} == .WAIT .endfor # __dir in ${SUBDIR} # Attach the subdir targets to the real target. # Only recurse on directly-called targets. I.e., don't recurse on dependencies # such as 'install' becoming {before,real,after}install, just recurse # 'install'. Despite that, 'realinstall' is special due to ordering issues # with 'afterinstall'. .if !defined(NO_SUBDIR) && (make(${__target}) || \ (${__target} == realinstall && make(install))) ${__target}: ${__subdir_targets} .PHONY .endif # make(${__target}) .endfor # __target in ${SUBDIR_TARGETS} .endif # !target(_SUBDIR) # Ensure all targets exist .for __target in ${SUBDIR_TARGETS} .if !target(${__target}) ${__target}: .endif .endfor .endif diff --git a/share/mk/bsd.symver.mk b/share/mk/bsd.symver.mk index d0b63206d8fe..7a46f67e6774 100644 --- a/share/mk/bsd.symver.mk +++ b/share/mk/bsd.symver.mk @@ -1,50 +1,50 @@ .if !target(____) -____: +____: .NOTMAIN .include # Generate the version map given the version definitions # and symbol maps. .if !empty(VERSION_DEF) && !empty(SYMBOL_MAPS) # Find the awk script that generates the version map. VERSION_GEN?= version_gen.awk VERSION_MAP?= Version.map CLEANFILES+= ${VERSION_MAP} .if ${MAKE_VERSION} >= 20230123 _mpath= ${.SYSPATH} .else # Compute the make's -m path. _mpath= _oarg= .for _arg in ${.MAKEFLAGS} .if ${_oarg} == "-m" _mpath+= ${_arg} .endif _oarg= ${_arg} .endfor _mpath+= /usr/share/mk .endif # Look up ${VERSION_GEN} in ${_mpath}. _vgen= .for path in ${_mpath} .if empty(_vgen) .if exists(${path}/${VERSION_GEN}) _vgen= ${path}/${VERSION_GEN} .endif .endif .endfor .if empty(_vgen) .error ${VERSION_GEN} not found in the search path. .endif # Run the symbol maps through the C preprocessor before passing # them to the symbol version generator. ${VERSION_MAP}: ${VERSION_DEF} ${_vgen} ${SYMBOL_MAPS} cat ${SYMBOL_MAPS} | ${CPP} ${CFLAGS} - - \ | awk -v vfile=${VERSION_DEF} -f ${_vgen} > ${.TARGET} .endif # !empty(VERSION_DEF) && !empty(SYMBOL_MAPS) .endif # !target(____) diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk index ea7bda0da559..b324ac173335 100644 --- a/share/mk/bsd.test.mk +++ b/share/mk/bsd.test.mk @@ -1,103 +1,103 @@ # # Generic build infrastructure for test programs. # # This is the only public file that should be included by Makefiles when # tests are to be built. All other *.test.mk files are internal and not # to be included directly. .include -____: +____: .NOTMAIN # Third-party software (kyua, etc) prefix. LOCALBASE?= /usr/local # Tests install directory TESTSDIR?= ${TESTSBASE}/${RELDIR:H} PACKAGE?= tests FILESGROUPS+= ${PACKAGE}FILES ${PACKAGE}FILESPACKAGE= ${PACKAGE} ${PACKAGE}FILESDIR= ${TESTSDIR} # List of subdirectories containing tests into which to recurse. This has the # same semantics as SUBDIR at build-time. However, the directories listed here # get registered into the run-time test suite definitions so that the test # engines know to recurse into these directories. # # In other words: list here any directories that contain test programs but use # SUBDIR for directories that may contain helper binaries and/or data files. TESTS_SUBDIRS?= # If defined, indicates that the tests built by the Makefile are not part of # the FreeBSD Test Suite. The implication of this is that the tests won't be # installed under /usr/tests/ and that Kyua won't be able to run them. #NOT_FOR_TEST_SUITE= # List of variables to pass to the tests at run-time via the environment. TESTS_ENV?= # Force all tests in a separate distribution file. # # We want this to be the case even when the distribution name is already # overridden. For example: we want the tests for programs in the 'games' # distribution to end up in the 'tests' distribution; the test programs # themselves have all the necessary logic to detect that the games are not # installed and thus won't cause false negatives. DISTRIBUTION:= tests # Ordered list of directories to construct the PATH for the tests. TESTS_PATH+= ${DESTDIR}/bin ${DESTDIR}/sbin \ ${DESTDIR}/usr/bin ${DESTDIR}/usr/sbin TESTS_ENV+= PATH=${TESTS_PATH:tW:C/ +/:/g} # Ordered list of directories to construct the LD_LIBRARY_PATH for the tests. TESTS_LD_LIBRARY_PATH+= ${DESTDIR}/lib ${DESTDIR}/usr/lib TESTS_ENV+= LD_LIBRARY_PATH=${TESTS_LD_LIBRARY_PATH:tW:C/ +/:/g} # List of all tests being built. The various *.test.mk modules extend this # variable as needed. _TESTS= # Pull in the definitions of all supported test interfaces. .include .include .include # Include atf last to let other test framework use it .include # Sort the tests alphabetically, so the results are deterministically formed # across runs. _TESTS:= ${_TESTS:O} # kyua automatically descends directories; only run make check on the # top-level directory .if !make(check) .for ts in ${TESTS_SUBDIRS} .if empty(SUBDIR:M${ts}) SUBDIR+= ${ts} .endif .endfor SUBDIR_PARALLEL= t .endif # it is rare for test cases to have man pages .if !defined(MAN) MAN= .endif .if !defined(NOT_FOR_TEST_SUITE) .include .endif .if !target(realcheck) realcheck: .PHONY @echo "$@ not defined; skipping" .endif beforecheck realcheck aftercheck check: .PHONY .ORDER: beforecheck realcheck aftercheck check: beforecheck realcheck aftercheck .include diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk index 2a92eea7455e..f34a4542e534 100644 --- a/share/mk/local.dirdeps.mk +++ b/share/mk/local.dirdeps.mk @@ -1,252 +1,252 @@ .if !target(_DIRDEP_USE) # we are the 1st makefile .if !defined(MK_CLANG) .include "${SRCTOP}/share/mk/src.opts.mk" .endif # Machine-specific MK settings needed for Makefile.dirdeps.options usage MK_FDT.i386 = no MK_FDT.amd64 = no # making universe is special .if defined(UNIVERSE_GUARD) # these should be done by now DIRDEPS_FILTER+= N*.host .endif # pseudo machines get no qualification .for m in ${PSEUDO_MACHINE_LIST:Nhost*} M_dep_qual_fixes += C;($m),[^/.,]*$$;\1; .endfor #.info M_dep_qual_fixes=${M_dep_qual_fixes} # Some things we never want to build for host DIRDEPS_FILTER.host = \ Ninclude* \ Nlib/csu* \ Nlib/libc \ Nlib/libcompiler_rt \ Nlib/[mn]* \ Nlib/lib[t]* \ Ngnu/lib/lib[a-r]* \ Nsecure/lib* \ Nusr.bin/xinstall* \ .if ${.MAKE.OS} == "FreeBSD" # Host libraries should mostly be excluded from the build so the # host version in /usr/lib is used. # Internal libraries need to be allowed to be built though # since they are never installed. # Cheat for including src.libnames.mk -____: +____: .NOTMAIN # Pull in _INTERNALLIBS .include _need_host_libs= .for lib in ${_INTERNALLIBS} _need_host_libs+= ${LIB${lib:tu}DIR:S,^${OBJTOP}/,,} .endfor .if ${MK_host_egacy} == "yes" _need_host_libs+= lib/libmd .endif N_host_libs:= ${cd ${SRCTOP} && echo lib/lib*:L:sh:${_need_host_libs:${M_ListToSkip}}:${M_ListToSkip}} DIRDEPS_FILTER.host+= ${N_host_libs} .endif DIRDEPS_FILTER.host32 = ${DIRDEPS_FILTER.host} DIRDEPS_FILTER+= \ Nbin/cat.host \ ${DIRDEPS_FILTER.xtras:U} # Cleanup a buildworld's WORLDTMP so that any files generated from it # or using it will rebuild with the DIRDEPS SYSROOT. Otherwise existing # object .meta files may still reference those directories and not be # rebuilt and lead to incorrect Makefile.depend files due to lack of # .dirdep files. .if !defined(NO_CLEANUP_WORLDTMP) && exists(${OBJTOP}/tmp/_worldtmp) cleanup_worldtmp: .PHONY .NOMETA @echo "Cleaning leftover WORLDTMP from buildworld." -rm -rf ${OBJTOP}/tmp/* -chflags -R 0 ${OBJTOP}/tmp/* rm -rf ${OBJTOP}/tmp beforedirdeps: cleanup_worldtmp .endif # pseudo option for building host tools on old or non-FreeBSD host # allows us to leverage Makefile.depend.options with # DIRDEPS_OPTIONS = host_egacy # dirdeps-options.mk will qualify with ${DEP_MACHINE} (and others) # before looking at the bare option. MK_host_egacy.host= ${MK_host_egacy} .endif # !target(_DIRDEP_USE) # reset this each time DIRDEPS_FILTER.xtras= .if ${DEP_MACHINE:Npkgs*} != "" DIRDEPS_FILTER.xtras+= Nusr.bin/clang/clang.host .endif .if ${DEP_MACHINE:Nhost*} == "" .if ${MK_host_egacy} == "yes" && ${DEP_RELDIR:Ntools/build:Ntargets/*:N*/stage} != "" DIRDEPS += tools/build .endif .else MK_host_egacy.${DEP_MACHINE}= no # this is how we can handle optional dependencies .if ${DEP_RELDIR} == "lib/libc" DIRDEPS += lib/libc_nonshared .if ${MK_SSP:Uno} != "no" DIRDEPS += lib/libssp_nonshared .endif .else DIRDEPS_FILTER.xtras+= Nlib/libc_nonshared .endif # some optional things .if ${MK_CTF} == "yes" && ${DEP_RELDIR:Mcddl/usr.bin/ctf*} == "" DIRDEPS += \ cddl/usr.bin/ctfconvert.host \ cddl/usr.bin/ctfmerge.host .endif .if ${DEP_MACHINE:Nhost*} != "" # Add in proper libgcc (gnu or LLVM) if not building libcc and libc is needed. # Add both gcc_s and gcc_eh as dependencies as the decision to build # -static or not is not known here. .if ${DEP_RELDIR:M*libgcc*} == "" && ${DIRDEPS:U:Mlib/libc} != "" DIRDEPS+= \ lib/libgcc_eh \ lib/libgcc_s .endif .endif # Bootstrap support. Give hints to DIRDEPS if there is no Makefile.depend* # generated yet. This can be based on things such as SRC files and LIBADD. # These hints will not factor into the final Makefile.depend as only what is # used will be added in and handled via [local.]gendirdeps.mk. This is not # done for MACHINE=host builds. # XXX: Include this in local.autodep.mk as well for gendirdeps without filemon. # Only do this for main build target .if ${RELDIR} == ${DEP_RELDIR} && !defined(_RECURSING_PROGS) .for _depfile in ${.MAKE.DEPENDFILE_PREFERENCE:T} .if !defined(_have_depfile) && exists(${.CURDIR}/${_depfile}) _have_depfile= .endif .endfor .if !defined(_have_depfile) # KMOD does not use any stdlibs. .if !defined(KMOD) # Gather PROGS dependencies first .if !empty(PROGS) _PROGS_LIBADD= _PROGS_DPADD= _PROGS_SRCS= .for _prog in ${PROGS} .for s in . _ .if !empty(LIBADD${s}${_prog}) _PROGS_LIBADD+= ${LIBADD${s}${_prog}} .endif .if !empty(DPADD${s}${_prog}) _PROGS_DPADD+= ${DPADD${s}${_prog}} .endif .if !empty(SRCS${s}${_prog}) _PROGS_SRCS+= ${SRCS${s}${_prog}} .endif .endfor # .for s in . _ # Add in assumed source (bsd.prog.mk) .if !target(${_prog}) .if defined(PROG_CXX) _PROGS_SRCS+= ${_prog}.cc .else _PROGS_SRCS+= ${_prog}.c .endif .endif # !target(${_prog}) .endfor # .for _prog in ${PROGS} .endif # !empty(PROGS) _SRCS= ${SRCS} ${_PROGS_SRCS} # Has C files. The C_DIRDEPS are shared with C++ files as well. C_DIRDEPS= \ include \ include/arpa \ include/protocols \ include/rpc \ include/rpcsvc \ include/xlocale \ lib/${CSU_DIR} \ lib/libc \ lib/libcompiler_rt \ # libgcc is needed as well but is added later. .if ${MK_GSSAPI} != "no" C_DIRDEPS+= include/gssapi .endif .if !empty(_SRCS:M*.c) DIRDEPS+= ${C_DIRDEPS} .endif # Has C++ files .if !empty(_SRCS:M*.cc) || !empty(_SRCS:M*.C) || !empty(_SRCS:M*.cpp) || \ !empty(_SRCS:M*.cxx) DIRDEPS+= ${C_DIRDEPS} .if ${MK_CLANG} == "yes" DIRDEPS+= lib/libc++ lib/libcxxrt .endif # XXX: Clang and GCC always adds -lm currently, even when not needed. DIRDEPS+= lib/msun .endif # CXX .endif # !defined(KMOD) # Has yacc files. .if !empty(_SRCS:M*.y) DIRDEPS+= usr.bin/yacc.host .endif _DPADD= ${DPADD} ${_PROGS_DPADD} .if !empty(_DPADD) # This only works for DPADD with full OBJ/SRC paths, which is mostly just # _INTERNALLIBS. _DP_DIRDEPS= \ ${_DPADD:O:u:M${OBJTOP}*:H:N.:tA:C,${OBJTOP}[^/]*/,,:N.:O:u} \ ${_DPADD:O:u:M${OBJROOT}*:N${OBJTOP}*:N${STAGE_ROOT}/*:H:S,${OBJROOT},,:C,^([^/]+)/(.*),\2.\1,:S,${HOST_TARGET}$,host,:N.*:O:u} # Resolve the paths to RELDIRs .if !empty(_DP_DIRDEPS) DIRDEPS+= ${_DP_DIRDEPS:C,^,${SRCTOP}/,:tA:C,^${SRCTOP}/,,} .endif .endif # !empty(DPADD) _ALL_LIBADD= ${LIBADD} ${_PROGS_LIBADD} .if !empty(_ALL_LIBADD) # Also handle LIBADD for non-internal libraries. .for _lib in ${_ALL_LIBADD:O:u} _lib${_lib}reldir= ${LIB${_lib:tu}DIR:C,${OBJTOP}/,,} .if defined(LIB${_lib:tu}DIR) && ${DIRDEPS:M${_lib${_lib}reldir}} == "" && \ exists(${SRCTOP}/${_lib${_lib}reldir}) DIRDEPS+= ${_lib${_lib}reldir} .endif .endfor .endif # !empty(LIBADD) .endif # no Makefile.depend* .endif # ${RELDIR} == ${DEP_RELDIR} .endif # ${DEP_MACHINE} != "host" .if ${MK_STAGING} == "yes" # we need targets/pseudo/stage to prep the stage tree .if ${DEP_RELDIR:N.:N${SRCTOP}:N*pseudo/stage} != "" DIRDEPS += targets/pseudo/stage .endif .endif DEP_MACHINE_ARCH = ${MACHINE_ARCH.${DEP_MACHINE}} DEP_MACHINE_CPUARCH = ${DEP_MACHINE_ARCH:${__TO_CPUARCH}} CSU_DIR.${DEP_MACHINE_ARCH} ?= csu/${DEP_MACHINE_ARCH} CSU_DIR := ${CSU_DIR.${DEP_MACHINE_ARCH}} BOOT_MACHINE_DIR:= ${BOOT_MACHINE_DIR.${DEP_MACHINE}} KERNEL_NAME:= ${KERNEL_NAME.${DEP_MACHINE}} .-include diff --git a/share/mk/local.init.mk b/share/mk/local.init.mk index 758a3604d73a..7ea513385f61 100644 --- a/share/mk/local.init.mk +++ b/share/mk/local.init.mk @@ -1,43 +1,43 @@ .if !target(__${_this}__) -__${_this}__: +__${_this}__: .NOTMAIN .if ${.MAKE.MODE:Mmeta*} != "" .if !empty(SUBDIR) && !defined(LIB) && !defined(PROG) && ${.MAKE.MAKEFILES:M*bsd.prog.mk} == "" .if ${.MAKE.MODE:Mleaf*} != "" # we only want leaf dirs to build in meta mode... and we are not one .MAKE.MODE = normal .endif .endif .endif # XXX: This should be combined with external compiler support in Makefile.inc1 # and local.meta.sys.mk (CROSS_TARGET_FLAGS) .if ${MK_SYSROOT} == "yes" && !empty(SYSROOT) && ${MACHINE:Nhost*} != "" CFLAGS_LAST+= --sysroot=${SYSROOT} CXXFLAGS_LAST+= --sysroot=${SYSROOT} LDADD+= --sysroot=${SYSROOT} .elif ${MK_STAGING} == "yes" ISYSTEM?= ${STAGE_INCLUDEDIR} # no space after -isystem makes it easier to # grep the flag out of command lines (in meta files) to see its value. CFLAGS+= -isystem${ISYSTEM} # XXX: May be needed for GCC to build with libc++ rather than libstdc++. See Makefile.inc1 #CXXFLAGS+= -std=gnu++11 #LDADD+= -L${STAGE_LIBDIR}/libc++ #CXXFLAGS+= -I${STAGE_INCLUDEDIR}/usr/include/c++/v1 LDADD+= -L${STAGE_LIBDIR} .endif .if ${MACHINE:Nhost*} == "" .if ${.MAKE.DEPENDFILE:E:Nhost*} != "" UPDATE_DEPENDFILE?= no .endif HOST_CFLAGS+= -DHOSTPROG CFLAGS+= ${HOST_CFLAGS} .endif .-include "src.init.mk" .-include .-include "${.CURDIR}/local.init.mk" .endif diff --git a/share/mk/netbsd-tests.test.mk b/share/mk/netbsd-tests.test.mk index 4f222faca2ab..bed01156c5e5 100644 --- a/share/mk/netbsd-tests.test.mk +++ b/share/mk/netbsd-tests.test.mk @@ -1,38 +1,38 @@ .if !target(__netbsd_tests.test.mk__) -__netbsd_tests.test.mk__: +__netbsd_tests.test.mk__: .NOTMAIN TESTSRC?= ${SRCTOP}/contrib/netbsd-tests/${RELDIR:H} .if !exists(${TESTSRC}/) .error Please define TESTSRC to the absolute path of the test sources, e.g. $${SRCTOP}/contrib/netbsd-tests/lib/libc/stdio .endif .PATH: ${TESTSRC} LIBNETBSD_SRCDIR= ${SRCTOP}/lib/libnetbsd LIBNETBSD_OBJDIR= ${OBJTOP}/lib/libnetbsd .for t in ${NETBSD_ATF_TESTS_C} CFLAGS.$t+= -I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests LDFLAGS.$t+= -L${LIBNETBSD_OBJDIR} LIBADD.${t}+= netbsd SRCS.$t?= ${t:C/^/t_/:C/_test$//g}.c .endfor ATF_TESTS_C+= ${NETBSD_ATF_TESTS_C} # A C++ analog isn't provided because there aren't any C++ testcases in # contrib/netbsd-tests .for t in ${NETBSD_ATF_TESTS_SH} ATF_TESTS_SH_SRC_$t?= ${t:C/^/t_/:C/_test$//g}.sh .endfor ATF_TESTS_SH+= ${NETBSD_ATF_TESTS_SH} .endif # vim: syntax=make diff --git a/share/mk/src.init.mk b/share/mk/src.init.mk index e35d615d0e1a..01ea5437e5a7 100644 --- a/share/mk/src.init.mk +++ b/share/mk/src.init.mk @@ -1,37 +1,37 @@ .if !target(____) -____: +____: .NOTMAIN .if !target(buildenv) buildenv: .PHONY ${_+_}@env BUILDENV_DIR=${.CURDIR} ${MAKE} -C ${SRCTOP} buildenv .endif .if ${MACHINE:Nhost*} == "" .if ${.MAKE.OS} != "FreeBSD" # these won't work anyway - see tools/build/mk/Makefile.boot.pre MK_DEBUG_FILES= no MK_MAN= no MK_PIE= no MK_RETPOLINE= no NO_SHARED= no MK_TESTS= no .-include CFLAGS+= \ -DHAVE_NBTOOL_CONFIG_H=1 \ -I${SRCTOP}/tools/build/cross-build/include/common \ .endif .if ${MK_host_egacy} == "yes" .ifdef PROG LOCAL_LIBRARIES+= egacy LIBADD+= egacy .endif .endif .endif .endif # !target(____) diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index be8db2dc1540..57b694ed5122 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -1,839 +1,839 @@ # # The include file define library names suitable # for INTERNALLIB and PRIVATELIB definition .if !target(____) .error src.libnames.mk cannot be included directly. .endif .if !target(____) -____: +____: .NOTMAIN .include _PRIVATELIBS= \ atf_c \ atf_cxx \ auditd \ bsddialog \ bsdstat \ cbor \ devdctl \ event1 \ fido2 \ gmock \ gtest \ gmock_main \ gtest_main \ heimipcc \ heimipcs \ kldelf \ ldns \ sqlite3 \ ssh \ ucl \ unbound \ zstd # Let projects based on FreeBSD append to _PRIVATELIBS # by maintaining their own LOCAL_PRIVATELIBS list. _PRIVATELIBS+= ${LOCAL_PRIVATELIBS} _INTERNALLIBS= \ amu \ bsnmptools \ c_nossp_pic \ cron \ der \ diff \ elftc \ fdt \ fifolog \ ifconfig \ ipf \ iscsiutil \ lpr \ lua \ lutok \ netbsd \ ntp \ ntpevent \ nvmf \ openbsd \ opts \ parse \ pe \ pfctl \ pkgecc \ pmcstat \ sl \ sm \ smdb \ smutil \ telnet \ vers \ wpaap \ wpacommon \ wpacrypto \ wpadrivers \ wpaeap_common \ wpaeap_peer \ wpaeap_server \ wpaeapol_auth \ wpaeapol_supp \ wpal2_packet \ wpapasn \ wparadius \ wparsn_supp \ wpatls \ wpautils \ wpawps # Let projects based on FreeBSD append to _INTERNALLIBS # by maintaining their own LOCAL_INTERNALLIBS list. _INTERNALLIBS+= ${LOCAL_INTERNALLIBS} _LIBRARIES= \ ${_PRIVATELIBS} \ ${_INTERNALLIBS} \ ${LOCAL_LIBRARIES} \ 80211 \ 9p \ alias \ archive \ asn1 \ avl \ BlocksRuntime \ be \ begemot \ bluetooth \ bsdxml \ bsm \ bsnmp \ bz2 \ c \ c_pic \ calendar \ cam \ casper \ cap_dns \ cap_fileargs \ cap_grp \ cap_net \ cap_netdb \ cap_pwd \ cap_sysctl \ cap_syslog \ com_err \ compiler_rt \ crypt \ crypto \ ctf \ cuse \ cxxrt \ devctl \ devdctl \ devinfo \ devstat \ dialog \ dl \ dpv \ dtrace \ dwarf \ edit \ efivar \ elf \ execinfo \ fetch \ figpar \ formw \ geom \ gpio \ gssapi \ gssapi_krb5 \ hdb \ heimbase \ heimntlm \ heimsqlite \ hx509 \ icp \ ipsec \ ipt \ jail \ kadm5clnt \ kadm5srv \ kafs5 \ kdc \ kiconv \ krb5 \ kvm \ l \ lzma \ m \ magic \ md \ memstat \ mp \ mt \ ncursesw \ netgraph \ netmap \ ngatm \ nv \ nvpair \ opencsd \ pam \ panel \ panelw \ pcap \ pcsclite \ pjdlog \ pmc \ proc \ procstat \ pthread \ radius \ regex \ roken \ rpcsec_gss \ rpcsvc \ rt \ rtld_db \ sbuf \ sdp \ sm \ smb \ spl \ ssl \ ssp_nonshared \ stats \ stdthreads \ supcplusplus \ sys \ sysdecode \ tacplus \ termcapw \ tinfow \ tpool \ ufs \ ugidfw \ ulog \ umem \ usb \ usbhid \ util \ uutil \ vmmapi \ wind \ wrap \ xo \ y \ ypclnt \ z \ zdb \ zfs_core \ zfs \ zfsbootenv \ zpool \ zutil .if ${MK_BLACKLIST} != "no" _LIBRARIES+= \ blacklist \ .endif .if ${MK_OFED} != "no" _LIBRARIES+= \ cxgb4 \ ibcm \ ibmad \ ibnetdisc \ ibumad \ ibverbs \ irdma \ mlx4 \ mlx5 \ rdmacm \ osmcomp \ opensm \ osmvendor .endif .if ${MK_BEARSSL} == "yes" _LIBRARIES+= \ bearssl \ secureboot \ LIBBEARSSL?= ${LIBBEARSSLDIR}/libbearssl.a LIBSECUREBOOT?= ${LIBSECUREBOOTDIR}/libsecureboot.a .endif .if ${MK_VERIEXEC} == "yes" _LIBRARIES+= veriexec LIBVERIEXEC?= ${LIBVERIEXECDIR}/libveriexec.a .endif # Each library's LIBADD needs to be duplicated here for static linkage of # 2nd+ order consumers. Auto-generating this would be better. _DP_80211= sbuf bsdxml _DP_9p= sbuf .if ${MK_CASPER} != "no" _DP_9p+= casper cap_pwd cap_grp .endif # XXX: Not bootstrapped so uses host version on non-FreeBSD, so don't use a # FreeBSD-specific dependency list .if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) _DP_archive= z bz2 lzma bsdxml zstd .endif _DP_avl= spl _DP_bsddialog= ncursesw tinfow _DP_zstd= pthread .if ${MK_BLACKLIST} != "no" _DP_blacklist+= pthread .endif _DP_crypto= pthread # See comment by _DP_archive above .if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) .if ${MK_OPENSSL} != "no" _DP_archive+= crypto .else _DP_archive+= md .endif .endif _DP_sqlite3= pthread _DP_ssl= crypto _DP_ssh= crypto crypt z .if ${MK_LDNS} != "no" _DP_ssh+= ldns .endif _DP_edit= tinfow .if ${MK_OPENSSL} != "no" _DP_bsnmp= crypto .endif _DP_geom= bsdxml sbuf _DP_cam= sbuf _DP_kldelf= elf _DP_kvm= elf _DP_casper= nv _DP_cap_dns= nv _DP_cap_fileargs= nv _DP_cap_grp= nv _DP_cap_pwd= nv _DP_cap_sysctl= nv _DP_cap_syslog= nv _DP_crypt= md .if ${MK_OFED} != "no" _DP_pcap= ibverbs mlx5 .endif _DP_pjdlog= util _DP_usb= pthread _DP_unbound= ssl crypto pthread _DP_rt= pthread .if ${MK_OPENSSL} == "no" _DP_radius= md .else _DP_radius= crypto .endif _DP_rtld_db= elf procstat _DP_procstat= kvm util elf _DP_proc= cxxrt .if ${MK_CDDL} != "no" _DP_proc+= ctf .endif _DP_proc+= elf procstat rtld_db util z _DP_mp= crypto _DP_memstat= kvm _DP_magic= z _DP_mt= sbuf bsdxml _DP_nvmf= nv _DP_ldns= ssl crypto _DP_lua= m _DP_lutok= lua .if ${MK_OPENSSL} != "no" _DP_fetch= ssl crypto .else _DP_fetch= md .endif _DP_execinfo= elf _DP_dwarf= elf z _DP_dpv= dialog figpar util tinfow ncursesw _DP_dialog= tinfow ncursesw m _DP_cuse= pthread _DP_atf_cxx= atf_c _DP_gtest= pthread regex _DP_gmock= gtest _DP_gmock_main= gmock _DP_gtest_main= gtest _DP_devstat= kvm _DP_pam= radius tacplus md util .if ${MK_KERBEROS} != "no" _DP_pam+= krb5 .endif .if ${MK_OPENSSH} != "no" _DP_fido2+= crypto z _DP_pam+= ssh .endif .if ${MK_NIS} != "no" _DP_pam+= ypclnt .endif _DP_roken= crypt _DP_kadm5clnt= com_err krb5 roken _DP_kadm5srv= com_err hdb krb5 roken _DP_heimntlm= crypto com_err krb5 roken _DP_hx509= asn1 com_err crypto roken wind _DP_hdb= asn1 com_err krb5 roken sqlite3 _DP_asn1= com_err roken _DP_kdc= roken hdb hx509 krb5 heimntlm asn1 crypto _DP_wind= com_err roken _DP_heimbase= pthread _DP_heimipcc= heimbase roken pthread _DP_heimipcs= heimbase roken pthread _DP_kafs5= asn1 krb5 roken _DP_krb5= asn1 com_err crypt crypto hx509 roken wind heimbase heimipcc _DP_gssapi_krb5= gssapi krb5 crypto roken asn1 com_err _DP_lzma= md pthread _DP_ucl= m _DP_vmmapi= util _DP_opencsd= cxxrt _DP_ctf= spl z _DP_dtrace= ctf elf proc pthread rtld_db xo _DP_xo= util _DP_ztest= geom m nvpair umem zpool pthread avl zfs_core spl zutil zfs uutil icp # The libc dependencies are not strictly needed but are defined to make the # assert happy. _DP_c= compiler_rt sys # Use libssp_nonshared only on i386 and power*. Other archs emit direct calls # to __stack_chk_fail, not __stack_chk_fail_local provided by libssp_nonshared. .if ${MK_SSP} != "no" && \ (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "") _DP_c+= ssp_nonshared .endif _DP_stats= sbuf pthread _DP_stdthreads= pthread _DP_sys= compiler_rt # Use libssp_nonshared only on i386 and power*. Other archs emit direct calls # to __stack_chk_fail, not __stack_chk_fail_local provided by libssp_nonshared. .if ${MK_SSP} != "no" && \ (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "") _DP_sys+= ssp_nonshared .endif .if !defined(BOOTSTRAPPING) _DP_thr= c sys _DP_pthread= ${_DP_thr} .endif _DP_tacplus= md pam _DP_ncursesw= tinfow _DP_formw= ncursesw _DP_nvpair= spl _DP_panelw= ncursesw _DP_rpcsec_gss= gssapi _DP_smb= kiconv _DP_ulog= md _DP_fifolog= z _DP_ipf= kvm _DP_tpool= spl _DP_uutil= avl spl _DP_zfs= md pthread rt umem util uutil m avl bsdxml crypto geom nvpair \ z zfs_core zutil _DP_zfsbootenv= zfs nvpair _DP_zfs_core= nvpair spl zutil _DP_zpool= md pthread z icp spl nvpair avl umem _DP_zutil= avl geom m tpool _DP_be= zfs spl nvpair zfsbootenv _DP_netmap= _DP_ifconfig= m _DP_pfctl= nv # OFED support .if ${MK_OFED} != "no" _DP_cxgb4= ibverbs pthread _DP_ibcm= ibverbs _DP_ibmad= ibumad _DP_ibnetdisc= osmcomp ibmad ibumad _DP_ibumad= _DP_ibverbs= _DP_irdma= ibverbs pthread _DP_mlx4= ibverbs pthread _DP_mlx5= ibverbs pthread _DP_rdmacm= ibverbs _DP_osmcomp= pthread _DP_opensm= pthread _DP_osmvendor= ibumad pthread .endif # Define special cases LDADD_supcplusplus= -lsupc++ LIBATF_C= ${LIBDESTDIR}${LIBDIR_BASE}/libprivateatf-c.a LIBATF_CXX= ${LIBDESTDIR}${LIBDIR_BASE}/libprivateatf-c++.a LDADD_atf_c= -lprivateatf-c LDADD_atf_cxx= -lprivateatf-c++ LIBGMOCK= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategmock.a LIBGMOCK_MAIN= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategmock_main.a LIBGTEST= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategtest.a LIBGTEST_MAIN= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategtest_main.a LDADD_gmock= -lprivategmock LDADD_gtest= -lprivategtest LDADD_gmock_main= -lprivategmock_main LDADD_gtest_main= -lprivategtest_main .for _l in ${_PRIVATELIBS} LIB${_l:tu}?= ${LIBDESTDIR}${LIBDIR_BASE}/libprivate${_l}.a .endfor .if ${MK_PIE} != "no" PIE_SUFFIX= _pie .endif .for _l in ${_LIBRARIES} .if ${_INTERNALLIBS:M${_l}} || !defined(SYSROOT) LDADD_${_l}_L+= -L${LIB${_l:tu}DIR} .endif DPADD_${_l}?= ${LIB${_l:tu}} .if ${_PRIVATELIBS:M${_l}} LDADD_${_l}?= ${LDADD_${_l}_L} -lprivate${_l} .elif ${_INTERNALLIBS:M${_l}} LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l:S/${PIE_SUFFIX}//}${PIE_SUFFIX} .else LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l} .endif # Add in all dependencies for static linkage. # Bootstrapping from non-FreeBSD needs special handling, since it overrides # NO_SHARED back to yes despite only building static versions of bootstrap # libraries (see tools/build/mk/Makefile.boot.pre). .if defined(_DP_${_l}) && (${_INTERNALLIBS:M${_l}} || \ (defined(NO_SHARED) && ${NO_SHARED:tl} != "no") || \ (defined(BOOTSTRAPPING) && ${.MAKE.OS} != "FreeBSD")) .for _d in ${_DP_${_l}} DPADD_${_l}+= ${DPADD_${_d}} LDADD_${_l}+= ${LDADD_${_d}} .endfor .endif .endfor # These are special cases where the library is broken and anything that uses # it needs to add more dependencies. Broken usually means that it has a # cyclic dependency and cannot link its own dependencies. This is bad, please # fix the library instead. # Unless the library itself is broken then the proper place to define # dependencies is _DP_* above. # libatf-c++ exposes libatf-c abi hence we need to explicit link to atf_c for # atf_cxx DPADD_atf_cxx+= ${DPADD_atf_c} LDADD_atf_cxx+= ${LDADD_atf_c} DPADD_gmock+= ${DPADD_gtest} LDADD_gmock+= ${LDADD_gtest} DPADD_gmock_main+= ${DPADD_gmock} LDADD_gmock_main+= ${LDADD_gmock} DPADD_gtest_main+= ${DPADD_gtest} LDADD_gtest_main+= ${LDADD_gtest} # Detect LDADD/DPADD that should be LIBADD, before modifying LDADD here. _BADLDADD= .for _l in ${LDADD:M-l*:N-l*/*:C,^-l,,} .if ${_LIBRARIES:M${_l}} && !${_PRIVATELIBS:M${_l}} _BADLDADD+= ${_l} .endif .endfor .if !empty(_BADLDADD) .error ${.CURDIR}: These libraries should be LIBADD+=foo rather than DPADD/LDADD+=-lfoo: ${_BADLDADD} .endif .for _l in ${LIBADD} DPADD+= ${DPADD_${_l}} LDADD+= ${LDADD_${_l}} .endfor _LIB_OBJTOP?= ${OBJTOP} # INTERNALLIB definitions. LIBDIFFDIR= ${_LIB_OBJTOP}/lib/libdiff LIBDIFF?= ${LIBDIFFDIR}/libdiff${PIE_SUFFIX}.a LIBELFTCDIR= ${_LIB_OBJTOP}/lib/libelftc LIBELFTC?= ${LIBELFTCDIR}/libelftc${PIE_SUFFIX}.a LIBFDTDIR= ${_LIB_OBJTOP}/lib/libfdt LIBFDT?= ${LIBFDTDIR}/libfdt${PIE_SUFFIX}.a LIBLUADIR= ${_LIB_OBJTOP}/lib/liblua LIBLUA?= ${LIBLUADIR}/liblua${PIE_SUFFIX}.a LIBLUTOKDIR= ${_LIB_OBJTOP}/lib/liblutok LIBLUTOK?= ${LIBLUTOKDIR}/liblutok${PIE_SUFFIX}.a LIBPEDIR= ${_LIB_OBJTOP}/lib/libpe LIBPE?= ${LIBPEDIR}/libpe${PIE_SUFFIX}.a LIBOPENBSDDIR= ${_LIB_OBJTOP}/lib/libopenbsd LIBOPENBSD?= ${LIBOPENBSDDIR}/libopenbsd${PIE_SUFFIX}.a LIBSMDIR= ${_LIB_OBJTOP}/lib/libsm LIBSM?= ${LIBSMDIR}/libsm${PIE_SUFFIX}.a LIBSMDBDIR= ${_LIB_OBJTOP}/lib/libsmdb LIBSMDB?= ${LIBSMDBDIR}/libsmdb${PIE_SUFFIX}.a LIBSMUTILDIR= ${_LIB_OBJTOP}/lib/libsmutil LIBSMUTIL?= ${LIBSMUTILDIR}/libsmutil${PIE_SUFFIX}.a LIBSYSDIR= ${_LIB_OBJTOP}/lib/libsys LIBSYS?= ${LIBSYSDIR}/libsys${PIE_SUFFIX}.a LIBNETBSDDIR?= ${_LIB_OBJTOP}/lib/libnetbsd LIBNETBSD?= ${LIBNETBSDDIR}/libnetbsd${PIE_SUFFIX}.a LIBVERSDIR?= ${_LIB_OBJTOP}/kerberos5/lib/libvers LIBVERS?= ${LIBVERSDIR}/libvers${PIE_SUFFIX}.a LIBSLDIR= ${_LIB_OBJTOP}/kerberos5/lib/libsl LIBSL?= ${LIBSLDIR}/libsl${PIE_SUFFIX}.a LIBIFCONFIGDIR= ${_LIB_OBJTOP}/lib/libifconfig LIBIFCONFIG?= ${LIBIFCONFIGDIR}/libifconfig${PIE_SUFFIX}.a LIBIPFDIR= ${_LIB_OBJTOP}/sbin/ipf/libipf LIBIPF?= ${LIBIPFDIR}/libipf${PIE_SUFFIX}.a LIBNVDIR= ${_LIB_OBJTOP}/lib/libnv LIBNV?= ${LIBNVDIR}/libnv${PIE_SUFFIX}.a LIBISCSIUTILDIR= ${_LIB_OBJTOP}/lib/libiscsiutil LIBISCSIUTIL?= ${LIBISCSIUTILDIR}/libiscsiutil${PIE_SUFFIX}.a LIBNVMFDIR= ${_LIB_OBJTOP}/lib/libnvmf LIBNVMF?= ${LIBNVMFDIR}/libnvmf${PIE_SUFFIX}.a LIBTELNETDIR= ${_LIB_OBJTOP}/lib/libtelnet LIBTELNET?= ${LIBTELNETDIR}/libtelnet${PIE_SUFFIX}.a LIBCRONDIR= ${_LIB_OBJTOP}/usr.sbin/cron/lib LIBCRON?= ${LIBCRONDIR}/libcron${PIE_SUFFIX}.a LIBDERDIR= ${_LIB_OBJTOP}/lib/libder LIBDER?= ${LIBDERDIR}/libder${PIE_SUFFIX}.a LIBNTPDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libntp LIBNTP?= ${LIBNTPDIR}/libntp${PIE_SUFFIX}.a LIBNTPEVENTDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libntpevent LIBNTPEVENT?= ${LIBNTPEVENTDIR}/libntpevent${PIE_SUFFIX}.a LIBOPTSDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libopts LIBOPTS?= ${LIBOPTSDIR}/libopts${PIE_SUFFIX}.a LIBPARSEDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libparse LIBPARSE?= ${LIBPARSEDIR}/libparse${PIE_SUFFIX}.a LIBPFCTLDIR= ${_LIB_OBJTOP}/lib/libpfctl LIBPFCTL?= ${LIBPFCTLDIR}/libpfctl${PIE_SUFFIX}.a LIBLPRDIR= ${_LIB_OBJTOP}/usr.sbin/lpr/common_source LIBLPR?= ${LIBLPRDIR}/liblpr${PIE_SUFFIX}.a LIBFIFOLOGDIR= ${_LIB_OBJTOP}/usr.sbin/fifolog/lib LIBFIFOLOG?= ${LIBFIFOLOGDIR}/libfifolog${PIE_SUFFIX}.a LIBBSNMPTOOLSDIR= ${_LIB_OBJTOP}/usr.sbin/bsnmpd/tools/libbsnmptools LIBBSNMPTOOLS?= ${LIBBSNMPTOOLSDIR}/libbsnmptools${PIE_SUFFIX}.a LIBBE?= ${LIBBEDIR}/libbe${PIE_SUFFIX}.a LIBPKGECCDIR= ${_LIB_OBJTOP}/secure/lib/libpkgecc LIBPKGECC?= ${LIBPKGECCDIR}/libpkgecc${PIE_SUFFIX}.a LIBPMCSTATDIR= ${_LIB_OBJTOP}/lib/libpmcstat LIBPMCSTAT?= ${LIBPMCSTATDIR}/libpmcstat${PIE_SUFFIX}.a LIBWPAAPDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/ap LIBWPAAP?= ${LIBWPAAPDIR}/libwpaap${PIE_SUFFIX}.a LIBWPACOMMONDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/common LIBWPACOMMON?= ${LIBWPACOMMONDIR}/libwpacommon${PIE_SUFFIX}.a LIBWPACRYPTODIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/crypto LIBWPACRYPTO?= ${LIBWPACRYPTODIR}/libwpacrypto${PIE_SUFFIX}.a LIBWPADRIVERSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/drivers LIBWPADRIVERS?= ${LIBWPADRIVERSDIR}/libwpadrivers${PIE_SUFFIX}.a LIBWPAEAP_COMMONDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eap_common LIBWPAEAP_COMMON?= ${LIBWPAEAP_COMMONDIR}/libwpaeap_common${PIE_SUFFIX}.a LIBWPAEAP_PEERDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eap_peer LIBWPAEAP_PEER?= ${LIBWPAEAP_PEERDIR}/libwpaeap_peer${PIE_SUFFIX}.a LIBWPAEAP_SERVERDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eap_server LIBWPAEAP_SERVER?= ${LIBWPAEAP_SERVERDIR}/libwpaeap_server${PIE_SUFFIX}.a LIBWPAEAPOL_AUTHDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eapol_auth LIBWPAEAPOL_AUTH?= ${LIBWPAEAPOL_AUTHDIR}/libwpaeapol_auth${PIE_SUFFIX}.a LIBWPAEAPOL_SUPPDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eapol_supp LIBWPAEAPOL_SUPP?= ${LIBWPAEAPOL_SUPPDIR}/libwpaeapol_supp${PIE_SUFFIX}.a LIBWPAL2_PACKETDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/l2_packet LIBWPAL2_PACKET?= ${LIBWPAL2_PACKETDIR}/libwpal2_packet${PIE_SUFFIX}.a LIBWPAPASNDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/pasn LIBWPAPASN?= ${LIBWPAPASNDIR}/libwpapasn${PIE_SUFFIX}.a LIBWPARADIUSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/radius LIBWPARADIUS?= ${LIBWPARADIUSDIR}/libwparadius${PIE_SUFFIX}.a LIBWPARSN_SUPPDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/rsn_supp LIBWPARSN_SUPP?= ${LIBWPARSN_SUPPDIR}/libwparsn_supp${PIE_SUFFIX}.a LIBWPATLSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/tls LIBWPATLS?= ${LIBWPATLSDIR}/libwpatls${PIE_SUFFIX}.a LIBWPAUTILSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/utils LIBWPAUTILS?= ${LIBWPAUTILSDIR}/libwpautils${PIE_SUFFIX}.a LIBWPAWPSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/wps LIBWPAWPS?= ${LIBWPAWPSDIR}/libwpawps${PIE_SUFFIX}.a LIBC_NOSSP_PICDIR= ${_LIB_OBJTOP}/lib/libc LIBC_NOSSP_PIC?= ${LIBC_NOSSP_PICDIR}/libc_nossp_pic.a # Define a directory for each library. This is useful for adding -L in when # not using a --sysroot or for meta mode bootstrapping when there is no # Makefile.depend. These are sorted by directory. LIBAVLDIR= ${_LIB_OBJTOP}/cddl/lib/libavl LIBCTFDIR= ${_LIB_OBJTOP}/cddl/lib/libctf LIBDTRACEDIR= ${_LIB_OBJTOP}/cddl/lib/libdtrace LIBICPDIR= ${_LIB_OBJTOP}/cddl/lib/libicp LIBICP?= ${LIBICPDIR}/libicp${PIE_SUFFIX}.a LIBICP_RESCUEDIR= ${_LIB_OBJTOP}/cddl/lib/libicp_rescue LIBICP_RESCUE?= ${LIBICP_RESCUEDIR}/libicp_rescue${PIE_SUFFIX}.a LIBNVPAIRDIR= ${_LIB_OBJTOP}/cddl/lib/libnvpair LIBNVPAIR?= ${LIBNVPAIRDIR}/libnvpair${PIE_SUFFIX}.a LIBUMEMDIR= ${_LIB_OBJTOP}/cddl/lib/libumem LIBUUTILDIR= ${_LIB_OBJTOP}/cddl/lib/libuutil LIBZDBDIR= ${_LIB_OBJTOP}/cddl/lib/libzdb LIBZDB?= ${LIBZDBDIR}/libzdb${PIE_SUFFIX}.a LIBZFSDIR= ${_LIB_OBJTOP}/cddl/lib/libzfs LIBZFS?= ${LIBZFSDIR}/libzfs${PIE_SUFFIX}.a LIBZFS_COREDIR= ${_LIB_OBJTOP}/cddl/lib/libzfs_core LIBZFS_CORE?= ${LIBZFS_COREDIR}/libzfs_core${PIE_SUFFIX}.a LIBZFSBOOTENVDIR= ${_LIB_OBJTOP}/cddl/lib/libzfsbootenv LIBZFSBOOTENV?= ${LIBZFSBOOTENVDIR}/libzfsbootenv${PIE_SUFFIX}.a LIBZPOOLDIR= ${_LIB_OBJTOP}/cddl/lib/libzpool LIBZPOOL?= ${LIBZPOOLDIR}/libzpool${PIE_SUFFIX}.a LIBZUTILDIR= ${_LIB_OBJTOP}/cddl/lib/libzutil LIBZUTIL?= ${LIBZUTILDIR}/libzutil${PIE_SUFFIX}.a LIBTPOOLDIR= ${_LIB_OBJTOP}/cddl/lib/libtpool # OFED support LIBCXGB4DIR= ${_LIB_OBJTOP}/lib/ofed/libcxgb4 LIBIBCMDIR= ${_LIB_OBJTOP}/lib/ofed/libibcm LIBIBMADDIR= ${_LIB_OBJTOP}/lib/ofed/libibmad LIBIBNETDISCDIR=${_LIB_OBJTOP}/lib/ofed/libibnetdisc LIBIBUMADDIR= ${_LIB_OBJTOP}/lib/ofed/libibumad LIBIBVERBSDIR= ${_LIB_OBJTOP}/lib/ofed/libibverbs LIBIRDMADIR= ${_LIB_OBJTOP}/lib/ofed/libirdma LIBMLX4DIR= ${_LIB_OBJTOP}/lib/ofed/libmlx4 LIBMLX5DIR= ${_LIB_OBJTOP}/lib/ofed/libmlx5 LIBRDMACMDIR= ${_LIB_OBJTOP}/lib/ofed/librdmacm LIBOSMCOMPDIR= ${_LIB_OBJTOP}/lib/ofed/complib LIBOPENSMDIR= ${_LIB_OBJTOP}/lib/ofed/libopensm LIBOSMVENDORDIR=${_LIB_OBJTOP}/lib/ofed/libvendor LIBDIALOGDIR= ${_LIB_OBJTOP}/gnu/lib/libdialog LIBSSPDIR= ${_LIB_OBJTOP}/lib/libssp LIBSSP_NONSHAREDDIR= ${_LIB_OBJTOP}/lib/libssp_nonshared LIBASN1DIR= ${_LIB_OBJTOP}/kerberos5/lib/libasn1 LIBGSSAPI_KRB5DIR= ${_LIB_OBJTOP}/kerberos5/lib/libgssapi_krb5 LIBGSSAPI_NTLMDIR= ${_LIB_OBJTOP}/kerberos5/lib/libgssapi_ntlm LIBGSSAPI_SPNEGODIR= ${_LIB_OBJTOP}/kerberos5/lib/libgssapi_spnego LIBHDBDIR= ${_LIB_OBJTOP}/kerberos5/lib/libhdb LIBHEIMBASEDIR= ${_LIB_OBJTOP}/kerberos5/lib/libheimbase LIBHEIMIPCCDIR= ${_LIB_OBJTOP}/kerberos5/lib/libheimipcc LIBHEIMIPCSDIR= ${_LIB_OBJTOP}/kerberos5/lib/libheimipcs LIBHEIMNTLMDIR= ${_LIB_OBJTOP}/kerberos5/lib/libheimntlm LIBHX509DIR= ${_LIB_OBJTOP}/kerberos5/lib/libhx509 LIBKADM5CLNTDIR= ${_LIB_OBJTOP}/kerberos5/lib/libkadm5clnt LIBKADM5SRVDIR= ${_LIB_OBJTOP}/kerberos5/lib/libkadm5srv LIBKAFS5DIR= ${_LIB_OBJTOP}/kerberos5/lib/libkafs5 LIBKDCDIR= ${_LIB_OBJTOP}/kerberos5/lib/libkdc LIBKRB5DIR= ${_LIB_OBJTOP}/kerberos5/lib/libkrb5 LIBROKENDIR= ${_LIB_OBJTOP}/kerberos5/lib/libroken LIBWINDDIR= ${_LIB_OBJTOP}/kerberos5/lib/libwind LIBATF_CDIR= ${_LIB_OBJTOP}/lib/atf/libatf-c LIBATF_CXXDIR= ${_LIB_OBJTOP}/lib/atf/libatf-c++ LIBGMOCKDIR= ${_LIB_OBJTOP}/lib/googletest/gmock LIBGMOCK_MAINDIR= ${_LIB_OBJTOP}/lib/googletest/gmock_main LIBGTESTDIR= ${_LIB_OBJTOP}/lib/googletest/gtest LIBGTEST_MAINDIR= ${_LIB_OBJTOP}/lib/googletest/gtest_main LIBALIASDIR= ${_LIB_OBJTOP}/lib/libalias/libalias LIBBLACKLISTDIR= ${_LIB_OBJTOP}/lib/libblacklist LIBBLOCKSRUNTIMEDIR= ${_LIB_OBJTOP}/lib/libblocksruntime LIBBSNMPDIR= ${_LIB_OBJTOP}/lib/libbsnmp/libbsnmp LIBCASPERDIR= ${_LIB_OBJTOP}/lib/libcasper/libcasper LIBCAP_DNSDIR= ${_LIB_OBJTOP}/lib/libcasper/services/cap_dns LIBCAP_GRPDIR= ${_LIB_OBJTOP}/lib/libcasper/services/cap_grp LIBCAP_NETDIR= ${_LIB_OBJTOP}/lib/libcasper/services/cap_net LIBCAP_PWDDIR= ${_LIB_OBJTOP}/lib/libcasper/services/cap_pwd LIBCAP_SYSCTLDIR= ${_LIB_OBJTOP}/lib/libcasper/services/cap_sysctl LIBCAP_SYSLOGDIR= ${_LIB_OBJTOP}/lib/libcasper/services/cap_syslog LIBCBORDIR= ${_LIB_OBJTOP}/lib/libcbor LIBBSDXMLDIR= ${_LIB_OBJTOP}/lib/libexpat LIBFIDO2DIR= ${_LIB_OBJTOP}/lib/libfido2 LIBKVMDIR= ${_LIB_OBJTOP}/lib/libkvm LIBPTHREADDIR= ${_LIB_OBJTOP}/lib/libthr LIBMDIR= ${_LIB_OBJTOP}/lib/msun LIBFORMWDIR= ${_LIB_OBJTOP}/lib/ncurses/form LIBMENUWDIR= ${_LIB_OBJTOP}/lib/ncurses/menu LIBNCURSESWDIR= ${_LIB_OBJTOP}/lib/ncurses/ncurses LIBTINFOWDIR= ${_LIB_OBJTOP}/lib/ncurses/tinfo LIBPANELWDIR= ${_LIB_OBJTOP}/lib/ncurses/panel LIBCRYPTODIR= ${_LIB_OBJTOP}/secure/lib/libcrypto LIBSPLDIR= ${_LIB_OBJTOP}/cddl/lib/libspl LIBSSHDIR= ${_LIB_OBJTOP}/secure/lib/libssh LIBSSLDIR= ${_LIB_OBJTOP}/secure/lib/libssl LIBTEKENDIR= ${_LIB_OBJTOP}/sys/teken/libteken LIBEGACYDIR= ${_LIB_OBJTOP}/tools/build LIBLNDIR= ${_LIB_OBJTOP}/usr.bin/lex/lib LIBTERMCAPWDIR= ${LIBTINFOWDIR} .-include # Default other library directories to lib/libNAME. .for lib in ${_LIBRARIES} LIB${lib:tu}DIR?= ${OBJTOP}/lib/lib${lib} .endfor # Validate that listed LIBADD are valid. .for _l in ${LIBADD} .if empty(_LIBRARIES:M${_l}) _BADLIBADD+= ${_l} .endif .endfor .if !empty(_BADLIBADD) .error ${.CURDIR}: Invalid LIBADD used which may need to be added to ${_this:T}: ${_BADLIBADD} .endif # Sanity check that libraries are defined here properly when building them. .if defined(LIB) && ${_LIBRARIES:M${LIB}} != "" .if !empty(LIBADD) && \ (!defined(_DP_${LIB}) || ${LIBADD:O:u} != ${_DP_${LIB}:O:u}) .error ${.CURDIR}: Missing or incorrect _DP_${LIB} entry in ${_this:T}. Should match LIBADD for ${LIB} ('${LIBADD}' vs '${_DP_${LIB}}') .endif # Note that OBJTOP is not yet defined here but for the purpose of the check # it is fine as it resolves to the SRC directory. .if !defined(LIB${LIB:tu}DIR) || !exists(${SRCTOP}/${LIB${LIB:tu}DIR:S,^${OBJTOP}/,,}) .error ${.CURDIR}: Missing or incorrect value for LIB${LIB:tu}DIR in ${_this:T}: ${LIB${LIB:tu}DIR:S,^${OBJTOP}/,,} .endif .if ${_INTERNALLIBS:M${LIB}} != "" && !defined(LIB${LIB:tu}) .error ${.CURDIR}: Missing value for LIB${LIB:tu} in ${_this:T}. Likely should be: LIB${LIB:tu}?= $${LIB${LIB:tu}DIR}/lib${LIB}.a .endif .endif .endif # !target(____) diff --git a/share/mk/src.lua.mk b/share/mk/src.lua.mk index 7d8bc05fdfcf..063ca97ea7d2 100644 --- a/share/mk/src.lua.mk +++ b/share/mk/src.lua.mk @@ -1,44 +1,44 @@ # # Lua helper file for FreeBSD /usr/src builds. # # This file provides any necessary assistance for consumers of Lua in the base # system. .if !target(____) -____: +____: .NOTMAIN .include # # LUA_INSTALL_PATH and LUA_CMD describe where the internal lua has been # installed to, along with the name of the internal command. The default # name is flua. # # LUA_CMD can be overwritten to point to a Lua that isn't flua. This is fine, # but parts of the src build that use it may have certain expectations that # may only be fulfilled by the in-tree Lua. The user overwriting it is expected # to understand these and provide the expectations. # # flua is currently equivalent to Lua 5.3, with the following modules: # - luafilesystem # - lua-posix # LUA_INSTALL_PATH?= ${LIBEXECDIR} LUA_CMD?= flua # # Some standalone usage may want a variable that tries to find the lua command, # and cannot necessarily embed the logic for trying to find it amongst bootstrap # tools. For these, we provide the LUA variable. # # The LUA variable should point to LUA_CMD on the system, if it exists. # Otherwise, consumers will have to settle for a PATH search and PATH being # appropriately set. # .if !defined(LUA) && exists(${LUA_INSTALL_PATH}/${LUA_CMD}) LUA= ${LUA_INSTALL_PATH}/${LUA_CMD} .else LUA?= ${LUA_CMD} .endif .endif # !target(____) diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index ef8711db713f..956220be43b3 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -1,523 +1,523 @@ # # Option file for FreeBSD /usr/src builds, at least the userland and boot loader # portions of the tree. These options generally chose what parts of the tree to # include or omit and are FreeBSD source tree specific. # # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} # with sensible (usually) defaults. # # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that # are applicable for that Makefile (typically there are none, but sometimes there # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish # to omit from that make. # # Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO # variable. # # Makefiles may also assume that this file is included by src.opts.mk should it # need variables defined there prior to the end of the Makefile where # bsd.{subdir,lib.bin}.mk is traditionally included. # # The old-style YES_FOO and NO_FOO are being phased out. No new instances of them # should be added. Old instances should be removed since they were just to # bridge the gap between FreeBSD 4 and FreeBSD 5. # # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an # exception is made for _WITHOUT_SRCONF which turns off this mechanism # completely inside bsd.*.mk files). # .if !target(____) -____: +____: .NOTMAIN .include # # Define MK_* variables (which are either "yes" or "no") for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the # make(1) environment. # These should be tested with `== "no"' or `!= "no"' in makefiles. # The NO_* variables should only be set by makefiles for variables # that haven't been converted over. # # These options are used by the src builds. Those listed in # __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned # off. __DEFAULT_NO_OPTIONS will default to 'no' and won't build # unless turned on. Any options listed in 'BROKEN_OPTIONS' will be # hard-wired to 'no'. "Broken" here means not working or # not-appropriate and/or not supported. It doesn't imply something is # wrong with the code. There's not a single good word for this, so # BROKEN was selected as the least imperfect one considered at the # time. Options are added to BROKEN_OPTIONS list on a per-arch basis. # At this time, there's no provision for mutually incompatible options. # Options listed in 'REQUIRED_OPTIONS' will be hard-wired to 'yes'; this # is intended as a transitional measure while options are in the process # of being removed. __DEFAULT_YES_OPTIONS = \ ACCT \ ACPI \ APM \ AT \ AUDIT \ AUTHPF \ AUTOFS \ BHYVE \ BLACKLIST \ BLUETOOTH \ BOOT \ BOOTPARAMD \ BOOTPD \ BSD_CPIO \ BSDINSTALL \ BSNMP \ BZIP2 \ CALENDAR \ CAROOT \ CCD \ CDDL \ CLANG \ CLANG_BOOTSTRAP \ CPP \ CROSS_COMPILER \ CRYPT \ CUSE \ CXGBETOOL \ DICT \ DMAGENT \ DTRACE \ DYNAMICROOT \ EE \ EFI \ ELFTOOLCHAIN_BOOTSTRAP \ EXAMPLES \ FILE \ FINGER \ FLOPPY \ FORTH \ FP_LIBC \ FREEBSD_UPDATE \ FTP \ GAMES \ GNU_DIFF \ GOOGLETEST \ GPIO \ HAST \ HTML \ HYPERV \ ICONV \ INET \ INET6 \ INETD \ IPFILTER \ IPFW \ ISCSI \ JAIL \ JEMALLOC_LG_VADDR_WIDE \ KDUMP \ KVM \ LDNS \ LDNS_UTILS \ LEGACY_CONSOLE \ LLD \ LLD_BOOTSTRAP \ LLVM_ASSERTIONS \ LLVM_BINUTILS \ LLVM_COV \ LLVM_CXXFILT \ LOADER_BIOS_TEXTONLY \ LOADER_GELI \ LOADER_KBOOT \ LOADER_LUA \ LOADER_OFW \ LOADER_PXEBOOT \ LOADER_UBOOT \ LOADER_IA32 \ LOCALES \ LOCATE \ LPR \ LS_COLORS \ MACHDEP_OPTIMIZATIONS \ MAIL \ MAILWRAPPER \ MAKE \ MLX5TOOL \ NETCAT \ NETGRAPH \ NETLINK \ NETLINK_SUPPORT \ NLS_CATALOGS \ NS_CACHING \ NTP \ NUAGEINIT \ OFED \ OPENSSL \ PAM \ PF \ PKGBOOTSTRAP \ PMC \ PPP \ PTHREADS_ASSERTIONS \ QUOTAS \ RADIUS_SUPPORT \ RBOOTD \ RESCUE \ ROUTED \ SENDMAIL \ SERVICESDB \ SETUID_LOGIN \ SHAREDOCS \ SOURCELESS \ SOURCELESS_HOST \ SOURCELESS_UCODE \ STATS \ SYSCONS \ SYSTEM_COMPILER \ SYSTEM_LINKER \ TALK \ TCP_WRAPPERS \ TCSH \ TELNET \ TEXTPROC \ TFTP \ UNBOUND \ USB \ UTMPX \ VI \ VT \ WIRELESS \ WPA_SUPPLICANT_EAPOL \ ZFS \ ZFS_TESTS \ LOADER_ZFS \ ZONEINFO __DEFAULT_NO_OPTIONS = \ BEARSSL \ BHYVE_SNAPSHOT \ CLANG_EXTRAS \ CLANG_FORMAT \ CLEAN \ DIALOG \ DETECT_TZ_CHANGES \ DISK_IMAGE_TOOLS_BOOTSTRAP \ DTRACE_ASAN \ DTRACE_TESTS \ EXPERIMENTAL \ HESIOD \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ LLVM_FULL_DEBUGINFO \ MALLOC_PRODUCTION \ OFED_EXTRA \ OPENLDAP \ REPRODUCIBLE_BUILD \ RPCBIND_WARMSTART_SUPPORT \ SORT_THREADS \ ZONEINFO_LEAPSECONDS_SUPPORT \ __REQUIRED_OPTIONS = \ CASPER # LEFT/RIGHT. Left options which default to "yes" unless their corresponding # RIGHT option is disabled. __DEFAULT_DEPENDENT_OPTIONS= \ CLANG_FULL/CLANG \ LLVM_TARGET_ALL/CLANG \ LOADER_VERIEXEC/BEARSSL \ LOADER_EFI_SECUREBOOT/LOADER_VERIEXEC \ LOADER_VERIEXEC_VECTX/LOADER_VERIEXEC \ VERIEXEC/BEARSSL \ __SINGLE_OPTIONS = \ LIBC_MALLOC __LIBC_MALLOC_OPTIONS= jemalloc __LIBC_MALLOC_DEFAULT= jemalloc # MK_*_SUPPORT options which default to "yes" unless their corresponding # MK_* variable is set to "no". # .for var in \ BLACKLIST \ BZIP2 \ INET \ INET6 \ KERBEROS \ KVM \ NETGRAPH \ PAM \ TESTS \ WIRELESS __DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var} .endfor # # Default behaviour of some options depends on the architecture. Unfortunately # this means that we have to test TARGET_ARCH (the buildworld case) as well # as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not # used at all in bsd.*.mk, but we have to make an exception here if we want # to allow defaults for some things like clang to vary by target architecture. # Additional, per-target behavior should be rarely added only after much # gnashing of teeth and grinding of gears. # .if defined(TARGET_ARCH) __T=${TARGET_ARCH} .else __T=${MACHINE_ARCH} .endif # All supported backends for LLVM_TARGET_XXX __LLVM_TARGETS= \ aarch64 \ arm \ powerpc \ riscv \ x86 __LLVM_TARGET_FILT= C/(amd64|i386)/x86/:C/powerpc.*/powerpc/:C/armv[67]/arm/:C/riscv.*/riscv/ .for __llt in ${__LLVM_TARGETS} # Default enable the given TARGET's LLVM_TARGET support .if ${__T:${__LLVM_TARGET_FILT}} == ${__llt} __DEFAULT_YES_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu} # aarch64 needs arm for -m32 support. .elif ${__T} == "aarch64" && ${__llt:Marm*} != "" __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_ARM/LLVM_TARGET_AARCH64 # Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL. .else __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL .endif .endfor __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF LLVM_TARGET_MIPS .include .if ${__T} == "i386" || ${__T} == "amd64" __DEFAULT_NO_OPTIONS += FDT .else __DEFAULT_YES_OPTIONS += FDT .endif .if ${__T:Marm*} == "" && ${__T:Mriscv64*} == "" __DEFAULT_YES_OPTIONS+=LLDB .else __DEFAULT_NO_OPTIONS+=LLDB .endif # LIB32 is not supported on all 64-bit architectures. .if (${__T:Maarch64*} != "" && ((defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} != "gcc") || (!defined(X_COMPILER_TYPE) && ${COMPILER_TYPE} != "gcc"))) || ${__T} == "amd64" || ${__T} == "powerpc64" __DEFAULT_YES_OPTIONS+=LIB32 .else BROKEN_OPTIONS+=LIB32 .endif # EFI doesn't exist on powerpc (well, officially) and doesn't work on i386 .if ${__T:Mpowerpc*} || ${__T} == "i386" BROKEN_OPTIONS+=EFI .endif # Bad coupling for libsecure stuff with bearssl and efi, so broken on EFI .if ${__T:Mpowerpc*} BROKEN_OPTIONS+=BEARSSL # bearssl brings in secure efi stuff xxx .endif # OFW is only for powerpc, exclude others .if ${__T:Mpowerpc*} == "" BROKEN_OPTIONS+=LOADER_OFW .endif # KBOOT is only for powerpc64 (powerpc64le broken) amd64 and aarch64 .if ${__T} != "powerpc64" && ${__T} != "amd64" && ${__T} != "aarch64" BROKEN_OPTIONS+=LOADER_KBOOT .endif # UBOOT is only for arm, and big-endian powerpc .if (${__T:Marm*} == "" && ${__T:Mpowerpc*} == "") || ${__T} == "powerpc64le" BROKEN_OPTIONS+=LOADER_UBOOT .endif # The 32-bit UEFI loader is only for amd64 .if ${__T} != "amd64" BROKEN_OPTIONS+=LOADER_IA32 .endif # GELI and Lua in loader currently cause boot failures on powerpc. # Further debugging is required -- probably they are just broken on big # endian systems generically (they jump to null pointers or try to read # crazy high addresses, which is typical of endianness problems). .if ${__T:Mpowerpc*} BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA .endif # Kernel TLS is enabled by default on amd64, aarch64 and powerpc64* .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T:Mpowerpc64*} != "" __DEFAULT_YES_OPTIONS+=OPENSSL_KTLS .else __DEFAULT_NO_OPTIONS+=OPENSSL_KTLS .endif .if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \ ${__T:Mpowerpc64*} == "" BROKEN_OPTIONS+=CXGBETOOL BROKEN_OPTIONS+=MLX5TOOL .endif .if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "aarch64" BROKEN_OPTIONS+=HYPERV .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ ${__T:Mpowerpc64*} != "" || ${__T:Mriscv64*} != "" __DEFAULT_YES_OPTIONS+=OPENMP .else __DEFAULT_NO_OPTIONS+=OPENMP .endif # Broken on 32-bit arm, kernel module compile errors .if ${__T:Marm*} != "" BROKEN_OPTIONS+= OFED .endif # MK_host_egacy is set by local.sys.mk so is valid here .if ${MACHINE:Nhost*} == "" && ${MK_host_egacy} == "yes" # we cannot expect tests to work BROKEN_OPTIONS+= TESTS .endif .-include .include # # Force some options off if their dependencies are off. # Order is somewhat important. # .if ${MK_SOURCELESS} == "no" MK_SOURCELESS_HOST:= no MK_SOURCELESS_UCODE:= no .endif .if ${MK_CDDL} == "no" MK_CTF:= no MK_DTRACE:= no MK_LOADER_ZFS:= no MK_ZFS:= no .endif .if ${MK_CRYPT} == "no" MK_OPENSSL:= no MK_OPENSSH:= no MK_KERBEROS:= no MK_KERBEROS_SUPPORT:= no .endif .if ${MK_DTRACE} == "no" MK_CTF:= no .endif .if ${MK_MAIL} == "no" MK_MAILWRAPPER:= no MK_SENDMAIL:= no MK_DMAGENT:= no .endif .if ${MK_NETGRAPH} == "no" MK_BLUETOOTH:= no .endif .if ${MK_NLS} == "no" MK_NLS_CATALOGS:= no .endif .if ${MK_OPENSSL} == "no" MK_DMAGENT:= no MK_OPENSSH:= no MK_OPENSSL_KTLS:= no MK_KERBEROS:= no MK_KERBEROS_SUPPORT:= no MK_LDNS:= no MK_PKGBOOTSTRAP:= no MK_LOADER_ZFS:= no MK_ZFS:= no .endif .if ${MK_LDNS} == "no" MK_LDNS_UTILS:= no MK_UNBOUND:= no .endif .if ${MK_PF} == "no" MK_AUTHPF:= no .endif .if ${MK_OFED} == "no" MK_OFED_EXTRA:= no .endif .if ${MK_TESTS} == "no" MK_DTRACE_TESTS:= no MK_ZFS_TESTS:= no .endif .if ${MK_ZFS} == "no" MK_ZFS_TESTS:= no .endif .if ${MK_TESTS_SUPPORT} == "no" MK_GOOGLETEST:= no .endif .if ${MK_ZONEINFO} == "no" MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no .endif .if ${MK_CROSS_COMPILER} == "no" MK_CLANG_BOOTSTRAP:= no MK_ELFTOOLCHAIN_BOOTSTRAP:= no MK_LLD_BOOTSTRAP:= no .endif .if ${MK_TOOLCHAIN} == "no" MK_CLANG:= no MK_LLD:= no MK_LLDB:= no MK_LLVM_BINUTILS:= no .endif .if ${MK_CLANG} == "no" MK_CLANG_EXTRAS:= no MK_CLANG_FORMAT:= no MK_CLANG_FULL:= no MK_LLVM_COV:= no .endif .if ${MK_ASAN} == "yes" # In order to get sensible backtraces from ASAN we have to install # llvm-symbolizer as /usr/bin/addr2line instead of the elftoolchain version. MK_LLVM_BINUTILS:= yes .endif .if ${MK_LLVM_BINUTILS} == "yes" # MK_LLVM_CXXFILT is a subset of MK_LLVM_BINUTILS and should therefore be # enabled if MK_LLVM_BINUTILS is set. MK_LLVM_CXXFILT:= yes .endif .if ${MK_LOADER_VERIEXEC} == "no" MK_LOADER_VERIEXEC_PASS_MANIFEST := no .endif # # MK_* options whose default value depends on another option. # .for vv in \ GSSAPI/KERBEROS \ MAN_UTILS/MAN .if defined(WITH_${vv:H}) MK_${vv:H}:= yes .elif defined(WITHOUT_${vv:H}) MK_${vv:H}:= no .else MK_${vv:H}:= ${MK_${vv:T}} .endif .endfor # # Set defaults for the MK_*_SUPPORT variables. # .endif # !target(____) diff --git a/share/mk/src.tools.mk b/share/mk/src.tools.mk index 23012593222b..70053c9b4a32 100644 --- a/share/mk/src.tools.mk +++ b/share/mk/src.tools.mk @@ -1,25 +1,25 @@ # Various tools used by the FreeBSD make installworld / distrib-dirs / # distribution / installkernel targets. Also called "bootstrap tools" # historically, however that name seemed to be ambiguous, as those tools # merely help distributing the OS build artefacts into staging / production # area. # # Very tiny subset of "itools", if you are old enough to know what it is. # # Please keep the list short, this file may and will be included from # many places within the source tree. Rule of thumb: if the above mentioned # targets survive with MYTOOL_CMD=false, then MYTOOL_CMD probably # does not belong here. Stick it somewhere else, thank you very much! # .if !target(____) INSTALL_CMD?= install MTREE_CMD?= mtree PWD_MKDB_CMD?= pwd_mkdb SERVICES_MKDB_CMD?= services_mkdb CAP_MKDB_CMD?= cap_mkdb TIC_CMD?= tic -____: +____: .NOTMAIN .endif # !target(____)