ceph/Makefile.am
Sage Weil 66553d25f0 Makefile: link gtest statically
The problem:

 - the unittests link against gtest, and gtest is not installed.  that's
   normally fine, but...
 - rbd and rados api unit tests link against gtest, and are installed
   by 'make install'.  they are needed for teuthology runs, etc.
 - if we build gtest as an .la library, we can only control whether *all*
   or *no* .la libraries are linked statically.
 - we want librados to be linked dynamically.

The solution:

 - build gtest as .a instead of a libtool library
 - link it statically, always.

Unit test binaries are bigger now.  Oh well...

Fixes: #2331
Signed-off-by: Sage Weil <sage@inktank.com>
2012-06-13 11:05:53 -07:00

38 lines
1.1 KiB
Makefile

AUTOMAKE_OPTIONS = gnu
EXTRA_DIST = autogen.sh ceph.spec.in ceph.spec
# the "." here makes sure check-local builds gtest before it is used
SUBDIRS = . src man
EXTRA_DIST += \
src/test/run-cli-tests \
src/test/run-cli-tests-maybe-unset-ccache \
src/test/cli \
src/test/downloads \
udev/50-rbd.rules
all-local:
if WITH_DEBUG
# We need gtest to build the rados-api tests. We only build those in
# a debug build, though.
@cd src/gtest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.a lib/libgtest_main.a
endif
check-local:
# We build gtest this way, instead of using SUBDIRS, because with that,
# gtest's own tests would be run and that would slow us down.
@cd src/gtest && $(MAKE) $(AM_MAKEFLAGS) lib/libgtest.a lib/libgtest_main.a
# exercise cli tools
$(srcdir)/src/test/run-cli-tests '$(top_builddir)/src/test'
# "make distclean" both runs this and recurses into src/gtest, if
# gtest is in DIST_SUBDIRS. Take extra care to not fail when
# effectively cleaned twice.
clean-local:
@if test -e src/gtest/Makefile; then \
echo "Making clean in src/gtest"; \
cd src/gtest && $(MAKE) $(AM_MAKEFLAGS) clean; \
fi
@rm -rf src/test/virtualenv