summaryrefslogtreecommitdiffstats
path: root/share/mk
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-04-16 02:32:12 +0000
committergjb <gjb@FreeBSD.org>2016-04-16 02:32:12 +0000
commit6549ef7d128d37c0dfff87f6c1c189b42ed3e1ef (patch)
treea8871301d693c6d33d43cd3171b1ee4783fec0e4 /share/mk
parentae096a53a90aee9859587d48d5a0279567abb413 (diff)
parent35691f7a6f04cec368d8636543bca596e870faf3 (diff)
downloadFreeBSD-src-6549ef7d128d37c0dfff87f6c1c189b42ed3e1ef.zip
FreeBSD-src-6549ef7d128d37c0dfff87f6c1c189b42ed3e1ef.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'share/mk')
-rw-r--r--share/mk/bsd.README36
-rw-r--r--share/mk/bsd.dep.mk2
-rw-r--r--share/mk/bsd.lib.mk9
-rw-r--r--share/mk/bsd.progs.mk4
-rw-r--r--share/mk/bsd.sys.mk7
-rw-r--r--share/mk/local.sys.mk11
6 files changed, 57 insertions, 12 deletions
diff --git a/share/mk/bsd.README b/share/mk/bsd.README
index bda9a8c..e386955 100644
--- a/share/mk/bsd.README
+++ b/share/mk/bsd.README
@@ -314,9 +314,27 @@ PROGS_CXX PROG and PROGS_CXX in one Makefile. To define
LDADD.foo= -lutil
SRCS.bar= bar_src.c
- The supported variables are BINDIR BINGRP BINMODE BINOWN
- CFLAGS CXXFLAGS DPADD DPSRCS LDADD
- LDFLAGS LIBADD MAN MLINKS PROGNAME SRCS.
+ The supported variables are:
+ - BINDIR
+ - BINGRP
+ - BINMODE
+ - BINOWN
+ - CFLAGS
+ - CXXFLAGS
+ - DEBUG_FLAGS
+ - DPADD
+ - DPSRCS
+ - LDADD
+ - LDFLAGS
+ - LIBADD
+ - LINKS
+ - MAN
+ - MLINKS
+ - NO_WERROR
+ - PROGNAME
+ - SRCS
+ - STRIP
+ - WARNS
PROGNAME The name that the above program will be installed as, if
different from ${PROG}.
@@ -401,12 +419,16 @@ with the current needs of the BSD tree.
It sets/uses the following variables:
-LIB The name of the library to build.
+LIB The name of the library to build. Both a shared and static
+ library will be built. NO_PIC can be set to only build a
+ static library.
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.
+ of LIB if LIB is also set. Both a shared and static library
+ will be built. NO_PIC can be set to only build a static
+ library.
LIBDIR Target directory for libraries.
@@ -431,6 +453,10 @@ SRCS List of source files to build the library. Suffix types
to .c files of the same name. (This is not the default for
versions of make.)
+SHLIB Like LIB but only builds a shared library.
+
+SHLIB_CXX Like LIB_CXX but only builds a shared library.
+
SHLIB_LDSCRIPT Template file to generate shared library linker script.
Unless used, a simple symlink is created to the real
shared object.
diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk
index 50ed33c..d80cb9d 100644
--- a/share/mk/bsd.dep.mk
+++ b/share/mk/bsd.dep.mk
@@ -174,7 +174,7 @@ DEPEND_CFLAGS+= -MT${.TARGET}
.if defined(.PARSEDIR)
# Only add in DEPEND_CFLAGS for CFLAGS on files we expect from DEPENDOBJS
# as those are the only ones we will include.
-DEPEND_CFLAGS_CONDITION= !empty(DEPENDOBJS:M${.TARGET:${DEPEND_FILTER}})
+DEPEND_CFLAGS_CONDITION= "${DEPENDOBJS:M${.TARGET:${DEPEND_FILTER}}}" != ""
CFLAGS+= ${${DEPEND_CFLAGS_CONDITION}:?${DEPEND_CFLAGS}:}
.else
CFLAGS+= ${DEPEND_CFLAGS}
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 2169925..caf8942 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -4,12 +4,17 @@
.include <bsd.init.mk>
-.if defined(LIB_CXX)
-LIB= ${LIB_CXX}
+.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,
diff --git a/share/mk/bsd.progs.mk b/share/mk/bsd.progs.mk
index 00dd566..d26ba76 100644
--- a/share/mk/bsd.progs.mk
+++ b/share/mk/bsd.progs.mk
@@ -23,8 +23,8 @@ PROGS += ${PROGS_CXX}
.if defined(PROG)
# just one of many
PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN NO_WERROR \
- PROGNAME SRCS WARNS
-PROG_VARS += CFLAGS CXXFLAGS DPADD LDADD LIBADD LINKS \
+ PROGNAME SRCS STRIP WARNS
+PROG_VARS += CFLAGS CXXFLAGS DEBUG_FLAGS DPADD LDADD LIBADD LINKS \
LDFLAGS MLINKS ${PROG_OVERRIDE_VARS}
.for v in ${PROG_VARS:O:u}
.if empty(${PROG_OVERRIDE_VARS:M$v})
diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk
index 8471699..5660bd4 100644
--- a/share/mk/bsd.sys.mk
+++ b/share/mk/bsd.sys.mk
@@ -297,3 +297,10 @@ STAGE_SYMLINKS.links= ${SYMLINKS}
.endif
.endif
+.if defined(META_TARGETS)
+.for _tgt in ${META_TARGETS}
+.if target(${_tgt})
+${_tgt}: ${META_DEPS}
+.endif
+.endfor
+.endif
diff --git a/share/mk/local.sys.mk b/share/mk/local.sys.mk
index f6a9824..e3d212c 100644
--- a/share/mk/local.sys.mk
+++ b/share/mk/local.sys.mk
@@ -32,9 +32,16 @@ OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP}
.if ${.MAKE.MODE:Mmeta*} != ""
# we can afford to use cookies to prevent some targets
# re-running needlessly but only when using filemon.
+# Targets that should support the meta mode cookie handling should just be
+# added to META_TARGETS. If bsd.sys.mk cannot be included then ${META_DEPS}
+# should be added as a target dependency as well. Otherwise the target
+# is added to in bsd.sys.mk since it comes last.
.if ${.MAKE.MODE:Mnofilemon} == ""
-META_COOKIE_COND= empty(.TARGET:M${.OBJDIR})
-META_COOKIE= ${COOKIE.${.TARGET}:U${${META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}}}
+# Prepend .OBJDIR if not already there.
+_META_COOKIE_COND= "${.TARGET:M${.OBJDIR}/*}" == ""
+_META_COOKIE_DEFAULT= ${${_META_COOKIE_COND}:?${.OBJDIR}/${.TARGET}:${.TARGET}}
+# Use the default if COOKIE.${.TARGET} is not defined.
+META_COOKIE= ${COOKIE.${.TARGET}:U${_META_COOKIE_DEFAULT}}
META_COOKIE_RM= @rm -f ${META_COOKIE}
META_COOKIE_TOUCH= @touch ${META_COOKIE}
CLEANFILES+= ${META_TARGETS}
OpenPOWER on IntegriCloud