Index: head/cddl/usr.sbin/zfsd/Makefile =================================================================== --- head/cddl/usr.sbin/zfsd/Makefile +++ head/cddl/usr.sbin/zfsd/Makefile @@ -1,12 +1,13 @@ # $FreeBSD$ +.include + .include "Makefile.common" PROG_CXX= zfsd MAN= zfsd.8 -.include +HAS_TESTS= +SUBDIR.${MK_GOOGLETEST}+= tests -# The unittests require devel/googletest and devel/googlemock from ports. -# Don't automatically build them. -SUBDIR= +.include Index: head/cddl/usr.sbin/zfsd/Makefile.common =================================================================== --- head/cddl/usr.sbin/zfsd/Makefile.common +++ head/cddl/usr.sbin/zfsd/Makefile.common @@ -28,12 +28,11 @@ INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs +INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} -DPADD= ${LIBDEVDCTL} ${LIBZFS} ${LIBZFS_CORE} ${LIBUTIL} ${LIBGEOM} \ - ${LIBBSDXML} ${LIBSBUF} ${LIBNVPAIR} ${LIBUUTIL} -LIBADD= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil +LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil cscope: find ${.CURDIR} -type f -a \( -name "*.[ch]" -o -name "*.cc" \) \ Index: head/cddl/usr.sbin/zfsd/tests/Makefile =================================================================== --- head/cddl/usr.sbin/zfsd/tests/Makefile +++ head/cddl/usr.sbin/zfsd/tests/Makefile @@ -3,30 +3,12 @@ .include "${.CURDIR}/../Makefile.common" .PATH: ${.CURDIR:H} -PLAIN_TESTS_CXX= zfsd_unittest -SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} -SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc -SRCS= +GTESTS= zfsd_unittest -# Use #include in test programs. -INCFLAGS+= -I${.CURDIR:H:H} +SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} +SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc +.undef SRCS -.if defined(DESTDIR) || defined(SYSROOT) -INCFLAGS+= -I${SYSROOT:U${DESTDIR}}/usr/include -LDFLAGS.zfsd_unittest+= -L${SYSROOT:U${DESTDIR}}/lib \ - -L${SYSROOT:U${DESTDIR}}/usr/lib -.endif - -# Googletest options -INCFLAGS+= -I${LOCALBASE}/include -D_THREAD_SAFE -pthread -LDFLAGS.zfsd_unittest+= -L${LOCALBASE}/lib -D_THREAD_SAFE -pthread -LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgtest.a - -# GoogleMock options -LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgmock.a ${LOCALBASE}/lib/libgmock_main.a - -# Googlemock fails if we don't have this line -# https://groups.google.com/forum/#!msg/googletestframework/h8ixEPCFm0o/amwfu4xGJb0J -CFLAGS.zfsd_unittest+= -DGTEST_HAS_PTHREAD +LIBADD.zfsd_unittest+= gmock_main .include