Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2012 21:54:43 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r244915 - head/share/mk
Message-ID:  <201212312154.qBVLsh4v014794@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon Dec 31 21:54:43 2012
New Revision: 244915
URL: http://svnweb.freebsd.org/changeset/base/244915

Log:
  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)

Modified:
  head/share/mk/bsd.lib.mk
  head/share/mk/bsd.prog.mk

Modified: head/share/mk/bsd.lib.mk
==============================================================================
--- head/share/mk/bsd.lib.mk	Mon Dec 31 21:19:44 2012	(r244914)
+++ head/share/mk/bsd.lib.mk	Mon Dec 31 21:54:43 2012	(r244915)
@@ -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
 

Modified: head/share/mk/bsd.prog.mk
==============================================================================
--- head/share/mk/bsd.prog.mk	Mon Dec 31 21:19:44 2012	(r244914)
+++ head/share/mk/bsd.prog.mk	Mon Dec 31 21:54:43 2012	(r244915)
@@ -46,6 +46,7 @@ PROG=	${PROG_CXX}
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 
 .if target(beforelinking)
+beforelinking: ${OBJS}
 ${PROG}: beforelinking
 .endif
 ${PROG}: ${OBJS}
@@ -75,6 +76,7 @@ SRCS=	${PROG}.c
 OBJS=	${PROG}.o
 
 .if target(beforelinking)
+beforelinking: ${OBJS}
 ${PROG}: beforelinking
 .endif
 ${PROG}: ${OBJS}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212312154.qBVLsh4v014794>