bsd.lib.mk does not add OBJS etc to CLEANFILES so does not automatically

get them flagged as .NOPATH.  This hurts people who don't use obj dirs.
Since its clean target seprate rm's for things, use NOPATH_FILES as list
to collect things that need .NOPATH.

bsd.obj.mk will add CLEANFILES to NOPATH_FILES and do the deed if needed.

Reviewed by: sbruno
This commit is contained in:
Simon J. Gerraty 2014-07-22 00:42:55 +00:00
parent b177c333d4
commit 49217bc51e
2 changed files with 11 additions and 2 deletions

View File

@ -160,6 +160,7 @@ LDFLAGS+= -L${_SHLIBDIRPREFIX}${LIBPRIVATEDIR} -rpath ${LIBPRIVATEDIR}
.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME) .if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
OBJS+= ${SRCS:N*.h:R:S/$/.o/} OBJS+= ${SRCS:N*.h:R:S/$/.o/}
NOPATH_FILES+= ${OBJS}
.endif .endif
.if defined(LIB) && !empty(LIB) .if defined(LIB) && !empty(LIB)
@ -181,6 +182,7 @@ lib${LIB}.a: ${OBJS} ${STATICOBJS}
.if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB) .if ${MK_PROFILE} != "no" && defined(LIB) && !empty(LIB)
_LIBS+= lib${LIB}_p.a _LIBS+= lib${LIB}_p.a
POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po} POBJS+= ${OBJS:.o=.po} ${STATICOBJS:.o=.po}
NOPATH_FILES+= ${POBJS}
lib${LIB}_p.a: ${POBJS} lib${LIB}_p.a: ${POBJS}
@${ECHO} building profiled ${LIB} library @${ECHO} building profiled ${LIB} library
@ -196,6 +198,7 @@ lib${LIB}_p.a: ${POBJS}
.if defined(SHLIB_NAME) || \ .if defined(SHLIB_NAME) || \
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
SOBJS+= ${OBJS:.o=.So} SOBJS+= ${OBJS:.o=.So}
NOPATH_FILES+= ${SOBJS}
.endif .endif
.if defined(SHLIB_NAME) .if defined(SHLIB_NAME)
@ -254,6 +257,7 @@ lib${LIB}_pic.a: ${SOBJS}
LINTLIB= llib-l${LIB}.ln LINTLIB= llib-l${LIB}.ln
_LIBS+= ${LINTLIB} _LIBS+= ${LINTLIB}
LINTOBJS+= ${SRCS:M*.c:.c=.ln} LINTOBJS+= ${SRCS:M*.c:.c=.ln}
NOPATH_FILES+= ${LINTOBJS}
${LINTLIB}: ${LINTOBJS} ${LINTLIB}: ${LINTOBJS}
@${ECHO} building lint library ${.TARGET} @${ECHO} building lint library ${.TARGET}
@ -454,6 +458,10 @@ clean:
.endif .endif
.endif .endif
.if !empty(_LIBS)
NOPATH_FILES+= ${_LIBS}
.endif
.include <bsd.obj.mk> .include <bsd.obj.mk>
.include <bsd.sys.mk> .include <bsd.sys.mk>

View File

@ -119,8 +119,9 @@ cleanobj: clean cleandepend
@if [ -L ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi @if [ -L ${.CURDIR}/obj ]; then rm -f ${.CURDIR}/obj; fi
# Tell bmake not to look for generated files via .PATH # Tell bmake not to look for generated files via .PATH
.if !empty(CLEANFILES) NOPATH_FILES+= ${CLEANFILES}
.NOPATH: ${CLEANFILES} .if !empty(NOPATH_FILES)
.NOPATH: ${NOPATH_FILES}
.endif .endif
.if !target(clean) .if !target(clean)