Hook HAS_TESTS (r321901) in to bsd.lib.mk and bsd.prog.mk

Apply the required sugar to make "make check" just work (tm) when
invoked from a subdirectory where HAS_TESTS is defined in the
relevant Makefile.

Adjust $LD_LIBRARY_PATH and $PATH appropriately from bsd.lib.mk
and bsd.prog.mk to make the "user experience" more out of the
box/seamless.
This commit is contained in:
Enji Cooper 2017-08-02 03:18:24 +00:00
parent fee25c6847
commit 5e291c3faf
2 changed files with 13 additions and 0 deletions

View File

@ -442,6 +442,12 @@ OBJS_DEPEND_GUESS.${_S:R}.pico+= ${_S}
.endfor
.endif
.if defined(HAS_TESTS)
MAKE+= -D_TESTS_USE_OBJDIR
SUBDIR_TARGETS+= check
TESTS_LD_LIBRARY_PATH+= ${.OBJDIR}
.endif
.include <bsd.dep.mk>
.include <bsd.clang-analyze.mk>
.include <bsd.obj.mk>

View File

@ -305,6 +305,13 @@ lint: ${SRCS:M*.c}
.include <bsd.man.mk>
.endif
.if defined(HAS_TESTS)
MAKE+= -D_TESTS_USE_OBJDIR
SUBDIR_TARGETS+= check
TESTS_LD_LIBRARY_PATH+= ${.OBJDIR}
TESTS_PATH+= ${.OBJDIR}
.endif
.if defined(PROG)
OBJS_DEPEND_GUESS+= ${SRCS:M*.h}
.endif