svn commit: r244915 - head/share/mk

Mark Johnston markj at freebsd.org
Sun Mar 24 20:18:42 UTC 2013


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


More information about the svn-src-all mailing list