aboutsummaryrefslogtreecommitdiff
path: root/share/mk
diff options
context:
space:
mode:
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/Makefile1
-rw-r--r--share/mk/bsd.README4
-rw-r--r--share/mk/bsd.compat.mk1
-rw-r--r--share/mk/bsd.cpu.mk7
-rw-r--r--share/mk/bsd.debug.mk68
-rw-r--r--share/mk/bsd.lib.mk110
-rw-r--r--share/mk/bsd.man.mk40
-rw-r--r--share/mk/bsd.opts.mk3
-rw-r--r--share/mk/bsd.own.mk7
-rw-r--r--share/mk/bsd.prog.mk55
-rw-r--r--share/mk/bsd.test.mk3
-rw-r--r--share/mk/local.dirdeps.mk2
-rw-r--r--share/mk/src.libnames.mk4
-rw-r--r--share/mk/src.opts.mk5
-rw-r--r--share/mk/src.sys.mk6
15 files changed, 192 insertions, 124 deletions
diff --git a/share/mk/Makefile b/share/mk/Makefile
index 4ab5c8cc314b..0e786b381fe2 100644
--- a/share/mk/Makefile
+++ b/share/mk/Makefile
@@ -22,6 +22,7 @@ FILES= \
bsd.confs.mk \
bsd.cpu.mk \
bsd.crunchgen.mk \
+ bsd.debug.mk \
bsd.dep.mk \
bsd.dirs.mk \
bsd.doc.mk \
diff --git a/share/mk/bsd.README b/share/mk/bsd.README
index 4820bf12c72d..85baba7ba117 100644
--- a/share/mk/bsd.README
+++ b/share/mk/bsd.README
@@ -20,6 +20,7 @@ bsd.compiler.mk - defined based on current compiler
bsd.confs.mk - install of configuration files
bsd.cpu.mk - sets CPU/arch-related variables (included from sys.mk)
bsd.crunchgen.mk - building crunched binaries using crunchgen(1)
+bsd.debug.mk - handling debug options for bsd.{prog,lib}.mk
bsd.dep.mk - handle Makefile dependencies
bsd.dirs.mk - handle directory creation
bsd.doc.mk - building troff system documents
@@ -258,6 +259,9 @@ MLINKS List of manual page links (using a .1 - .9 suffix). The
linked-to file must come first, the linked file second,
and there may be multiple pairs. The files are hard-linked.
+MANSRC.${MAN:T} Name of source file for an individual manual page.
+ Defaults to the manual page name.
+
The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
it exists.
diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk
index 6fa732fd730b..bad68d1ebd8e 100644
--- a/share/mk/bsd.compat.mk
+++ b/share/mk/bsd.compat.mk
@@ -74,6 +74,7 @@ LIB32WMAKEFLAGS= \
LIB32WMAKEFLAGS+= NM="${XNM}"
LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}"
+LIB32WMAKEFLAGS+= STRIPBIN="${XSTRIPBIN}"
LIB32DTRACE= ${DTRACE} -32
LIB32_MACHINE_ABI= ${MACHINE_ABI:N*64} long32 ptr32
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index f6599a0ad802..1225d690e908 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -391,8 +391,11 @@ MACHINE_ABI+= soft-float
.else
MACHINE_ABI+= hard-float
.endif
-# Currently all 64-bit architectures include 64 in their name (see arch(7)).
-.if ${MACHINE_ARCH:M*64*}
+# Currently all 64-bit FreeBSD architectures include 64 in their name
+# (see arch(7)). We need a special case for cross-building from macOS
+# (which uses arm64/arm).
+.if ${MACHINE_ARCH:M*64*} || \
+ (defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Darwin" && ${MACHINE} == "arm64")
MACHINE_ABI+= long64
.else
MACHINE_ABI+= long32
diff --git a/share/mk/bsd.debug.mk b/share/mk/bsd.debug.mk
new file mode 100644
index 000000000000..cf2fb4356aef
--- /dev/null
+++ b/share/mk/bsd.debug.mk
@@ -0,0 +1,68 @@
+#
+# This file configures debug options for compiled targets. It is meant
+# to consolidate common logic in bsd.prog.mk and bsd.lib.mk. It should
+# not be included directly by Makefiles.
+#
+
+.include <bsd.opts.mk>
+
+.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 reproducible build mode is enabled, map the root of the source
+# directory to /usr/src and the root of the object directory to
+# /usr/obj.
+.if ${MK_REPRODUCIBLE_BUILD} != "no" && !defined(DEBUG_PREFIX)
+.if defined(SRCTOP)
+DEBUG_PREFIX+= ${SRCTOP:S,/$,,}=/usr/src
+.endif
+.if defined(OBJROOT)
+# Strip off compat subdirectories, e.g., /usr/obj/usr/src/amd64.amd64/obj-lib32
+# becomes /usr/obj/usr/src/amd64.amd64, since object files compiled there might
+# refer to something outside the root.
+DEBUG_PREFIX+= ${OBJROOT:S,/$,,:C,/obj-[^/]*$,,}=/usr/obj
+.endif
+.endif
+
+.if defined(DEBUG_PREFIX)
+.for map in ${DEBUG_PREFIX}
+CFLAGS+= -ffile-prefix-map=${map}
+CXXFLAGS+= -ffile-prefix-map=${map}
+.endfor
+.endif
+
+.if defined(DEBUG_FLAGS)
+CFLAGS+=${DEBUG_FLAGS}
+CXXFLAGS+=${DEBUG_FLAGS}
+
+.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
+CTFFLAGS+= -g
+.endif
+.else
+STRIP?= -s
+.endif
+
+.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
+
+_debuginstall:
+.if ${MK_DEBUG_FILES} != "no" && defined(DEBUGFILE)
+.if defined(DEBUGMKDIR)
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/
+.endif
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${DEBUGOWN} -g ${DEBUGGRP} -m ${DEBUGMODE} \
+ ${DEBUGFILE} ${DESTDIR}${DEBUGFILEDIR}/${DEBUGFILE}
+.endif
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 3013f32c2b36..065e635ed43d 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -1,4 +1,3 @@
-
.include <bsd.init.mk>
.include <bsd.compiler.mk>
.include <bsd.linker.mk>
@@ -45,23 +44,6 @@ SONAME?= ${SHLIB_NAME}
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}
@@ -70,10 +52,37 @@ TAGS+= lib${_libcompat}
.if defined(NO_ROOT)
.if !defined(TAGS) || ! ${TAGS:Mpackage=*}
-TAGS+= package=${PACKAGE:Uutilities}
+TAGS+= package=${PACKAGE:Uutilities}
+.endif
+
+# By default, if PACKAGE=foo, then the native runtime libraries will go into
+# the FreeBSD-foo package, and subpackages will be created for -dev, -lib32,
+# and so on. If LIB_PACKAGE is set, then we also create a subpackage for
+# runtime libraries with a -lib suffix. This is used when a package has
+# libraries and some other content (e.g., executables) to allow consumers to
+# depend on the libraries.
+.if defined(LIB_PACKAGE) && ! ${TAGS:Mlib*}
+.if !defined(PACKAGE)
+.error LIB_PACKAGE cannot be used without PACKAGE
+.endif
+
+LIB_TAG_ARGS= ${TAG_ARGS},lib
+.else
+LIB_TAG_ARGS= ${TAG_ARGS}
.endif
+
TAG_ARGS= -T ${TAGS:ts,:[*]}
+
+DBG_TAG_ARGS= ${TAG_ARGS},dbg
+# Usually we want to put development files (e.g., static libraries) into a
+# separate -dev packages but for a few cases, like tests, that's not wanted,
+# so allow the caller to disable it by setting NO_DEV_PACKAGE.
+.if !defined(NO_DEV_PACKAGE)
+DEV_TAG_ARGS= ${TAG_ARGS},dev
+.else
+DEV_TAG_ARGS= ${TAG_ARGS}
.endif
+.endif # !defined(NO_ROOT)
# ELF hardening knobs
.if ${MK_BIND_NOW} != "no"
@@ -130,18 +139,6 @@ CXXFLAGS+= -fzero-call-used-regs=${ZEROREG_TYPE}
# 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
@@ -156,6 +153,7 @@ _SHLIBDIR:=${SHLIBDIR}
.if defined(SHLIB_NAME)
.if ${MK_DEBUG_FILES} != "no"
SHLIB_NAME_FULL=${SHLIB_NAME}.full
+DEBUGFILE= ${SHLIB_NAME}.debug
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
.if ${_SHLIBDIR} == "/boot" ||\
${SHLIBDIR:C%/lib(/.*)?$%/lib%} == "/lib" ||\
@@ -272,16 +270,16 @@ ${SHLIB_NAME_FULL}: ${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 \
+CLEANFILES+= ${SHLIB_NAME_FULL} ${DEBUGFILE}
+${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${DEBUGFILE}
+ ${OBJCOPY} --strip-debug --add-gnu-debuglink=${DEBUGFILE} \
${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}
+${DEBUGFILE}: ${SHLIB_NAME_FULL}
${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET}
.endif
.endif #defined(SHLIB_NAME)
@@ -384,7 +382,7 @@ _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}}
installpcfiles: installpcfiles-${pcfile}
installpcfiles-${pcfile}: ${pcfile}
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${INSTALL} ${DEV_TAG_ARGS} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} \
${.ALLSRC} ${DESTDIR}${LIBDATADIR}/pkgconfig/
.endfor
@@ -392,49 +390,42 @@ installpcfiles-${pcfile}: ${pcfile}
installpcfiles: .PHONY
.if !defined(INTERNALLIB)
-realinstall: _libinstall installpcfiles
-.ORDER: beforeinstall _libinstall
+realinstall: _libinstall installpcfiles _debuginstall
+.ORDER: beforeinstall _libinstall _debuginstall
_libinstall:
.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${INSTALL} ${DEV_TAG_ARGS} -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} \
+ ${INSTALL} ${LIB_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} \
+ ${INSTALL} ${DEV_TAG_ARGS} -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}
+ ${INSTALL_LIBSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${LIB_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} \
+ ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${DEV_TAG_ARGS} \
${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
.else
- ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} ${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} \
+ ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${LIB_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} \
+ ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${DEV_TAG_ARGS} \
${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
.else
- ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${TAG_ARGS} \
+ ${INSTALL_RSYMLINK} ${_SHLINSTALLSYMLINKFLAGS} ${LIB_TAG_ARGS} \
${DESTDIR}${_SHLIBDIR}/${SHLIB_NAME} ${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
.endif
.if exists(${DESTDIR}${_LIBDIR}/${SHLIB_NAME})
@@ -446,7 +437,7 @@ _libinstall:
.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} \
+ ${INSTALL} ${DEV_TAG_ARGS} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/
.endif
.endif # !defined(INTERNALLIB)
@@ -466,7 +457,11 @@ LINKGRP?= ${LIBGRP}
LINKMODE?= ${LIBMODE}
SYMLINKOWN?= ${LIBOWN}
SYMLINKGRP?= ${LIBGRP}
-LINKTAGS= dev
+.if !defined(NO_DEV_PACKAGE)
+LINKTAGS= dev${_COMPAT_TAG}
+.else
+LINKTAGS= ${_COMPAT_TAG}
+.endif
.include <bsd.links.mk>
.if ${MK_MAN} != "no" && !defined(LIBRARIES_ONLY)
@@ -501,6 +496,7 @@ SUBDIR_TARGETS+= check
TESTS_LD_LIBRARY_PATH+= ${.OBJDIR}
.endif
+.include <bsd.debug.mk>
.include <bsd.dep.mk>
.include <bsd.clang-analyze.mk>
.include <bsd.obj.mk>
diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
index 66155d1b4cd9..0a3594e05d94 100644
--- a/share/mk/bsd.man.mk
+++ b/share/mk/bsd.man.mk
@@ -21,6 +21,9 @@
# MAN The manual pages to be installed. For sections see
# variable ${SECTIONS}
#
+# MANSRC.${MAN:T} Name of source file for an individual manual page.
+# Defaults to the manual page name.
+#
# MCOMPRESS_CMD Program to compress man pages. Output is to
# stdout. [${COMPRESS_CMD}]
#
@@ -102,15 +105,16 @@ manlinksinstall: manlinksinstall-${__group}
${__group}OWN?= ${MANOWN}
${__group}GRP?= ${MANGRP}
${__group}MODE?= ${MANMODE}
+${__group}PACKAGE?= ${PACKAGE:Uutilities}
# Tag processing is only done for NO_ROOT installs.
.if defined(NO_ROOT)
.if !defined(${__group}TAGS) || ! ${${__group}TAGS:Mpackage=*}
-.if ${MK_MANSPLITPKG} == "no"
-${__group}TAGS+= package=${${__group}PACKAGE:U${PACKAGE:Uutilities}}
+.if ${MK_MANSPLITPKG} == "no" || ${${__group}PACKAGE:M*-man}
+${__group}TAGS+= package=${${__group}PACKAGE}
.else
-${__group}TAGS+= package=${${__group}PACKAGE:U${PACKAGE:Uutilities}}-man
+${__group}TAGS+= package=${${__group}PACKAGE}-man
.endif
.endif
@@ -141,13 +145,13 @@ CLEANFILES+= ${${__group}:T:S/$/${CATEXT}${FILTEXTENSION}/g}
# filenames contain colons.
.for __target in ${__page:T:S/:/\:/g:S/$/${FILTEXTENSION}/g}
all-man: ${__target}
-${__target}: ${__page}
+${__target}: ${MANSRC.${__page:T}:U${__page}}
${MANFILTER} < ${.ALLSRC} > ${.TARGET}
.endfor
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
.for __target in ${__page:T:S/:/\:/g:S/$/${CATEXT}${FILTEXTENSION}/g}
all-man: ${__target}
-${__target}: ${__page}
+${__target}: ${MANSRC.${__page:T}:U${__page}}
${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} > ${.TARGET}
.endfor
.endif
@@ -160,12 +164,23 @@ CLEANFILES+= ${${__group}:T:S/$/${CATEXT}/g}
.for __page in ${${__group}}
.for __target in ${__page:T:S/:/\:/g:S/$/${CATEXT}/g}
all-man: ${__target}
-${__target}: ${__page}
+${__target}: ${MANSRC.${__page:T}:U${__page}}
${MANDOC_CMD} ${.ALLSRC} > ${.TARGET}
.endfor
.endfor
.else
-all-man: ${${__group}}
+.for __page in ${${__group}}
+.if defined(MANSRC.${__page:T})
+.for __target in ${__page:T:S/:/\:/g}
+all-man: ${__target}
+CLEANFILES+= ${__target}
+${__target}: ${MANSRC.${__page:T}}
+ ${CP} ${.ALLSRC} ${.TARGET}
+.endfor
+.else
+all-man: ${__page}
+.endif
+.endfor
.endif
.endif
.endif # defined(MANFILTER)
@@ -180,7 +195,7 @@ CLEANFILES+= ${${__group}:T:S/$/${CATEXT}${MCOMPRESS_EXT}/g}
.for __page in ${${__group}}
.for __target in ${__page:T:S/:/\:/g:S/$/${MCOMPRESS_EXT}/}
all-man: ${__target}
-${__target}: ${__page}
+${__target}: ${MANSRC.${__page:T}:U${__page}}
.if defined(MANFILTER)
${MANFILTER} < ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET}
.else
@@ -190,7 +205,7 @@ ${__target}: ${__page}
.if defined(MANBUILDCAT) && !empty(MANBUILDCAT)
.for __target in ${__page:T:S/:/\:/g:S/$/${CATEXT}${MCOMPRESS_EXT}/}
all-man: ${__target}
-${__target}: ${__page}
+${__target}: ${MANSRC.${__page:T}:U${__page}}
.if defined(MANFILTER)
${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} | ${MCOMPRESS_CMD} > ${.TARGET}
.else
@@ -238,7 +253,10 @@ stage_links.mlinks.${__group}: ${_mansets.${__group}:@s@stage_files.${__group}.$
realmaninstall-${__group}:
.if defined(${__group}) && !empty(${__group})
-realmaninstall-${__group}: ${${__group}}
+.for __page in ${${__group}}
+__mansrc.${__group}+= ${MANSRC.${__page:T}:U${__page}}
+.endfor
+realmaninstall-${__group}: ${__mansrc.${__group}}
.if ${MK_MANCOMPRESS} == "no"
.if defined(MANFILTER)
.for __page in ${${__group}}
@@ -292,7 +310,7 @@ manlint: .PHONY checkmanlinks
.if defined(${__group}) && !empty(${__group})
.for __page in ${${__group}}
manlint: ${__page:S/:/\:/g}lint
-${__page:S/:/\:/g}lint: .PHONY ${__page}
+${__page:S/:/\:/g}lint: .PHONY ${MANSRC.${__page:T}:U${__page}}
.if defined(MANFILTER)
${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} -Tlint
.else
diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk
index 85247d733a14..66eb427c3505 100644
--- a/share/mk/bsd.opts.mk
+++ b/share/mk/bsd.opts.mk
@@ -60,7 +60,6 @@ __DEFAULT_YES_OPTIONS = \
MAKE_CHECK_USE_SANDBOX \
MAN \
MANCOMPRESS \
- MANSPLITPKG \
NIS \
NLS \
OPENSSH \
@@ -78,6 +77,8 @@ __DEFAULT_NO_OPTIONS = \
CCACHE_BUILD \
CTF \
INSTALL_AS_USER \
+ MANSPLITPKG \
+ REPRODUCIBLE_BUILD \
RETPOLINE \
RUN_TESTS \
STALE_STAGED \
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 00a048fedc1d..4dffe9723a9e 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -44,6 +44,10 @@
#
# DEBUGMODE Mode for debug files. [${NOBINMODE}]
#
+# DEBUGOWN Owner for debug info files. [root]
+#
+# DEBUGGRP Group for debug info files. [wheel]
+#
#
# KMODDIR Base path for loadable kernel modules
# (see kld(4)). [/boot/modules]
@@ -197,7 +201,8 @@ LIBMODE?= ${NOBINMODE}
DEBUGDIR?= /usr/lib/debug
DEBUGMODE?= ${NOBINMODE}
-
+DEBUGOWN?= ${BINOWN}
+DEBUGGRP?= ${BINGRP}
# Share files
SHAREDIR?= /usr/share
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 9350d4786cec..10e1c177e2b2 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -12,22 +12,6 @@
CFLAGS+=${COPTS}
.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}
-CXXFLAGS+=${DEBUG_FLAGS}
-
-.if ${MK_CTF} != "no" && ${DEBUG_FLAGS:M-g} != ""
-CTFFLAGS+= -g
-.endif
-.endif
-
.if defined(PROG_CXX)
PROG= ${PROG_CXX}
.endif
@@ -109,20 +93,6 @@ CFLAGS += -mno-relax
.if defined(CRUNCH_CFLAGS)
CFLAGS+=${CRUNCH_CFLAGS}
-.else
-.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*}
-.else
-CFLAGS+= ${DEBUG_FILES_CFLAGS}
-.endif
-CTFFLAGS+= -g
-.endif
-.endif
-
-.if !defined(DEBUG_FLAGS)
-STRIP?= -s
.endif
.if defined(NO_ROOT)
@@ -159,6 +129,9 @@ PROG_FULL= ${PROG}
.if defined(PROG)
PROGNAME?= ${PROG}
+.if ${MK_DEBUG_FILES} != "no"
+DEBUGFILE= ${PROGNAME}.debug
+.endif
.if defined(SRCS)
@@ -223,11 +196,12 @@ ${PROG_FULL}: ${OBJS}
.endif # !defined(SRCS)
.if ${MK_DEBUG_FILES} != "no"
-${PROG}: ${PROG_FULL} ${PROGNAME}.debug
- ${OBJCOPY} --strip-debug --add-gnu-debuglink=${PROGNAME}.debug \
+CLEANFILES+= ${PROG_FULL} ${DEBUGFILE}
+${PROG}: ${PROG_FULL} ${DEBUGFILE}
+ ${OBJCOPY} --strip-debug --add-gnu-debuglink=${DEBUGFILE} \
${PROG_FULL} ${.TARGET}
-${PROGNAME}.debug: ${PROG_FULL}
+${DEBUGFILE}: ${PROG_FULL}
${OBJCOPY} --only-keep-debug ${PROG_FULL} ${.TARGET}
.endif
@@ -266,9 +240,6 @@ all: all-man
.if defined(PROG)
CLEANFILES+= ${PROG} ${PROG}.bc ${PROG}.ll
-.if ${MK_DEBUG_FILES} != "no"
-CLEANFILES+= ${PROG_FULL} ${PROGNAME}.debug
-.endif
.endif
.if defined(OBJS)
@@ -308,19 +279,12 @@ _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}}
.endfor
.if !target(realinstall) && !defined(INTERNALPROG)
-realinstall: _proginstall
-.ORDER: beforeinstall _proginstall
+realinstall: _proginstall _debuginstall
+.ORDER: beforeinstall _proginstall _debuginstall
_proginstall:
.if defined(PROG)
${INSTALL} ${TAG_ARGS} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
${_INSTALLFLAGS} ${PROG} ${DESTDIR}${BINDIR}/${PROGNAME}
-.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 ${BINOWN} -g ${BINGRP} -m ${DEBUGMODE} \
- ${PROGNAME}.debug ${DESTDIR}${DEBUGFILEDIR}/${PROGNAME}.debug
-.endif
.endif
.endif # !target(realinstall)
@@ -391,6 +355,7 @@ TESTS_PATH+= ${.OBJDIR}
OBJS_DEPEND_GUESS+= ${SRCS:M*.h}
.endif
+.include <bsd.debug.mk>
.include <bsd.dep.mk>
.include <bsd.clang-analyze.mk>
.include <bsd.obj.mk>
diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk
index a2e15c840e02..9f20e5835369 100644
--- a/share/mk/bsd.test.mk
+++ b/share/mk/bsd.test.mk
@@ -16,6 +16,9 @@ LOCALBASE?= /usr/local
TESTSDIR?= ${TESTSBASE}/${RELDIR:H}
PACKAGE?= tests
+# Prevent creating a -dev package for tests. Sometimes tests include static
+# libraries or other artifacts which are not actually "development" files.
+NO_DEV_PACKAGE=
FILESGROUPS+= ${PACKAGE}FILES
${PACKAGE}FILESPACKAGE= ${PACKAGE}
diff --git a/share/mk/local.dirdeps.mk b/share/mk/local.dirdeps.mk
index a92539689a31..bdc7242d4bfd 100644
--- a/share/mk/local.dirdeps.mk
+++ b/share/mk/local.dirdeps.mk
@@ -185,7 +185,7 @@ C_DIRDEPS= \
# libgcc is needed as well but is added later.
-.if ${MK_GSSAPI} != "no"
+.if ${MK_KERBEROS} != "no" && ${MK_MITKRB5} == "no"
C_DIRDEPS+= include/gssapi
.endif
diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk
index 9ca043e7733c..95cd3b02d8e4 100644
--- a/share/mk/src.libnames.mk
+++ b/share/mk/src.libnames.mk
@@ -29,6 +29,7 @@ _PRIVATELIBS= \
heimipcs \
kldelf \
ldns \
+ samplerate \
sqlite3 \
ssh \
ucl \
@@ -72,7 +73,6 @@ _INTERNALLIBS= \
pfctl \
pkgecc \
pmcstat \
- samplerate \
sl \
sm \
smdb \
@@ -329,7 +329,7 @@ _DP_archive+= md
.endif
.endif
_DP_sqlite3= pthread
-_DP_ssl= crypto
+_DP_ssl= pthread crypto
_DP_ssh= crypto crypt z
.if ${MK_LDNS} != "no"
_DP_ssh+= ldns
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index f146a4b24424..9bd4e6a1842f 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -80,7 +80,6 @@ __DEFAULT_YES_OPTIONS = \
CDDL \
CLANG \
CLANG_BOOTSTRAP \
- CLEAN \
CPP \
CROSS_COMPILER \
CRYPT \
@@ -201,6 +200,7 @@ __DEFAULT_NO_OPTIONS = \
BHYVE_SNAPSHOT \
CLANG_EXTRAS \
CLANG_FORMAT \
+ CLEAN \
DIALOG \
DETECT_TZ_CHANGES \
DISK_IMAGE_TOOLS_BOOTSTRAP \
@@ -214,7 +214,6 @@ __DEFAULT_NO_OPTIONS = \
MALLOC_PRODUCTION \
OFED_EXTRA \
OPENLDAP \
- REPRODUCIBLE_BUILD \
RPCBIND_WARMSTART_SUPPORT \
SORT_THREADS \
ZONEINFO_LEAPSECONDS_SUPPORT \
@@ -508,7 +507,7 @@ MK_LOADER_VERIEXEC_PASS_MANIFEST := no
# MK_* options whose default value depends on another option.
#
.for vv in \
- GSSAPI/KERBEROS \
+ KERBEROS_SUPPORT/KERBEROS \
MAN_UTILS/MAN
.if defined(WITH_${vv:H})
MK_${vv:H}:= yes
diff --git a/share/mk/src.sys.mk b/share/mk/src.sys.mk
index d5c2af0c559d..ec035fb71e54 100644
--- a/share/mk/src.sys.mk
+++ b/share/mk/src.sys.mk
@@ -6,7 +6,11 @@
.if !defined(_WITHOUT_SRCCONF)
# Allow user to configure things that only effect src tree builds.
+.if exists(${SRCTOP}/src.conf)
+SRCCONF?= ${SRCTOP}/src.conf
+.else
SRCCONF?= /etc/src.conf
+.endif
.if !empty(SRCCONF) && \
(exists(${SRCCONF}) || ${SRCCONF} != "/etc/src.conf") && \
!target(_srcconf_included_)
@@ -42,7 +46,7 @@ CFLAGS+= ${CFCOMMONFLAG}
CFLAGS+= -fmacro-prefix-map=${SRCTOP}=/usr/src -fdebug-prefix-map=${SRCTOP}=/usr/src
.endif
-DEFAULTWARNS= 6
+DEFAULTWARNS?= 6
# tempting, but bsd.compiler.mk causes problems this early
# probably need to remove dependence on bsd.own.mk