Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Mar 2013 16:18:30 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        Gleb Kurtsou <gleb@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r244915 - head/share/mk
Message-ID:  <20130324201830.GA1682@oddish>
In-Reply-To: <20130324184756.GA3874@reks>
References:  <201212312154.qBVLsh4v014794@svn.freebsd.org> <20130324184756.GA3874@reks>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 24, 2013 at 11:47:57AM -0700, Gleb Kurtsou wrote:
> On (31/12/2012 21:54), Mark Johnston wrote:
> > 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.
> 
> Shouldn't ${SHLIB_NAME}.debug and ${SHLIB_NAME}.symbols be added to
> CLEANFILES?
> 
> Thanks,
> Gleb.

Yes, I think you're right. Most of the time it doesn't matter since
bsd.lib.mk runs "rm -rf lib${LIB}.so.*" when running make clean. But if
a library makefile overrides SHLIB_NAME and sets it to something that
doesn't have "lib${LIB}.so." as a prefix, make clean won't remove the
.debug and .symbols files. I see one example of this in the tree -
sys/boot/userboot/userboot. Is that how you noticed this?

I'm still testing the patch below, but I think it should fix the
problem.

Thanks,
-Mark

diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 3664210..38c8de3 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -202,6 +202,7 @@ ${SHLIB_NAME_FULL}: ${SOBJS}
 .endif
 
 .if defined(DEBUG_FLAGS)
+CLEANFILES+=	${SHLIB_NAME_FULL} ${SHLIB_NAME}.symbols
 ${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.symbols
 	${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.symbols \
 	    ${SHLIB_NAME_FULL} ${.TARGET}
@@ -209,7 +210,7 @@ ${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.symbols
 ${SHLIB_NAME}.symbols: ${SHLIB_NAME_FULL}
 	${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET}
 .endif
-.endif
+.endif #defined(SHLIB_NAME)
 
 .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no"
 _LIBS+=		lib${LIB}_pic.a
@@ -398,10 +399,7 @@ clean:
 .endif
 	rm -f ${SHLIB_LINK}
 .endif
-.if defined(LIB) && !empty(LIB)
-	rm -f lib${LIB}.so.* lib${LIB}.so
-.endif
-.endif
+.endif # defined(SHLIB_NAME)
 .if defined(WANT_LINT) && defined(LIB) && !empty(LIB)
 	rm -f ${LINTOBJS}
 .endif



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