1# $FreeBSD$ 2 3SRCDIR=${.CURDIR}/../../../.. 4.include "${.CURDIR}/../Makefile.common" 5.PATH: ${.CURDIR}/.. 6 7TESTSDIR?= ${TESTSBASE}/cddl/sbin/zfsd 8 9PLAIN_TESTS_CXX= zfsd_unittest 10SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} 11SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc 12SRCS= 13 14# Use #include <zfsd/xxx.h> in test programs. 15INCFLAGS+= -I${.CURDIR}/../.. 16 17.if defined(DESTDIR) 18INCFLAGS+= -I${DESTDIR}/usr/include 19LIBRARY_PATH= ${DESTDIR}/lib:${DESTDIR}/usr/lib 20LDFLAGS.zfsd_unittest+= -L${DESTDIR}/lib -L${DESTDIR}/usr/lib 21.elif defined(WORLDTMP) 22INCFLAGS+= -I${WORLDTMP}/usr/include 23LIBRARY_PATH= ${WORLDTMP}/lib:${WORLDTMP}/usr/lib 24LDFLAGS.zfsd_unittest+= -L${WORLDTMP}/lib -L${WORLDTMP}/usr/lib 25.else 26LIBRARY_PATH= 27.endif 28 29# Googletest options 30LOCALBASE?= /usr/local 31INCFLAGS+= -I${LOCALBASE}/include -D_THREAD_SAFE -pthread 32LDFLAGS.zfsd_unittest+= -L${LOCALBASE}/lib -D_THREAD_SAFE -pthread 33LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgtest.a 34 35# GoogleMock options 36LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgmock.a ${LOCALBASE}/lib/libgmock_main.a 37 38# Googlemock fails if we don't have this line 39# https://groups.google.com/forum/#!msg/googletestframework/h8ixEPCFm0o/amwfu4xGJb0J 40CFLAGS.zfsd_unittest+= -DGTEST_HAS_PTHREAD 41 42# Install the tests 43TESTSBASE?= /usr/tests 44 45.include <bsd.test.mk> 46