OSX fix
[awesomized/libmemcached] / libtest / include.am
1 # vim:ft=automake
2 # Copyright (C) 2011 Data Differential, http://datadifferential.com/
3 # All rights reserved.
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 3 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #
19 # included from Top Level Makefile.am
20 # All paths should be given relative to the root
21 #
22
23 LIBTOOL_COMMAND= ${abs_top_builddir}/libtool --mode=execute
24 VALGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --error-exitcode=1 --leak-check=yes --show-reachable=yes --track-fds=yes --malloc-fill=A5 --free-fill=DE
25 HELGRIND_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=helgrind --read-var-info=yes --error-exitcode=1 --read-var-info=yes
26 DRD_COMMAND= $(LIBTOOL_COMMAND) valgrind --tool=drd
27 GDB_COMMAND= $(LIBTOOL_COMMAND) gdb -f -x libtest/run.gdb
28
29 export LIBTOOL_COMMAND
30 export VALGRIND_COMMAND
31 export HELGRIND_COMMAND
32 export DRD_COMMAND
33 export GDB_COMMAND
34
35 valgrind:
36 @echo make check TESTS_ENVIRONMENT="\"$(VALGRIND_COMMAND)\""
37
38 gdb:
39 @echo make check TESTS_ENVIRONMENT="\"$(GDB_COMMAND)\""
40
41 helgrind:
42 @echo make check TESTS_ENVIRONMENT="\"$(HELGRIND_COMMAND)\""
43
44 drd:
45 @echo make check TESTS_ENVIRONMENT="\"$(DRD_COMMAND)\""
46
47 EXTRA_DIST+= libtest/run.gdb
48
49 CLEANFILES+= \
50 tmp_chroot/var/log/* \
51 tmp_chroot/var/run/* \
52 tmp_chroot/var/tmp/*
53
54 .PHONY: distclean-libtest-check
55 distclean-libtest-check:
56 -rm -rf tmp_chroot
57
58 noinst_HEADERS+= \
59 libtest/binaries.h \
60 libtest/cpu.hpp \
61 libtest/blobslap_worker.h \
62 libtest/callbacks.h \
63 libtest/cmdline.h \
64 libtest/collection.h \
65 libtest/common.h \
66 libtest/comparison.hpp \
67 libtest/core.h \
68 libtest/dream.h \
69 libtest/error.h \
70 libtest/failed.h \
71 libtest/fatal.hpp \
72 libtest/framework.h \
73 libtest/gearmand.h \
74 libtest/get.h \
75 libtest/has.hpp \
76 libtest/http.hpp \
77 libtest/is_pid.hpp \
78 libtest/is_local.hpp \
79 libtest/killpid.h \
80 libtest/libtool.hpp \
81 libtest/memcached.h \
82 libtest/port.h \
83 libtest/runner.h \
84 libtest/server.h \
85 libtest/server_container.h \
86 libtest/signal.h \
87 libtest/socket.hpp \
88 libtest/stats.h \
89 libtest/stream.h \
90 libtest/strerror.h \
91 libtest/string.hpp \
92 libtest/test.h \
93 libtest/test.hpp \
94 libtest/tmpfile.hpp \
95 libtest/vchar.hpp \
96 libtest/visibility.h \
97 libtest/wait.h
98
99 noinst_LTLIBRARIES+= libtest/libtest.la
100 libtest_libtest_la_SOURCES= \
101 libtest/binaries.cc \
102 libtest/cmdline.cc \
103 libtest/core.cc \
104 libtest/cpu.cc \
105 libtest/dream.cc \
106 libtest/fatal.cc \
107 libtest/framework.cc \
108 libtest/has.cc \
109 libtest/http.cc \
110 libtest/is_local.cc \
111 libtest/killpid.cc \
112 libtest/libtool.cc \
113 libtest/port.cc \
114 libtest/runner.cc \
115 libtest/server.cc \
116 libtest/server_container.cc \
117 libtest/signal.cc \
118 libtest/socket.cc \
119 libtest/strerror.cc \
120 libtest/test.cc \
121 libtest/tmpfile.cc \
122 libtest/vchar.cc
123
124 libtest_libtest_la_CXXFLAGS=
125 libtest_libtest_la_CXXFLAGS+= ${NO_CONVERSION}
126 libtest_libtest_la_CXXFLAGS+= -DBUILDING_LIBTEST
127 libtest_libtest_la_CXXFLAGS+= $(PTHREAD_CFLAGS)
128 libtest_libtest_la_CXXFLAGS+= -DLIBTEST_TEMP="\"tmp_chroot\""
129 libtest_libtest_la_CXXFLAGS+= $(CURL_CFLAGS)
130 libtest_libtest_la_LIBADD=
131 libtest_libtest_la_LIBADD+= $(PTHREAD_LIBS)
132 libtest_libtest_la_LIBADD+= $(CURL_LIBS)
133 libtest_libtest_la_DEPENDENCIES= libtest_tmp_dir
134
135 # Declare unittest so that we can append to it
136 libtest_unittest_CXXFLAGS=
137 libtest_unittest_LDADD=
138 libtest_unittest_DEPENDENCIES=
139
140 # We are either building in tree, or with
141 if BUILDING_LIBMEMCACHED
142 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcached.la
143 libtest_libtest_la_DEPENDENCIES+= libmemcached/libmemcachedutil.la
144 libtest_libtest_la_LIBADD+= libmemcached/libmemcached.la
145 libtest_libtest_la_LIBADD+= libmemcached/libmemcachedutil.la
146 libtest_libtest_la_SOURCES+= libtest/memcached.cc
147 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED
148
149 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED
150 libtest_unittest_LDADD+= libmemcached/libmemcached.la
151 libtest_unittest_LDADD+= libmemcached/libmemcachedutil.la
152 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcached.la
153 libtest_unittest_DEPENDENCIES+= libmemcached/libmemcachedutil.la
154 else
155 if HAVE_LIBMEMCACHED
156 libtest_libtest_la_LIBADD+= $(libmemcached_LIBS)
157 libtest_libtest_la_SOURCES+= libtest/memcached.cc
158 else
159 libtest_libtest_la_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
160 libtest_unittest_CXXFLAGS+= -DHAVE_LIBMEMCACHED=0
161 endif
162 endif
163
164 if BUILDING_GEARMAN
165 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
166 libtest_libtest_la_LIBADD+= libgearman/libgearman.la
167 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
168 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
169 libtest_libtest_la_SOURCES+= util/instance.cc
170 libtest_libtest_la_SOURCES+= util/operation.cc
171
172 libtest_unittest_LDADD+= libgearman/libgearman.la
173 libtest_unittest_DEPENDENCIES+= libgearman/libgearman.la
174 libtest_unittest_DEPENDENCIES+= gearmand/gearmand
175 else
176 if HAVE_LIBGEARMAN
177 libtest_libtest_la_DEPENDENCIES+= libgearman/libgearman.la
178 libtest_libtest_la_LIBADD+= $(libgearman_LIBS)
179 libtest_libtest_la_SOURCES+= libtest/blobslap_worker.cc
180 libtest_libtest_la_SOURCES+= libtest/gearmand.cc
181 libtest_libtest_la_SOURCES+= util/instance.cc
182 libtest_libtest_la_SOURCES+= util/operation.cc
183 endif
184 endif
185
186 libtest_tmp_dir: tmp_chroot/var/log tmp_chroot/var/tmp tmp_chroot/var/run
187
188 tmp_chroot:
189 @$(mkdir_p) tmp_chroot
190
191 tmp_chroot/var: tmp_chroot
192 @$(mkdir_p) tmp_chroot/var
193
194 tmp_chroot/var/log: tmp_chroot/var
195 @$(mkdir_p) tmp_chroot/var/log
196
197 tmp_chroot/var/tmp: tmp_chroot/var
198 @$(mkdir_p) tmp_chroot/var/tmp
199
200 tmp_chroot/var/run: tmp_chroot/var
201 @$(mkdir_p) tmp_chroot/var/run
202
203
204 libtest_unittest_DEPENDENCIES+= libtest/libtest.la libtest_tmp_dir libtest/abort libtest/wait
205 libtest_unittest_LDADD+= libtest/libtest.la
206 libtest_unittest_SOURCES= libtest/unittest.cc
207 check_PROGRAMS+= libtest/unittest
208 noinst_PROGRAMS+= libtest/unittest
209 test-unittest: libtest/unittest
210 @libtest/unittest
211
212 valgrind-unittest: libtest/unittest
213 @$(VALGRIND_COMMAND) libtest/unittest
214
215 gdb-unittest: libtest/unittest
216 @$(GDB_COMMAND) libtest/unittest
217
218 helgrind-unittest: libtest/unittest
219 @$(HELGRIND_COMMAND) libtest/unittest
220
221 drd-unittest: libtest/unittest
222 @$(DRD_COMMAND) libtest/unittest
223
224 libtest_skiptest_LDADD= libtest/libtest.la
225 libtest_skiptest_SOURCES= libtest/skiptest.cc
226 check_PROGRAMS+= libtest/skiptest
227 noinst_PROGRAMS+= libtest/skiptest
228
229 libtest_wait_SOURCES= libtest/wait.cc
230 noinst_PROGRAMS+= libtest/wait
231
232 libtest_abort_SOURCES= libtest/abort.cc
233 noinst_PROGRAMS+= libtest/abort