aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2015-05-26 21:52:57 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2015-05-26 21:52:57 +0000
commitb17ff922d4072ae132ece458f5b5d74a236880ac (patch)
treecbe2c5231a8355bd959e5b7054c2af5333fa7cf1
parentc4a81da0c86e429eb3e262498a8529ae341ecf1c (diff)
parente81032ad243db32b8fd615b2d55ee94b9f6a5b6a (diff)
downloadsrc-b17ff922d4072ae132ece458f5b5d74a236880ac.tar.gz
src-b17ff922d4072ae132ece458f5b5d74a236880ac.zip
Merge from head
Notes
Notes: svn path=/projects/bmake/; revision=283591
-rw-r--r--share/mk/Makefile1
-rw-r--r--share/mk/atf.test.mk6
-rw-r--r--share/mk/bsd.README9
-rw-r--r--share/mk/bsd.compiler.mk28
-rw-r--r--share/mk/bsd.cpu.mk89
-rw-r--r--share/mk/bsd.dep.mk11
-rw-r--r--share/mk/bsd.dtb.mk17
-rw-r--r--share/mk/bsd.endian.mk3
-rw-r--r--share/mk/bsd.incs.mk2
-rw-r--r--share/mk/bsd.info.mk6
-rw-r--r--share/mk/bsd.kmod.mk2
-rw-r--r--share/mk/bsd.lib.mk68
-rw-r--r--share/mk/bsd.libnames.mk40
-rw-r--r--share/mk/bsd.links.mk30
-rw-r--r--share/mk/bsd.man.mk16
-rw-r--r--share/mk/bsd.obj.mk10
-rw-r--r--share/mk/bsd.opts.mk13
-rw-r--r--share/mk/bsd.own.mk15
-rw-r--r--share/mk/bsd.prog.mk14
-rw-r--r--share/mk/bsd.progs.mk2
-rw-r--r--share/mk/bsd.subdir.mk2
-rw-r--r--share/mk/bsd.sys.mk25
22 files changed, 223 insertions, 186 deletions
diff --git a/share/mk/Makefile b/share/mk/Makefile
index b40c832ed209..ba26cb4abb7c 100644
--- a/share/mk/Makefile
+++ b/share/mk/Makefile
@@ -12,6 +12,7 @@ FILES= \
bsd.crunchgen.mk \
bsd.dep.mk \
bsd.doc.mk \
+ bsd.dtb.mk \
bsd.endian.mk \
bsd.files.mk \
bsd.incs.mk \
diff --git a/share/mk/atf.test.mk b/share/mk/atf.test.mk
index 08632037de22..dffd4665b847 100644
--- a/share/mk/atf.test.mk
+++ b/share/mk/atf.test.mk
@@ -72,11 +72,10 @@ MAN.${_T}?= # empty
SRCS.${_T}?= ${_T}.c
DPADD.${_T}+= ${LIBATF_C}
.if empty(LDFLAGS:M-static) && empty(LDFLAGS.${_T}:M-static)
-LDADD.${_T}+= ${LDATF_C}
+LDADD.${_T}+= ${LDADD_atf_c}
.else
LDADD.${_T}+= ${LIBATF_C}
.endif
-USEPRIVATELIB+= atf-c
TEST_INTERFACE.${_T}= atf
.endfor
.endif
@@ -90,11 +89,10 @@ MAN.${_T}?= # empty
SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc}
DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
.if empty(LDFLAGS:M-static) && empty(LDFLAGS.${_T}:M-static)
-LDADD.${_T}+= ${LDATF_CXX} ${LDATF_C}
+LDADD.${_T}+= ${LDADD_atf_cxx} ${LDADD_atf_c}
.else
LDADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C}
.endif
-USEPRIVATELIB+= atf-c++
TEST_INTERFACE.${_T}= atf
.endfor
.endif
diff --git a/share/mk/bsd.README b/share/mk/bsd.README
index 954984e040f2..89e7f1ca7045 100644
--- a/share/mk/bsd.README
+++ b/share/mk/bsd.README
@@ -146,7 +146,7 @@ MAN The manual pages to be installed (use a .1 - .9 suffix).
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 soft-linked.
+ and there may be multiple pairs. The files are hard-linked.
The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
it exists.
@@ -336,6 +336,13 @@ with the current needs of the BSD tree.
It sets/uses the following variables:
+LIB The name of the library to build.
+
+LIB_CXX The name of the library to build. It also causes
+ <bsd.lib.mk> to link the library with the
+ standard C++ library. LIB_CXX overrides the value
+ of LIB if LIB is also set.
+
LIBDIR Target directory for libraries.
LINTLIBDIR Target directory for lint libraries.
diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk
index c5d43d8ecf6d..cbd8fc4685aa 100644
--- a/share/mk/bsd.compiler.mk
+++ b/share/mk/bsd.compiler.mk
@@ -2,18 +2,22 @@
# Setup variables for the compiler
#
-# COMPILTER_TYPE is the major type of compiler. Currently gcc and clang support
-# automatic detetion. 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_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 overriden 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_VERSION is a numeric constant equal to:
+# major * 10000 + minor * 100 + tiny
+# It too can be overriden 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_FEATURES will contain one or more of the following, based on compiler support
-# for that feature: c++11 (supports full (or nearly full) C++11 programming environment).
+# COMPILER_FEATURES will contain one or more of the following, based on
+# compiler support for that feature:
+#
+# - c++11 : supports full (or nearly full) C++11 programming environment.
#
# This file may be included multiple times, but only has effect the first time.
#
@@ -24,9 +28,8 @@ __<bsd.compiler.mk>__:
.if ${MACHINE} == "common"
COMPILER_TYPE= none
COMPILER_VERSION= 0
-.else
+.elif !defined(COMPILER_TYPE) || !defined(COMPILER_VERSION)
_v!= ${CC} --version 2>/dev/null || echo 0.0.0
-.endif
.if !defined(COMPILER_TYPE)
. if ${CC:T:M*gcc*}
@@ -47,6 +50,7 @@ COMPILER_TYPE:= clang
COMPILER_VERSION!=echo ${_v:M[1-9].[0-9]*} | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}'
.endif
.undef _v
+.endif
.if ${COMPILER_TYPE} == "clang" || \
(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800)
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index f786109cdfd3..4b619086963b 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -24,41 +24,50 @@ MACHINE_CPU = mips
# Handle aliases (not documented in make.conf to avoid user confusion
# between e.g. i586 and pentium)
-. if ${MACHINE_CPUARCH} == "i386"
+. if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
. if ${CPUTYPE} == "barcelona"
CPUTYPE = amdfam10
-. elif ${CPUTYPE} == "k7"
-CPUTYPE = athlon
-. elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem"
-CPUTYPE = corei7
+. elif ${CPUTYPE} == "core-avx2"
+CPUTYPE = haswell
+. elif ${CPUTYPE} == "core-avx-i"
+CPUTYPE = ivybridge
+. elif ${CPUTYPE} == "corei7-avx"
+CPUTYPE = sandybridge
+. elif ${CPUTYPE} == "corei7"
+CPUTYPE = nehalem
+. elif ${CPUTYPE} == "slm"
+CPUTYPE = silvermont
+. elif ${CPUTYPE} == "atom"
+CPUTYPE = bonnell
. elif ${CPUTYPE} == "core"
CPUTYPE = prescott
-. elif ${CPUTYPE} == "p4"
+. endif
+. if ${MACHINE_CPUARCH} == "amd64"
+. if ${CPUTYPE} == "prescott"
+CPUTYPE = nocona
+. endif
+. else
+. if ${CPUTYPE} == "k7"
+CPUTYPE = athlon
+. elif ${CPUTYPE} == "p4"
CPUTYPE = pentium4
-. elif ${CPUTYPE} == "p4m"
+. elif ${CPUTYPE} == "p4m"
CPUTYPE = pentium4m
-. elif ${CPUTYPE} == "p3"
+. elif ${CPUTYPE} == "p3"
CPUTYPE = pentium3
-. elif ${CPUTYPE} == "p3m"
+. elif ${CPUTYPE} == "p3m"
CPUTYPE = pentium3m
-. elif ${CPUTYPE} == "p-m"
+. elif ${CPUTYPE} == "p-m"
CPUTYPE = pentium-m
-. elif ${CPUTYPE} == "p2"
+. elif ${CPUTYPE} == "p2"
CPUTYPE = pentium2
-. elif ${CPUTYPE} == "i686"
+. elif ${CPUTYPE} == "i686"
CPUTYPE = pentiumpro
-. elif ${CPUTYPE} == "i586/mmx"
+. elif ${CPUTYPE} == "i586/mmx"
CPUTYPE = pentium-mmx
-. elif ${CPUTYPE} == "i586"
+. elif ${CPUTYPE} == "i586"
CPUTYPE = pentium
-. endif
-. elif ${MACHINE_CPUARCH} == "amd64"
-. if ${CPUTYPE} == "barcelona"
-CPUTYPE = amdfam10
-. elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem"
-CPUTYPE = corei7
-. elif ${CPUTYPE} == "prescott"
-CPUTYPE = nocona
+. endif
. endif
. elif ${MACHINE_ARCH} == "sparc64"
. if ${CPUTYPE} == "us"
@@ -99,7 +108,7 @@ _CPUCFLAGS = -march=armv5te -D__XSCALE__
. elif ${CPUTYPE} == "armv6"
_CPUCFLAGS = -march=${CPUTYPE} -DARM_ARCH_6=1
. elif ${CPUTYPE} == "cortexa"
-_CPUCFLAGS = -DARM_ARCH_6=1 -mfpu=vfp
+_CPUCFLAGS = -march=armv7 -DARM_ARCH_6=1 -mfpu=vfp
. else
_CPUCFLAGS = -mcpu=${CPUTYPE}
. endif
@@ -140,7 +149,9 @@ _CPUCFLAGS = -mcpu=ultrasparc3
# presence of a CPU feature.
. if ${MACHINE_CPUARCH} == "i386"
-. if ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
+. if ${CPUTYPE} == "bdver4"
+MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
+. elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
${CPUTYPE} == "bdver1"
MACHINE_CPU = xop avx sse42 sse41 ssse3 sse4a sse3 sse2 sse mmx k6 k5 i586
. elif ${CPUTYPE} == "btver2"
@@ -165,15 +176,18 @@ MACHINE_CPU = 3dnow mmx k6 k5 i586
MACHINE_CPU = mmx k6 k5 i586
. elif ${CPUTYPE} == "k5"
MACHINE_CPU = k5 i586
-. elif ${CPUTYPE} == "core-avx2"
+. elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "knl"
+MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
+. elif ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell"
MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
-. elif ${CPUTYPE} == "core-avx-i" || ${CPUTYPE} == "corei7-avx"
+. elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge"
MACHINE_CPU = avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
-. elif ${CPUTYPE} == "slm" || ${CPUTYPE} == "corei7"
+. elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem" || \
+ ${CPUTYPE} == "silvermont"
MACHINE_CPU = sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586
. elif ${CPUTYPE} == "penryn"
MACHINE_CPU = sse41 ssse3 sse3 sse2 sse i686 mmx i586
-. elif ${CPUTYPE} == "atom" || ${CPUTYPE} == "core2"
+. elif ${CPUTYPE} == "core2" || ${CPUTYPE} == "bonnell"
MACHINE_CPU = ssse3 sse3 sse2 sse i686 mmx i586
. elif ${CPUTYPE} == "yonah" || ${CPUTYPE} == "prescott"
MACHINE_CPU = sse3 sse2 sse i686 mmx i586
@@ -203,7 +217,9 @@ MACHINE_CPU = mmx
. endif
MACHINE_CPU += i486
. elif ${MACHINE_CPUARCH} == "amd64"
-. if ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
+. if ${CPUTYPE} == "bdver4"
+MACHINE_CPU = xop avx2 avx sse42 sse41 ssse3 sse4a sse3
+. elif ${CPUTYPE} == "bdver3" || ${CPUTYPE} == "bdver2" || \
${CPUTYPE} == "bdver1"
MACHINE_CPU = xop avx sse42 sse41 ssse3 sse4a sse3
. elif ${CPUTYPE} == "btver2"
@@ -218,15 +234,18 @@ MACHINE_CPU = k8 3dnow sse3
. elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \
${CPUTYPE} == "athlon-fx" || ${CPUTYPE} == "k8"
MACHINE_CPU = k8 3dnow
-. elif ${CPUTYPE} == "core-avx2"
+. elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "knl"
+MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3
+. elif ${CPUTYPE} == "broadwell" || ${CPUTYPE} == "haswell"
MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3
-. elif ${CPUTYPE} == "core-avx-i" || ${CPUTYPE} == "corei7-avx"
+. elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge"
MACHINE_CPU = avx sse42 sse41 ssse3 sse3
-. elif ${CPUTYPE} == "slm" || ${CPUTYPE} == "corei7"
+. elif ${CPUTYPE} == "westmere" || ${CPUTYPE} == "nehalem" || \
+ ${CPUTYPE} == "silvermont"
MACHINE_CPU = sse42 sse41 ssse3 sse3
. elif ${CPUTYPE} == "penryn"
MACHINE_CPU = sse41 ssse3 sse3
-. elif ${CPUTYPE} == "atom" || ${CPUTYPE} == "core2"
+. elif ${CPUTYPE} == "core2" || ${CPUTYPE} == "bonnell"
MACHINE_CPU = ssse3 sse3
. elif ${CPUTYPE} == "nocona"
MACHINE_CPU = sse3
@@ -251,6 +270,10 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3
CFLAGS += -G0
.endif
+.if ${MACHINE_ARCH} == "armv6"
+_CPUCFLAGS += -mfloat-abi=softfp
+.endif
+
# NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk
.if !defined(NO_CPU_CFLAGS)
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk
index 759c768e3977..eb75ff32158b 100644
--- a/share/mk/bsd.dep.mk
+++ b/share/mk/bsd.dep.mk
@@ -121,28 +121,25 @@ ${_YC:R}.o: ${_YC}
.endfor
# DTrace probe definitions
-# libelf is currently needed for drti.o
.if ${SRCS:M*.d}
-LDADD+= -lelf
-DPADD+= ${LIBELF}
CFLAGS+= -I${.OBJDIR}
.endif
.for _DSRC in ${SRCS:M*.d:N*/*}
.for _D in ${_DSRC:R}
DHDRS+= ${_D}.h
${_D}.h: ${_DSRC}
- ${DTRACE} -xnolibs -h -s ${.ALLSRC}
+ ${DTRACE} ${DTRACEFLAGS} -h -s ${.ALLSRC}
SRCS:= ${SRCS:S/^${_DSRC}$//}
OBJS+= ${_D}.o
CLEANFILES+= ${_D}.h ${_D}.o
${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//}
- ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC}
+ ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
.if defined(LIB)
CLEANFILES+= ${_D}.So ${_D}.po
${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//}
- ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC}
+ ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//}
- ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC}
+ ${DTRACE} ${DTRACEFLAGS} -G -o ${.TARGET} -s ${.ALLSRC}
.endif
.endfor
.endfor
diff --git a/share/mk/bsd.dtb.mk b/share/mk/bsd.dtb.mk
new file mode 100644
index 000000000000..24e6930f8fe9
--- /dev/null
+++ b/share/mk/bsd.dtb.mk
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+# Search for kernel source tree in standard places.
+.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \
+ ${.CURDIR}/../../../../.. /sys /usr/src/sys
+.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk)
+SYSDIR= ${_dir}
+.endif
+.endfor
+.if !defined(SYSDIR) || !exists(${SYSDIR}/kern/) || \
+ !exists(${SYSDIR}/conf/kmod.mk)
+.error Unable to locate the kernel source tree. Set SYSDIR to override.
+.endif
+
+.include "${SYSDIR}/conf/dtb.mk"
+
+.include <bsd.sys.mk>
diff --git a/share/mk/bsd.endian.mk b/share/mk/bsd.endian.mk
index c82c37f6945a..2d1a53ed3685 100644
--- a/share/mk/bsd.endian.mk
+++ b/share/mk/bsd.endian.mk
@@ -1,6 +1,7 @@
# $FreeBSD$
-.if ${MACHINE_ARCH} == "amd64" || \
+.if ${MACHINE_ARCH} == "aarch64" || \
+ ${MACHINE_ARCH} == "amd64" || \
${MACHINE_ARCH} == "i386" || \
(${MACHINE} == "arm" && ${MACHINE_ARCH:Marm*eb*} == "") || \
${MACHINE_ARCH:Mmips*el} != ""
diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk
index 4c63f714dd1c..76372567ba7a 100644
--- a/share/mk/bsd.incs.mk
+++ b/share/mk/bsd.incs.mk
@@ -23,7 +23,7 @@ all: buildincludes
${group}OWN?= ${BINOWN}
${group}GRP?= ${BINGRP}
${group}MODE?= ${NOBINMODE}
-${group}DIR?= ${INCLUDEDIR}
+${group}DIR?= ${INCLUDEDIR}${PRIVATELIB:D/private/${LIB}}
STAGE_SETS+= ${group}
STAGE_DIR.${group}= ${STAGE_OBJTOP}${${group}DIR}
STAGE_SYMLINKS_DIR.${group}= ${STAGE_OBJTOP}
diff --git a/share/mk/bsd.info.mk b/share/mk/bsd.info.mk
index c54b43546ca3..8f9131585419 100644
--- a/share/mk/bsd.info.mk
+++ b/share/mk/bsd.info.mk
@@ -121,7 +121,6 @@ DVIPS2ASCII?= dvips2ascii
IFILENS+= ${INFO:S/$/.${_f}/}
.endfor
-.if ${MK_INFO} != "no"
CLEANFILES+= ${IFILENS}
.if !defined(NO_INFOCOMPRESS)
CLEANFILES+= ${IFILENS:S/$/${ICOMPRESS_EXT}/}
@@ -131,9 +130,6 @@ all: ${IFILES}
IFILES= ${IFILENS}
all: ${IFILES}
.endif
-.else
-all:
-.endif
.for x in ${IFILENS}
${x:S/$/${ICOMPRESS_EXT}/}: ${x}
@@ -177,7 +173,7 @@ CLEANFILES+= ${INFO:S/$/-la.texi/}
CLEANFILES+= ${INFO:S/$/.info.*.html/} ${INFO:S/$/.info/}
.endif
-.if ${MK_INFO} != "no" && defined(INFO)
+.if defined(INFO)
install: ${INSTALLINFODIRS}
.if !empty(IFILES:N*.html)
${INSTALL} -o ${INFOOWN} -g ${INFOGRP} -m ${INFOMODE} \
diff --git a/share/mk/bsd.kmod.mk b/share/mk/bsd.kmod.mk
index fd4f993de7cb..09ac8e3de342 100644
--- a/share/mk/bsd.kmod.mk
+++ b/share/mk/bsd.kmod.mk
@@ -13,5 +13,3 @@ SYSDIR= ${_dir}
.endif
.include "${SYSDIR}/conf/kmod.mk"
-
-.include <bsd.sys.mk>
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 717f30b072a4..38fc3c26ca72 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -4,6 +4,14 @@
.include <bsd.init.mk>
+.if defined(LIB_CXX)
+LIB= ${LIB_CXX}
+_LD= ${CXX}
+.else
+_LD= ${CC}
+.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.
@@ -16,7 +24,7 @@
SHLIB= ${LIB}
.endif
.if !defined(SHLIB_NAME) && defined(SHLIB) && defined(SHLIB_MAJOR)
-SHLIB_NAME= lib${SHLIB}.so.${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}
@@ -123,13 +131,8 @@ all: beforebuild .WAIT
beforebuild: objwarn
.endif
-.if defined(PRIVATELIB)
-_LIBDIR:=${LIBPRIVATEDIR}
-_SHLIBDIR:=${LIBPRIVATEDIR}
-.else
_LIBDIR:=${LIBDIR}
_SHLIBDIR:=${SHLIBDIR}
-.endif
.if defined(SHLIB_NAME)
.if ${MK_DEBUG_FILES} != "no"
@@ -157,44 +160,32 @@ ${SHLIB_NAME_FULL}: ${VERSION_MAP}
LDFLAGS+= -Wl,--version-script=${VERSION_MAP}
.endif
-.if defined(USEPRIVATELIB)
-LDFLAGS+= -rpath ${LIBPRIVATEDIR}
-.endif
-
.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
OBJS+= ${SRCS:N*.h:R:S/$/.o/}
NOPATH_FILES+= ${OBJS}
.endif
.if defined(LIB) && !empty(LIB)
-_LIBS= lib${LIB}.a
+_LIBS= lib${LIB_PRIVATE}${LIB}.a
-lib${LIB}.a: ${OBJS} ${STATICOBJS}
+lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS}
@${ECHO} building static ${LIB} library
@rm -f ${.TARGET}
-.if !defined(NM)
- @${AR} ${ARFLAGS} ${.TARGET} `lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
-.else
@${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD}
-.endif
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
.endif
.if !defined(INTERNALLIB)
.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
-_LIBS+= lib${LIB}_p.a
+_LIBS+= lib${LIB_PRIVATE}${LIB}_p.a
POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
NOPATH_FILES+= ${POBJS}
-lib${LIB}_p.a: ${POBJS}
+lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS}
@${ECHO} building profiled ${LIB} library
@rm -f ${.TARGET}
-.if !defined(NM)
- @${AR} ${ARFLAGS} ${.TARGET} `lorder ${POBJS} | tsort -q` ${ARADD}
-.else
@${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' lorder ${POBJS} | tsort -q` ${ARADD}
-.endif
${RANLIB} ${RANLIBFLAGS} ${.TARGET}
.endif
@@ -209,7 +200,12 @@ _LIBS+= ${SHLIB_NAME}
SOLINKOPTS= -shared -Wl,-x
.if !defined(ALLOW_SHARED_TEXTREL)
-SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel
+.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
.endif
.if target(beforelinking)
@@ -252,15 +248,9 @@ ${SHLIB_NAME_FULL}: ${SOBJS}
.if defined(SHLIB_LINK) && !commands(${SHLIB_LINK:R}.ld)
@${INSTALL_SYMLINK} ${SHLIB_NAME} ${SHLIB_LINK}
.endif
-.if !defined(NM)
- @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
- -o ${.TARGET} -Wl,-soname,${SONAME} \
- `lorder ${SOBJS} | tsort -q` ${LDADD}
-.else
- @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
+ ${_LD} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \
-o ${.TARGET} -Wl,-soname,${SONAME} \
`NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD}
-.endif
.if ${MK_CTF} != "no"
${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS}
.endif
@@ -277,9 +267,9 @@ ${SHLIB_NAME}.debug: ${SHLIB_NAME_FULL}
.endif #defined(SHLIB_NAME)
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
-_LIBS+= lib${LIB}_pic.a
+_LIBS+= lib${LIB_PRIVATE}${LIB}_pic.a
-lib${LIB}_pic.a: ${SOBJS}
+lib${LIB_PRIVATE}${LIB}_pic.a: ${SOBJS}
@${ECHO} building special pic ${LIB} library
@rm -f ${.TARGET}
@${AR} ${ARFLAGS} ${.TARGET} ${SOBJS} ${ARADD}
@@ -317,7 +307,7 @@ _EXTRADEPEND:
mv $$TMP ${DEPENDFILE}
.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME)
.if defined(DPADD) && !empty(DPADD)
- echo ${SHLIB_NAME}: ${DPADD} >> ${DEPENDFILE}
+ echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE}
.endif
.endif
@@ -343,13 +333,13 @@ _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}}
realinstall: _libinstall
.ORDER: beforeinstall _libinstall
_libinstall:
-.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" && !defined(PRIVATELIB)
+.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- ${_INSTALLFLAGS} lib${LIB}.a ${DESTDIR}${_LIBDIR}
+ ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}.a ${DESTDIR}${_LIBDIR}
.endif
-.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) && !defined(PRIVATELIB)
+.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- ${_INSTALLFLAGS} lib${LIB}_p.a ${DESTDIR}${_LIBDIR}
+ ${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}
.endif
.if defined(SHLIB_NAME)
${INSTALL} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
@@ -363,7 +353,7 @@ _libinstall:
${_INSTALLFLAGS} \
${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}
.endif
-.if defined(SHLIB_LINK) && !defined(PRIVATELIB)
+.if defined(SHLIB_LINK)
.if commands(${SHLIB_LINK:R}.ld)
${INSTALL} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
@@ -382,7 +372,7 @@ _libinstall:
.endif # SHLIB_LDSCRIPT
.endif # SHLIB_LINK
.endif # SHIB_NAME
-.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" && !defined(PRIVATELIB)
+.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}
.endif
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
index b3d160d7fcf5..6d3bbe7b8510 100644
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -39,6 +39,7 @@ LIBCRYPT?= ${DESTDIR}${LIBDIR}/libcrypt.a
LIBCRYPTO?= ${DESTDIR}${LIBDIR}/libcrypto.a
LIBCTF?= ${DESTDIR}${LIBDIR}/libctf.a
LIBCURSES?= ${DESTDIR}${LIBDIR}/libcurses.a
+LIBDEVCTL?= ${DESTDIR}${LIBDIR}/libdevctl.a
LIBDEVINFO?= ${DESTDIR}${LIBDIR}/libdevinfo.a
LIBDEVSTAT?= ${DESTDIR}${LIBDIR}/libdevstat.a
LIBDIALOG?= ${DESTDIR}${LIBDIR}/libdialog.a
@@ -54,6 +55,7 @@ LIBFIGPAR?= ${DESTDIR}${LIBDIR}/libfigpar.a
LIBFL?= "don't use LIBFL, use LIBL"
LIBFORM?= ${DESTDIR}${LIBDIR}/libform.a
LIBG2C?= ${DESTDIR}${LIBDIR}/libg2c.a
+LIBGPIO?= ${DESTDIR}${LIBDIR}/libgpio.a
LIBGEOM?= ${DESTDIR}${LIBDIR}/libgeom.a
LIBGNUREGEX?= ${DESTDIR}${LIBDIR}/libgnuregex.a
LIBGSSAPI?= ${DESTDIR}${LIBDIR}/libgssapi.a
@@ -83,6 +85,7 @@ LIBMEMSTAT?= ${DESTDIR}${LIBDIR}/libmemstat.a
LIBMENU?= ${DESTDIR}${LIBDIR}/libmenu.a
LIBMILTER?= ${DESTDIR}${LIBDIR}/libmilter.a
LIBMP?= ${DESTDIR}${LIBDIR}/libmp.a
+LIBMT?= ${DESTDIR}${LIBDIR}/libmt.a
LIBNCURSES?= ${DESTDIR}${LIBDIR}/libncurses.a
LIBNCURSESW?= ${DESTDIR}${LIBDIR}/libncursesw.a
LIBNETGRAPH?= ${DESTDIR}${LIBDIR}/libnetgraph.a
@@ -90,33 +93,7 @@ LIBNGATM?= ${DESTDIR}${LIBDIR}/libngatm.a
LIBNV?= ${DESTDIR}${LIBDIR}/libnv.a
LIBNVPAIR?= ${DESTDIR}${LIBDIR}/libnvpair.a
LIBOPIE?= ${DESTDIR}${LIBDIR}/libopie.a
-
-# The static PAM library doesn't know its secondary dependencies,
-# so we have to specify them explicitly. Ths is an unfortunate,
-# but necessary departure from testing MK_ flags to define
-# values here.
LIBPAM?= ${DESTDIR}${LIBDIR}/libpam.a
-MINUSLPAM= -lpam
-.if defined(LDFLAGS) && !empty(LDFLAGS:M-static)
-.if ${MK_KERBEROS} != "no"
-LIBPAM+= ${LIBKRB5} ${LIBHX509} ${LIBASN1} ${LIBCRYPTO} ${LIBCRYPT} \
- ${LIBROKEN} ${LIBCOM_ERR}
-MINUSLPAM+= -lkrb5 -lhx509 -lasn1 -lcrypto -lcrypt -lroken -lcom_err
-.endif
-LIBPAM+= ${LIBRADIUS} ${LIBTACPLUS} ${LIBCRYPT} \
- ${LIBUTIL} ${LIBOPIE} ${LIBMD}
-MINUSLPAM+= -lradius -ltacplus -lcrypt \
- -lutil -lopie -lmd
-.if ${MK_OPENSSH} != "no"
-LIBPAM+= ${LIBSSH} ${LIBCRYPTO} ${LIBCRYPT}
-MINUSLPAM+= -lssh -lcrypto -lcrypt
-.endif
-.if ${MK_NIS} != "no"
-LIBPAM+= ${LIBYPCLNT}
-MINUSLPAM+= -lypclnt
-.endif
-.endif
-
LIBPANEL?= ${DESTDIR}${LIBDIR}/libpanel.a
LIBPCAP?= ${DESTDIR}${LIBDIR}/libpcap.a
LIBPJDLOG?= ${DESTDIR}${LIBDIR}/libpjdlog.a
@@ -155,9 +132,20 @@ LIBVMMAPI?= ${DESTDIR}${LIBDIR}/libvmmapi.a
LIBWIND?= ${DESTDIR}${LIBDIR}/libwind.a
LIBWRAP?= ${DESTDIR}${LIBDIR}/libwrap.a
LIBXPG4?= ${DESTDIR}${LIBDIR}/libxpg4.a
+LIBXO?= ${DESTDIR}${LIBDIR}/libxo.a
LIBY?= ${DESTDIR}${LIBDIR}/liby.a
LIBYPCLNT?= ${DESTDIR}${LIBDIR}/libypclnt.a
LIBZ?= ${DESTDIR}${LIBDIR}/libz.a
LIBZFS?= ${DESTDIR}${LIBDIR}/libzfs.a
LIBZFS_CORE?= ${DESTDIR}${LIBDIR}/libzfs_core.a
LIBZPOOL?= ${DESTDIR}${LIBDIR}/libzpool.a
+
+# enforce the 2 -lpthread and -lc to always be the last in that exact order
+.if defined(LDADD)
+.if ${LDADD:M-lpthread}
+LDADD:= ${LDADD:N-lpthread} -lpthread
+.endif
+.if ${LDADD:M-lc}
+LDADD:= ${LDADD:N-lc} -lc
+.endif
+.endif
diff --git a/share/mk/bsd.links.mk b/share/mk/bsd.links.mk
index 1e4d57e37d3c..4f8565c255f9 100644
--- a/share/mk/bsd.links.mk
+++ b/share/mk/bsd.links.mk
@@ -7,25 +7,11 @@
afterinstall: _installlinks
.ORDER: realinstall _installlinks
_installlinks:
-.if defined(LINKS) && !empty(LINKS)
- @set ${LINKS}; \
- while test $$# -ge 2; do \
- l=${DESTDIR}$$1; \
- shift; \
- t=${DESTDIR}$$1; \
- shift; \
- ${ECHO} $$t -\> $$l; \
- ${INSTALL_LINK} $$l $$t; \
- done; true
-.endif
-.if defined(SYMLINKS) && !empty(SYMLINKS)
- @set ${SYMLINKS}; \
- while test $$# -ge 2; do \
- l=$$1; \
- shift; \
- t=${DESTDIR}$$1; \
- shift; \
- ${ECHO} $$t -\> $$l; \
- ${INSTALL_SYMLINK} $$l $$t; \
- done; true
-.endif
+.for s t in ${LINKS}
+ @${ECHO} "$t -> $s" ;\
+ ${INSTALL_LINK} ${DESTDIR}$s ${DESTDIR}$t
+.endfor
+.for s t in ${SYMLINKS}
+ @${ECHO} "$t -> $s" ;\
+ ${INSTALL_SYMLINK} $s ${DESTDIR}/$t
+.endfor
diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
index 46c0989788e1..416993ee3fa4 100644
--- a/share/mk/bsd.man.mk
+++ b/share/mk/bsd.man.mk
@@ -38,7 +38,7 @@
# MANBUILDCAT create preformatted manual pages in addition to normal
# pages. [not set]
#
-# MROFF_CMD command and flags to create preformatted pages
+# MANDOC_CMD command and flags to create preformatted pages
#
# +++ targets +++
#
@@ -54,7 +54,7 @@ MINSTALL?= ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
CATDIR= ${MANDIR:H:S/$/\/cat/}
CATEXT= .cat
-MROFF_CMD?= groff -Tascii -mtty-char -man -t
+MANDOC_CMD?= mandoc -Tascii
MCOMPRESS_CMD?= ${COMPRESS_CMD}
MCOMPRESS_EXT?= ${COMPRESS_EXT}
@@ -100,7 +100,7 @@ ${__target}: ${__page}
.for __target in ${__page:T:S/$/${CATEXT}${FILTEXTENSION}/g}
_manpages: ${__target}
${__target}: ${__page}
- ${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} > ${.TARGET}
+ ${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} > ${.TARGET}
.endfor
.endif
.endfor
@@ -113,7 +113,7 @@ CLEANFILES+= ${MAN:T:S/$/${CATEXT}/g}
.for __target in ${__page:T:S/$/${CATEXT}/g}
_manpages: ${__target}
${__target}: ${__page}
- ${MROFF_CMD} ${.ALLSRC} > ${.TARGET}
+ ${MANDOC_CMD} ${.ALLSRC} > ${.TARGET}
.endfor
.endfor
.else
@@ -144,9 +144,9 @@ ${__target}: ${__page}
_manpages: ${__target}
${__target}: ${__page}
.if defined(MANFILTER)
- ${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} | ${MCOMPRESS_CMD} > ${.TARGET}
+ ${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} | ${MCOMPRESS_CMD} > ${.TARGET}
.else
- ${MROFF_CMD} ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET}
+ ${MANDOC_CMD} ${.ALLSRC} | ${MCOMPRESS_CMD} > ${.TARGET}
.endif
.endfor
.endif
@@ -239,9 +239,9 @@ manlint:
manlint: ${__page}lint
${__page}lint: ${__page}
.if defined(MANFILTER)
- ${MANFILTER} < ${.ALLSRC} | ${MROFF_CMD} -ww -z
+ ${MANFILTER} < ${.ALLSRC} | ${MANDOC_CMD} -Tlint
.else
- ${MROFF_CMD} -ww -z ${.ALLSRC}
+ ${MANDOC_CMD} -Tlint ${.ALLSRC}
.endif
.endfor
.endif
diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk
index f2d4a5c86016..b87b4243314f 100644
--- a/share/mk/bsd.obj.mk
+++ b/share/mk/bsd.obj.mk
@@ -98,6 +98,16 @@ obj: .PHONY
fi; \
${ECHO} "${CANONICALOBJDIR} created for ${.CURDIR}"; \
fi
+.for dir in ${SRCS: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)
diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk
index 44d274a69818..aa5c664fc16d 100644
--- a/share/mk/bsd.opts.mk
+++ b/share/mk/bsd.opts.mk
@@ -11,7 +11,7 @@
# are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
# to omit from that make.
#
-# Makefiles must include bsd.srcpot.mk before they test the value of any MK_FOO
+# 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
@@ -68,16 +68,11 @@ __DEFAULT_YES_OPTIONS = \
__DEFAULT_NO_OPTIONS = \
CTF \
DEBUG_FILES \
- INSTALL_AS_USER \
- INFO
-
+ INSTALL_AS_USER
# meta mode related
-__DEFAULT_NO_OPTIONS += \
- AUTO_OBJ \
- META_MODE \
- STAGING \
- STAGING_PROG
+__DEFAULT_DEPENDENT_OPTIONS = \
+ STAGING_PROG/STAGING
.include <bsd.mkopt.mk>
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 0e53e6881d29..b41583b34250 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -142,7 +142,7 @@ USER!= id -un
.endif
_gid!= id -g
_gn!= id -gn
-.for x in BIN CONF DOC INFO KMOD LIB MAN NLS SHARE
+.for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE
$xOWN= ${USER}
$xGRP= ${_gn}
.endfor
@@ -165,6 +165,10 @@ KMODDIR?= /boot/kernel
KMODOWN?= ${BINOWN}
KMODGRP?= ${BINGRP}
KMODMODE?= ${BINMODE}
+DTBDIR?= /boot/dtb
+DTBOWN?= root
+DTBGRP?= wheel
+DTBMODE?= 444
LIBDIR?= /usr/lib
LIBCOMPATDIR?= /usr/lib/compat
@@ -231,6 +235,15 @@ STRIP?= -s
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
+
# Pointer to the top directory into which tests are installed. Should not be
# overriden by Makefiles, but the user may choose to set this in src.conf(5).
TESTSBASE?= /usr/tests
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index b5ec0687e484..f8f2265f12d4 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -51,10 +51,6 @@ STRIP?= -s
LDFLAGS+= -static
.endif
-.if defined(USEPRIVATELIB)
-LDFLAGS+= -L${_SHLIBDIRPREFIX}${LIBPRIVATEDIR} -rpath ${LIBPRIVATEDIR}
-.endif
-
.if ${MK_DEBUG_FILES} != "no"
PROG_FULL=${PROG}.full
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
@@ -62,7 +58,7 @@ PROG_FULL=${PROG}.full
${BINDIR} == "/bin" ||\
${BINDIR} == "/libexec" ||\
${BINDIR} == "/sbin" ||\
- ${BINDIR:C%/usr/(bin|bsdinstall|games|libexec|lpr|sendmail|sm.bin|sbin)(/.*)?%/usr/bin%} == "/usr/bin"\
+ ${BINDIR:C%/usr/(bin|bsdinstall|libexec|lpr|sendmail|sm.bin|sbin)(/.*)?%/usr/bin%} == "/usr/bin"\
)
DEBUGFILEDIR= ${DEBUGDIR}${BINDIR}
.else
@@ -172,15 +168,15 @@ CLEANFILES+= ${OBJS}
_EXTRADEPEND:
.if defined(LDFLAGS) && !empty(LDFLAGS:M-nostdlib)
.if defined(DPADD) && !empty(DPADD)
- echo ${PROG}: ${DPADD} >> ${DEPENDFILE}
+ echo ${PROG_FULL}: ${DPADD} >> ${DEPENDFILE}
.endif
.else
- echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
+ echo ${PROG_FULL}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
.if defined(PROG_CXX)
.if ${COMPILER_TYPE} == "clang" && empty(CXXFLAGS:M-stdlib=libstdc++)
- echo ${PROG}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
+ echo ${PROG_FULL}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
.else
- echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
+ echo ${PROG_FULL}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
.endif
.endif
.endif
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
index 2af32b691cee..46abbb3fc165 100644
--- a/share/mk/bsd.progs.mk
+++ b/share/mk/bsd.progs.mk
@@ -43,7 +43,7 @@ PROG ?= $t
.if defined(PROG)
# just one of many
PROG_OVERRIDE_VARS += BINDIR DPSRCS MAN SRCS
-PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LDFLAGS ${PROG_OVERRIDE_VARS}
+PROG_VARS += CFLAGS CPPFLAGS CXXFLAGS DPADD DPLIBS LDADD LIBADD LDFLAGS ${PROG_OVERRIDE_VARS}
.for v in ${PROG_VARS:O:u}
.if empty(${PROG_OVERRIDE_VARS:M$v})
.if defined(${v}.${PROG})
diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk
index 9312e7f842de..c57f83c90f63 100644
--- a/share/mk/bsd.subdir.mk
+++ b/share/mk/bsd.subdir.mk
@@ -35,7 +35,7 @@ __<bsd.subdir.mk>__:
.include <bsd.init.mk>
.if defined(.PARSEDIR) && !defined(NEED_SUBDIR)
-.if ${.MAKE.LEVEL} == 0 && ${.MAKE.MODE:Mmeta*} != "" && !empty(SUBDIR) && !(make(clean*) || make(destroy*))
+.if ${.MAKE.LEVEL} == 0 && ${MK_META_MODE} == "yes" && !empty(SUBDIR) && !(make(clean*) || make(destroy*))
.include <meta.subdir.mk>
# ignore this
_SUBDIR:
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index bd1d0872f88e..71c7af5f18d6 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -68,13 +68,16 @@ CWARNFLAGS+= -Wno-pointer-sign
# is set to low values, these have to be disabled explicitly.
.if ${WARNS} <= 6
CWARNFLAGS.clang+= -Wno-empty-body -Wno-string-plus-int
-.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} > 30300
+.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30400
CWARNFLAGS.clang+= -Wno-unused-const-variable
.endif
.endif # WARNS <= 6
.if ${WARNS} <= 3
CWARNFLAGS.clang+= -Wno-tautological-compare -Wno-unused-value\
-Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion
+.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
+CWARNFLAGS.clang+= -Wno-unused-local-typedef
+.endif
.endif # WARNS <= 3
.if ${WARNS} <= 2
CWARNFLAGS.clang+= -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter
@@ -106,17 +109,31 @@ CWARNFLAGS+= -Werror
CWARNFLAGS+= -Wno-format
.endif # NO_WFORMAT || NO_WFORMAT.${COMPILER_TYPE}
+# How to handle FreeBSD custom printf format specifiers.
+.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
+FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
+.else
+FORMAT_EXTENSIONS= -fformat-extensions
+.endif
+
.if defined(IGNORE_PRAGMA)
CWARNFLAGS+= -Wno-unknown-pragmas
.endif # IGNORE_PRAGMA
+# We need this conditional because many places that use it
+# only enable it for some files with CLFAGS.$FILE+=${CLANG_NO_IAS}.
+# unconditionally, and can't easily use the CFLAGS.clang=
+# mechanism.
.if ${COMPILER_TYPE} == "clang"
-# Would love to do this unconditionally, but can't due to its use in
-# kernel build coupled with CFLAGS.${TARGET} feature
CLANG_NO_IAS= -no-integrated-as
.endif
CLANG_OPT_SMALL= -mstack-alignment=8 -mllvm -inline-threshold=3\
- -mllvm -enable-load-pre=false -mllvm -simplifycfg-dup-ret
+ -mllvm -simplifycfg-dup-ret
+.if ${COMPILER_VERSION} >= 30500
+CLANG_OPT_SMALL+= -mllvm -enable-gvn=false
+.else
+CLANG_OPT_SMALL+= -mllvm -enable-load-pre=false
+.endif
CFLAGS.clang+= -Qunused-arguments
.if ${MACHINE_CPUARCH} == "sparc64"
# Don't emit .cfi directives, since we must use GNU as on sparc64, for now.