Makefile.am 7.45 KB
Newer Older
1
2
# Automake file

3
# Nonstandard package files for distribution.
4
EXTRA_DIST = LICENSE
5

shiqian's avatar
shiqian committed
6
7
8
9
# We may need to build our internally packaged gtest. If so, it will be
# included in the 'subdirs' variable.
SUBDIRS = $(subdirs)

shiqian's avatar
shiqian committed
10
11
# This is generated by the configure script, so clean it for distribution.
DISTCLEANFILES = scripts/gmock-config
12
13
14
15
16

# We define the global AM_CPPFLAGS as everything we compile includes from these
# directories.
AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I$(srcdir)/include

17
18
19
20
21
22
# Modifies compiler and linker flags for pthreads compatibility.
if HAVE_PTHREADS
  AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1
  AM_LIBS = @PTHREAD_LIBS@
endif

23
24
25
# Build rules for libraries.
lib_LTLIBRARIES = lib/libgmock.la lib/libgmock_main.la

26
lib_libgmock_la_SOURCES = src/gmock-all.cc
27

28
29
30
31
32
33
34
35
36
pkginclude_HEADERS = \
  include/gmock/gmock-actions.h \
  include/gmock/gmock-cardinalities.h \
  include/gmock/gmock-generated-actions.h \
  include/gmock/gmock-generated-function-mockers.h \
  include/gmock/gmock-generated-matchers.h \
  include/gmock/gmock-generated-nice-strict.h \
  include/gmock/gmock-matchers.h \
  include/gmock/gmock-more-actions.h \
zhanyong.wan's avatar
zhanyong.wan committed
37
  include/gmock/gmock-more-matchers.h \
38
39
  include/gmock/gmock-spec-builders.h \
  include/gmock/gmock.h
40
41
42
43
44

pkginclude_internaldir = $(pkgincludedir)/internal
pkginclude_internal_HEADERS = \
  include/gmock/internal/gmock-generated-internal-utils.h \
  include/gmock/internal/gmock-internal-utils.h \
45
46
47
48
  include/gmock/internal/gmock-port.h \
  include/gmock/internal/custom/gmock-generated-actions.h \
  include/gmock/internal/custom/gmock-matchers.h \
  include/gmock/internal/custom/gmock-port.h
49
50
51
52
53
54
55
56
57
58
59
60
61
62

lib_libgmock_main_la_SOURCES = src/gmock_main.cc
lib_libgmock_main_la_LIBADD = lib/libgmock.la

# Build rules for tests. Automake's naming for some of these variables isn't
# terribly obvious, so this is a brief reference:
#
# TESTS -- Programs run automatically by "make check"
# check_PROGRAMS -- Programs built by "make check" but not necessarily run

TESTS=
check_PROGRAMS=
AM_LDFLAGS = $(GTEST_LDFLAGS)

63
64
65
66
67
68
# This exercises all major components of Google Mock.  It also
# verifies that libgmock works.
TESTS += test/gmock-spec-builders_test
check_PROGRAMS += test/gmock-spec-builders_test
test_gmock_spec_builders_test_SOURCES = test/gmock-spec-builders_test.cc
test_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.
72
73
TESTS += test/gmock_link_test
check_PROGRAMS += test/gmock_link_test
74
75
76
77
test_gmock_link_test_SOURCES = \
  test/gmock_link2_test.cc \
  test/gmock_link_test.cc \
  test/gmock_link_test.h
78
test_gmock_link_test_LDADD = $(GTEST_LIBS) lib/libgmock_main.la  lib/libgmock.la
79

80
81
82
83
84
85
86
87
88
89
90
91
if HAVE_PYTHON
  # Tests that fused gmock files compile and work.
  TESTS += test/gmock_fused_test
  check_PROGRAMS += test/gmock_fused_test
  test_gmock_fused_test_SOURCES = \
    fused-src/gmock-gtest-all.cc \
    fused-src/gmock/gmock.h \
    fused-src/gmock_main.cc \
    fused-src/gtest/gtest.h \
    test/gmock_test.cc
  test_gmock_fused_test_CPPFLAGS = -I"$(srcdir)/fused-src"
endif
92

93
# Google Mock source files that we don't compile directly.
94
GMOCK_SOURCE_INGLUDES = \
95
96
97
  src/gmock-cardinalities.cc \
  src/gmock-internal-utils.cc \
  src/gmock-matchers.cc \
98
99
  src/gmock-spec-builders.cc \
  src/gmock.cc
100

101
102
EXTRA_DIST += $(GMOCK_SOURCE_INGLUDES)

103
104
105
# C++ tests that we don't compile using autotools.
EXTRA_DIST += \
  test/gmock-actions_test.cc \
106
  test/gmock_all_test.cc \
107
  test/gmock-cardinalities_test.cc \
108
  test/gmock_ex_test.cc \
109
110
111
112
113
114
115
116
  test/gmock-generated-actions_test.cc \
  test/gmock-generated-function-mockers_test.cc \
  test/gmock-generated-internal-utils_test.cc \
  test/gmock-generated-matchers_test.cc \
  test/gmock-internal-utils_test.cc \
  test/gmock-matchers_test.cc \
  test/gmock-more-actions_test.cc \
  test/gmock-nice-strict_test.cc \
117
  test/gmock-port_test.cc \
118
  test/gmock_stress_test.cc
119
120
121
122

# Python tests, which we don't run using autotools.
EXTRA_DIST += \
  test/gmock_leak_test.py \
123
  test/gmock_leak_test_.cc \
124
  test/gmock_output_test.py \
125
126
127
  test/gmock_output_test_.cc \
  test/gmock_output_test_golden.txt \
  test/gmock_test_utils.py
128
129
130

# Nonstandard package files for distribution.
EXTRA_DIST += \
131
132
133
  CHANGES \
  CONTRIBUTORS \
  make/Makefile
134
135
136

# Pump scripts for generating Google Mock headers.
# TODO(chandlerc@google.com): automate the generation of *.h from *.h.pump.
137
138
139
140
141
EXTRA_DIST += \
  include/gmock/gmock-generated-actions.h.pump \
  include/gmock/gmock-generated-function-mockers.h.pump \
  include/gmock/gmock-generated-matchers.h.pump \
  include/gmock/gmock-generated-nice-strict.h.pump \
142
143
  include/gmock/internal/gmock-generated-internal-utils.h.pump \
  include/gmock/internal/custom/gmock-generated-actions.h.pump
144

145
# Script for fusing Google Mock and Google Test source files.
146
EXTRA_DIST += scripts/fuse_gmock_files.py
147

148
149
# The Google Mock Generator tool from the cppclean project.
EXTRA_DIST += \
vladlosev's avatar
vladlosev committed
150
  scripts/generator/LICENSE \
151
152
153
154
155
156
157
158
159
  scripts/generator/README \
  scripts/generator/README.cppclean \
  scripts/generator/cpp/__init__.py \
  scripts/generator/cpp/ast.py \
  scripts/generator/cpp/gmock_class.py \
  scripts/generator/cpp/keywords.py \
  scripts/generator/cpp/tokenize.py \
  scripts/generator/cpp/utils.py \
  scripts/generator/gmock_gen.py
160

161
162
163
164
# Script for diagnosing compiler errors in programs that use Google
# Mock.
EXTRA_DIST += scripts/gmock_doctor.py

165
166
167
168
# CMake scripts.
EXTRA_DIST += \
  CMakeLists.txt

169
170
# Microsoft Visual Studio 2005 projects.
EXTRA_DIST += \
171
172
173
174
175
176
177
178
179
180
181
182
183
  msvc/2005/gmock.sln \
  msvc/2005/gmock.vcproj \
  msvc/2005/gmock_config.vsprops \
  msvc/2005/gmock_main.vcproj \
  msvc/2005/gmock_test.vcproj

# Microsoft Visual Studio 2010 projects.
EXTRA_DIST += \
  msvc/2010/gmock.sln \
  msvc/2010/gmock.vcxproj \
  msvc/2010/gmock_config.props \
  msvc/2010/gmock_main.vcxproj \
  msvc/2010/gmock_test.vcxproj
184

185
if HAVE_PYTHON
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# gmock_test.cc does not really depend on files generated by the
# fused-gmock-internal rule.  However, gmock_test.o does, and it is
# important to include test/gmock_test.cc as part of this rule in order to
# prevent compiling gmock_test.o until all dependent files have been
# generated.
$(test_gmock_fused_test_SOURCES): fused-gmock-internal

# TODO(vladl@google.com): Find a way to add Google Tests's sources here.
fused-gmock-internal: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \
                      $(lib_libgmock_la_SOURCES) $(GMOCK_SOURCE_INGLUDES) \
                      $(lib_libgmock_main_la_SOURCES) \
                      scripts/fuse_gmock_files.py
	mkdir -p "$(srcdir)/fused-src"
	chmod -R u+w "$(srcdir)/fused-src"
	rm -f "$(srcdir)/fused-src/gtest/gtest.h"
	rm -f "$(srcdir)/fused-src/gmock/gmock.h"
	rm -f "$(srcdir)/fused-src/gmock-gtest-all.cc"
	"$(srcdir)/scripts/fuse_gmock_files.py" "$(srcdir)/fused-src"
	cp -f "$(srcdir)/src/gmock_main.cc" "$(srcdir)/fused-src"

maintainer-clean-local:
	rm -rf "$(srcdir)/fused-src"
208
endif
209
210
211
212

# Death tests may produce core dumps in the build directory. In case
# this happens, clean them to keep distcleancheck happy.
CLEANFILES = core
zhanyong.wan's avatar
zhanyong.wan committed
213
214
215
216
217
218
219
220
221
222
223
224

# Disables 'make install' as installing a compiled version of Google
# Mock can lead to undefined behavior due to violation of the
# One-Definition Rule.

install-exec-local:
	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system."
	false

install-data-local:
	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Mock into your build system."
	false