1# Automake file
2
3# Nonstandard package files for distribution.
4EXTRA_DIST = LICENSE
5
6# We may need to build our internally packaged gtest. If so, it will be
7# included in the 'subdirs' variable.
8SUBDIRS = $(subdirs)
9
10# This is generated by the configure script, so clean it for distribution.
11DISTCLEANFILES = scripts/gmock-config
12
13# We define the global AM_CPPFLAGS as everything we compile includes from these
14# directories.
15AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I$(srcdir)/include
16
17# Modifies compiler and linker flags for pthreads compatibility.
18if HAVE_PTHREADS
19  AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1
20  AM_LIBS = @PTHREAD_LIBS@
21endif
22
23# Build rules for libraries.
24lib_LTLIBRARIES = lib/libgmock.la lib/libgmock_main.la
25
26lib_libgmock_la_SOURCES = src/gmock-all.cc
27
28pkginclude_HEADERS = \
29  include/gmock/gmock-actions.h \
30  include/gmock/gmock-cardinalities.h \
31  include/gmock/gmock-generated-actions.h \
32  include/gmock/gmock-generated-function-mockers.h \
33  include/gmock/gmock-generated-matchers.h \
34  include/gmock/gmock-generated-nice-strict.h \
35  include/gmock/gmock-matchers.h \
36  include/gmock/gmock-more-actions.h \
37  include/gmock/gmock-more-matchers.h \
38  include/gmock/gmock-spec-builders.h \
39  include/gmock/gmock.h
40
41pkginclude_internaldir = $(pkgincludedir)/internal
42pkginclude_internal_HEADERS = \
43  include/gmock/internal/gmock-generated-internal-utils.h \
44  include/gmock/internal/gmock-internal-utils.h \
45  include/gmock/internal/gmock-port.h \
46  include/gmock/internal/custom/gmock-generated-actions.h \
47  include/gmock/internal/custom/gmock-matchers.h \
48  include/gmock/internal/custom/gmock-port.h
49
50lib_libgmock_main_la_SOURCES = src/gmock_main.cc
51lib_libgmock_main_la_LIBADD = lib/libgmock.la
52
53# Build rules for tests. Automake's naming for some of these variables isn't
54# terribly obvious, so this is a brief reference:
55#
56# TESTS -- Programs run automatically by "make check"
57# check_PROGRAMS -- Programs built by "make check" but not necessarily run
58
59TESTS=
60check_PROGRAMS=
61AM_LDFLAGS = $(GTEST_LDFLAGS)
62
63# This exercises all major components of Google Mock.  It also
64# verifies that libgmock works.
65TESTS += test/gmock-spec-builders_test
66check_PROGRAMS += test/gmock-spec-builders_test
67test_gmock_spec_builders_test_SOURCES = test/gmock-spec-builders_test.cc
68test_gmock_spec_builders_test_LDADD = $(GTEST_LIBS) lib/libgmock.la
69
70# This tests using Google Mock in multiple translation units.  It also
71# verifies that libgmock_main and libgmock work.
72TESTS += test/gmock_link_test
73check_PROGRAMS += test/gmock_link_test
74test_gmock_link_test_SOURCES = \
75  test/gmock_link2_test.cc \
76  test/gmock_link_test.cc \
77  test/gmock_link_test.h
78test_gmock_link_test_LDADD = $(GTEST_LIBS) lib/libgmock_main.la  lib/libgmock.la
79
80if HAVE_PYTHON
81  # Tests that fused gmock files compile and work.
82  TESTS += test/gmock_fused_test
83  check_PROGRAMS += test/gmock_fused_test
84  test_gmock_fused_test_SOURCES = \
85    fused-src/gmock-gtest-all.cc \
86    fused-src/gmock/gmock.h \
87    fused-src/gmock_main.cc \
88    fused-src/gtest/gtest.h \
89    test/gmock_test.cc
90  test_gmock_fused_test_CPPFLAGS = -I"$(srcdir)/fused-src"
91endif
92
93# Google Mock source files that we don't compile directly.
94GMOCK_SOURCE_INGLUDES = \
95  src/gmock-cardinalities.cc \
96  src/gmock-internal-utils.cc \
97  src/gmock-matchers.cc \
98  src/gmock-spec-builders.cc \
99  src/gmock.cc
100
101EXTRA_DIST += $(GMOCK_SOURCE_INGLUDES)
102
103# C++ tests that we don't compile using autotools.
104EXTRA_DIST += \
105  test/gmock-actions_test.cc \
106  test/gmock_all_test.cc \
107  test/gmock-cardinalities_test.cc \
108  test/gmock_ex_test.cc \
109  test/gmock-generated-actions_test.cc \
110  test/gmock-generated-function-mockers_test.cc \
111  test/gmock-generated-internal-utils_test.cc \
112  test/gmock-generated-matchers_test.cc \
113  test/gmock-internal-utils_test.cc \
114  test/gmock-matchers_test.cc \
115  test/gmock-more-actions_test.cc \
116  test/gmock-nice-strict_test.cc \
117  test/gmock-port_test.cc \
118  test/gmock_stress_test.cc
119
120# Python tests, which we don't run using autotools.
121EXTRA_DIST += \
122  test/gmock_leak_test.py \
123  test/gmock_leak_test_.cc \
124  test/gmock_output_test.py \
125  test/gmock_output_test_.cc \
126  test/gmock_output_test_golden.txt \
127  test/gmock_test_utils.py
128
129# Nonstandard package files for distribution.
130EXTRA_DIST += \
131  CHANGES \
132  CONTRIBUTORS \
133  make/Makefile
134
135# Pump scripts for generating Google Mock headers.
136# TODO(chandlerc@google.com): automate the generation of *.h from *.h.pump.
137EXTRA_DIST += \
138  include/gmock/gmock-generated-actions.h.pump \
139  include/gmock/gmock-generated-function-mockers.h.pump \
140  include/gmock/gmock-generated-matchers.h.pump \
141  include/gmock/gmock-generated-nice-strict.h.pump \
142  include/gmock/internal/gmock-generated-internal-utils.h.pump \
143  include/gmock/internal/custom/gmock-generated-actions.h.pump
144
145# Script for fusing Google Mock and Google Test source files.
146EXTRA_DIST += scripts/fuse_gmock_files.py
147
148# The Google Mock Generator tool from the cppclean project.
149EXTRA_DIST += \
150  scripts/generator/LICENSE \
151  scripts/generator/README \
152  scripts/generator/README.cppclean \
153  scripts/generator/cpp/__init__.py \
154  scripts/generator/cpp/ast.py \
155  scripts/generator/cpp/gmock_class.py \
156  scripts/generator/cpp/keywords.py \
157  scripts/generator/cpp/tokenize.py \
158  scripts/generator/cpp/utils.py \
159  scripts/generator/gmock_gen.py
160
161# Script for diagnosing compiler errors in programs that use Google
162# Mock.
163EXTRA_DIST += scripts/gmock_doctor.py
164
165# CMake scripts.
166EXTRA_DIST += \
167  CMakeLists.txt
168
169# Microsoft Visual Studio 2005 projects.
170EXTRA_DIST += \
171  msvc/2005/gmock.sln \
172  msvc/2005/gmock.vcproj \
173  msvc/2005/gmock_config.vsprops \
174  msvc/2005/gmock_main.vcproj \
175  msvc/2005/gmock_test.vcproj
176
177# Microsoft Visual Studio 2010 projects.
178EXTRA_DIST += \
179  msvc/2010/gmock.sln \
180  msvc/2010/gmock.vcxproj \
181  msvc/2010/gmock_config.props \
182  msvc/2010/gmock_main.vcxproj \
183  msvc/2010/gmock_test.vcxproj
184
185if HAVE_PYTHON
186# gmock_test.cc does not really depend on files generated by the
187# fused-gmock-internal rule.  However, gmock_test.o does, and it is
188# important to include test/gmock_test.cc as part of this rule in order to
189# prevent compiling gmock_test.o until all dependent files have been
190# generated.
191$(test_gmock_fused_test_SOURCES): fused-gmock-internal
192
193# TODO(vladl@google.com): Find a way to add Google Tests's sources here.
194fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \
195                      $(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \
196                      $(lib_libgmock_main_la_SOURCES) \
197                      scripts/fuse_gmock_files.py
198	mkdir -p "$(srcdir)/fused-src"
199	chmod -R u+w "$(srcdir)/fused-src"
200	rm -f "$(srcdir)/fused-src/gtest/gtest.h"
201	rm -f "$(srcdir)/fused-src/gmock/gmock.h"
202	rm -f "$(srcdir)/fused-src/gmock-gtest-all.cc"
203	"$(srcdir)/scripts/fuse_gmock_files.py" "$(srcdir)/fused-src"
204	cp -f "$(srcdir)/src/gmock_main.cc" "$(srcdir)/fused-src"
205
206maintainer-clean-local:
207	rm -rf "$(srcdir)/fused-src"
208endif
209
210# Death tests may produce core dumps in the build directory. In case
211# this happens, clean them to keep distcleancheck happy.
212CLEANFILES = core
213
214# Disables 'make install' as installing a compiled version of Google
215# Mock can lead to undefined behavior due to violation of the
216# One-Definition Rule.
217
218install-exec-local:
219	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system."
220	false
221
222install-data-local:
223	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system."
224	false
225