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