summaryrefslogtreecommitdiffstats
path: root/share/mk/bsd.lib.mk
diff options
context:
space:
mode:
authormarkj <markj@FreeBSD.org>2012-12-31 21:54:43 +0000
committermarkj <markj@FreeBSD.org>2012-12-31 21:54:43 +0000
commit2286811d7ef3b92efb186c8a307ed19c1f0c518c (patch)
treefccbaa2d95bdd3759e5d8fd560466eaec35b8033 /share/mk/bsd.lib.mk
parenta381b052326c27add4032cb56b17b3749fb885c2 (diff)
downloadFreeBSD-src-2286811d7ef3b92efb186c8a307ed19c1f0c518c.zip
FreeBSD-src-2286811d7ef3b92efb186c8a307ed19c1f0c518c.tar.gz
Explicitly specify that the beforelinking target depends on the
generated object files, ensuring that the beforelinking recipe won't be executed until compilation has finished. Also define SHLIB_NAME_FULL to denote ${SHLIB_NAME}.debug if DEBUG_FILES is set and ${SHLIB_NAME} otherwise, which helps avoid obfuscating the compilation and linking rules. Reviewed by: emaste Approved by: emaste (co-mentor)
Diffstat (limited to 'share/mk/bsd.lib.mk')
-rw-r--r--share/mk/bsd.lib.mk23
1 files changed, 13 insertions, 10 deletions
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index aa3567b..1335964 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -165,19 +165,22 @@ SOBJS+= ${OBJS:.o=.So}
.if defined(SHLIB_NAME)
_LIBS+= ${SHLIB_NAME}
+.if defined(DEBUG_FLAGS)
+SHLIB_NAME_FULL=${SHLIB_NAME}.debug
+.else
+SHLIB_NAME_FULL=${SHLIB_NAME}
+.endif
+
SOLINKOPTS= -shared -Wl,-x
.if !defined(ALLOW_SHARED_TEXTREL)
SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel
.endif
.if target(beforelinking)
-${SHLIB_NAME}: beforelinking
-.endif
-.if defined(DEBUG_FLAGS)
-${SHLIB_NAME}.debug: ${SOBJS}
-.else
-${SHLIB_NAME}: ${SOBJS}
+beforelinking: ${SOBJS}
+${SHLIB_NAME_FULL}: beforelinking
.endif
+${SHLIB_NAME_FULL}: ${SOBJS}
@${ECHO} building shared library ${SHLIB_NAME}
@rm -f ${SHLIB_NAME} ${SHLIB_LINK}
.if defined(SHLIB_LINK)
@@ -197,12 +200,12 @@ ${SHLIB_NAME}: ${SOBJS}
.endif
.if defined(DEBUG_FLAGS)
-${SHLIB_NAME}: ${SHLIB_NAME}.debug ${SHLIB_NAME}.symbols
+${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.symbols
${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.symbols \
- ${SHLIB_NAME}.debug ${.TARGET}
+ ${SHLIB_NAME_FULL} ${.TARGET}
-${SHLIB_NAME}.symbols: ${SHLIB_NAME}.debug
- ${OBJCOPY} --only-keep-debug ${SHLIB_NAME}.debug ${.TARGET}
+${SHLIB_NAME}.symbols: ${SHLIB_NAME_FULL}
+ ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET}
.endif
.endif
OpenPOWER on IntegriCloud