Makefile.am revision fbaaef999ba563838ebd00874ed8a1c01fbf286d
1## Process this file with automake to produce Makefile.in
2
3if HAVE_ZLIB
4GZCHECKPROGRAMS = zcgzip zcgunzip
5GZHEADERS = google/protobuf/io/gzip_stream.h
6GZTESTS = google/protobuf/io/gzip_stream_unittest.sh
7else
8GZCHECKPROGRAMS =
9GZHEADERS =
10GZTESTS =
11endif
12
13if GCC
14# These are good warnings to turn on by default
15NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
16else
17NO_OPT_CXXFLAGS = $(PTHREAD_CFLAGS)
18endif
19
20AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG)
21
22AM_LDFLAGS = $(PTHREAD_CFLAGS)
23
24# If I say "dist_include_DATA", automake complains that $(includedir) is not
25# a "legitimate" directory for DATA.  Screw you, automake.
26protodir = $(includedir)
27nobase_dist_proto_DATA = google/protobuf/descriptor.proto
28
29# Not sure why these don't get cleaned automatically.
30clean-local:
31	rm -f *.loT
32
33CLEANFILES = $(protoc_outputs) unittest_proto_middleman
34
35MAINTAINERCLEANFILES =   \
36  Makefile.in
37
38nobase_include_HEADERS =                                       \
39  google/protobuf/stubs/common.h                               \
40  google/protobuf/stubs/once.h                                 \
41  google/protobuf/descriptor.h                                 \
42  google/protobuf/descriptor.pb.h                              \
43  google/protobuf/descriptor_database.h                        \
44  google/protobuf/dynamic_message.h                            \
45  google/protobuf/extension_set.h                              \
46  google/protobuf/generated_message_util.h                     \
47  google/protobuf/generated_message_reflection.h               \
48  google/protobuf/message.h                                    \
49  google/protobuf/message_lite.h                               \
50  google/protobuf/reflection_ops.h                             \
51  google/protobuf/repeated_field.h                             \
52  google/protobuf/service.h                                    \
53  google/protobuf/text_format.h                                \
54  google/protobuf/unknown_field_set.h                          \
55  google/protobuf/wire_format.h                                \
56  google/protobuf/wire_format_lite.h                           \
57  google/protobuf/wire_format_lite_inl.h                       \
58  google/protobuf/io/coded_stream.h                            \
59  $(GZHEADERS)                                                 \
60  google/protobuf/io/printer.h                                 \
61  google/protobuf/io/tokenizer.h                               \
62  google/protobuf/io/zero_copy_stream.h                        \
63  google/protobuf/io/zero_copy_stream_impl.h                   \
64  google/protobuf/io/zero_copy_stream_impl_lite.h              \
65  google/protobuf/compiler/code_generator.h                    \
66  google/protobuf/compiler/command_line_interface.h            \
67  google/protobuf/compiler/importer.h                          \
68  google/protobuf/compiler/parser.h                            \
69  google/protobuf/compiler/cpp/cpp_generator.h                 \
70  google/protobuf/compiler/java/java_generator.h               \
71  google/protobuf/compiler/python/python_generator.h
72
73lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la
74
75libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS)
76libprotobuf_lite_la_LDFLAGS = -version-info 5:0:0
77libprotobuf_lite_la_SOURCES =                                  \
78  google/protobuf/stubs/common.cc                              \
79  google/protobuf/stubs/once.cc                                \
80  google/protobuf/stubs/hash.cc                                \
81  google/protobuf/stubs/hash.h                                 \
82  google/protobuf/stubs/map-util.h                             \
83  google/protobuf/stubs/stl_util-inl.h                         \
84  google/protobuf/extension_set.cc                             \
85  google/protobuf/generated_message_util.cc                    \
86  google/protobuf/message_lite.cc                              \
87  google/protobuf/repeated_field.cc                            \
88  google/protobuf/wire_format_lite.cc                          \
89  google/protobuf/io/coded_stream.cc                           \
90  google/protobuf/io/zero_copy_stream.cc                       \
91  google/protobuf/io/zero_copy_stream_impl_lite.cc
92
93libprotobuf_la_LIBADD = $(PTHREAD_LIBS)
94libprotobuf_la_LDFLAGS = -version-info 5:0:0
95libprotobuf_la_SOURCES =                                       \
96  $(libprotobuf_lite_la_SOURCES)                               \
97  google/protobuf/stubs/strutil.cc                             \
98  google/protobuf/stubs/strutil.h                              \
99  google/protobuf/stubs/substitute.cc                          \
100  google/protobuf/stubs/substitute.h                           \
101  google/protobuf/stubs/structurally_valid.cc                  \
102  google/protobuf/descriptor.cc                                \
103  google/protobuf/descriptor.pb.cc                             \
104  google/protobuf/descriptor_database.cc                       \
105  google/protobuf/dynamic_message.cc                           \
106  google/protobuf/extension_set_heavy.cc                       \
107  google/protobuf/generated_message_reflection.cc              \
108  google/protobuf/message.cc                                   \
109  google/protobuf/reflection_ops.cc                            \
110  google/protobuf/service.cc                                   \
111  google/protobuf/text_format.cc                               \
112  google/protobuf/unknown_field_set.cc                         \
113  google/protobuf/wire_format.cc                               \
114  google/protobuf/io/gzip_stream.cc                            \
115  google/protobuf/io/printer.cc                                \
116  google/protobuf/io/tokenizer.cc                              \
117  google/protobuf/io/zero_copy_stream_impl.cc                  \
118  google/protobuf/compiler/importer.cc                         \
119  google/protobuf/compiler/parser.cc
120
121libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la
122libprotoc_la_LDFLAGS = -version-info 5:0:0
123libprotoc_la_SOURCES =                                         \
124  google/protobuf/compiler/code_generator.cc                   \
125  google/protobuf/compiler/command_line_interface.cc           \
126  google/protobuf/compiler/cpp/cpp_enum.cc                     \
127  google/protobuf/compiler/cpp/cpp_enum.h                      \
128  google/protobuf/compiler/cpp/cpp_enum_field.cc               \
129  google/protobuf/compiler/cpp/cpp_enum_field.h                \
130  google/protobuf/compiler/cpp/cpp_extension.cc                \
131  google/protobuf/compiler/cpp/cpp_extension.h                 \
132  google/protobuf/compiler/cpp/cpp_field.cc                    \
133  google/protobuf/compiler/cpp/cpp_field.h                     \
134  google/protobuf/compiler/cpp/cpp_file.cc                     \
135  google/protobuf/compiler/cpp/cpp_file.h                      \
136  google/protobuf/compiler/cpp/cpp_generator.cc                \
137  google/protobuf/compiler/cpp/cpp_helpers.cc                  \
138  google/protobuf/compiler/cpp/cpp_helpers.h                   \
139  google/protobuf/compiler/cpp/cpp_message.cc                  \
140  google/protobuf/compiler/cpp/cpp_message.h                   \
141  google/protobuf/compiler/cpp/cpp_message_field.cc            \
142  google/protobuf/compiler/cpp/cpp_message_field.h             \
143  google/protobuf/compiler/cpp/cpp_primitive_field.cc          \
144  google/protobuf/compiler/cpp/cpp_primitive_field.h           \
145  google/protobuf/compiler/cpp/cpp_service.cc                  \
146  google/protobuf/compiler/cpp/cpp_service.h                   \
147  google/protobuf/compiler/cpp/cpp_string_field.cc             \
148  google/protobuf/compiler/cpp/cpp_string_field.h              \
149  google/protobuf/compiler/java/java_enum.cc                   \
150  google/protobuf/compiler/java/java_enum.h                    \
151  google/protobuf/compiler/java/java_enum_field.cc             \
152  google/protobuf/compiler/java/java_enum_field.h              \
153  google/protobuf/compiler/java/java_extension.cc              \
154  google/protobuf/compiler/java/java_extension.h               \
155  google/protobuf/compiler/java/java_field.cc                  \
156  google/protobuf/compiler/java/java_field.h                   \
157  google/protobuf/compiler/java/java_file.cc                   \
158  google/protobuf/compiler/java/java_file.h                    \
159  google/protobuf/compiler/java/java_generator.cc              \
160  google/protobuf/compiler/java/java_helpers.cc                \
161  google/protobuf/compiler/java/java_helpers.h                 \
162  google/protobuf/compiler/java/java_message.cc                \
163  google/protobuf/compiler/java/java_message.h                 \
164  google/protobuf/compiler/java/java_message_field.cc          \
165  google/protobuf/compiler/java/java_message_field.h           \
166  google/protobuf/compiler/java/java_primitive_field.cc        \
167  google/protobuf/compiler/java/java_primitive_field.h         \
168  google/protobuf/compiler/java/java_service.cc                \
169  google/protobuf/compiler/java/java_service.h                 \
170  google/protobuf/compiler/python/python_generator.cc
171
172bin_PROGRAMS = protoc
173protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la
174protoc_SOURCES = google/protobuf/compiler/main.cc
175
176# Tests ==============================================================
177
178protoc_inputs =                                                \
179  google/protobuf/unittest.proto                               \
180  google/protobuf/unittest_empty.proto                         \
181  google/protobuf/unittest_import.proto                        \
182  google/protobuf/unittest_mset.proto                          \
183  google/protobuf/unittest_optimize_for.proto                  \
184  google/protobuf/unittest_embed_optimize_for.proto            \
185  google/protobuf/unittest_custom_options.proto                \
186  google/protobuf/unittest_lite.proto                          \
187  google/protobuf/unittest_import_lite.proto                   \
188  google/protobuf/unittest_lite_imports_nonlite.proto          \
189  google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto
190
191EXTRA_DIST =                                                   \
192  $(protoc_inputs)                                             \
193  solaris/libstdc++.la                                         \
194  google/protobuf/io/gzip_stream.h                             \
195  google/protobuf/io/gzip_stream_unittest.sh                   \
196  google/protobuf/testdata/golden_message                      \
197  google/protobuf/testdata/golden_packed_fields_message        \
198  google/protobuf/testdata/text_format_unittest_data.txt       \
199  google/protobuf/testdata/text_format_unittest_extensions_data.txt  \
200  google/protobuf/package_info.h                               \
201  google/protobuf/io/package_info.h                            \
202  google/protobuf/compiler/package_info.h                      \
203  google/protobuf/unittest_enormous_descriptor.proto
204
205protoc_lite_outputs =                                          \
206  google/protobuf/unittest_lite.pb.cc                          \
207  google/protobuf/unittest_lite.pb.h                           \
208  google/protobuf/unittest_import_lite.pb.cc                   \
209  google/protobuf/unittest_import_lite.pb.h
210
211protoc_outputs =                                               \
212  $(protoc_lite_outputs)                                       \
213  google/protobuf/unittest.pb.cc                               \
214  google/protobuf/unittest.pb.h                                \
215  google/protobuf/unittest_empty.pb.cc                         \
216  google/protobuf/unittest_empty.pb.h                          \
217  google/protobuf/unittest_import.pb.cc                        \
218  google/protobuf/unittest_import.pb.h                         \
219  google/protobuf/unittest_mset.pb.cc                          \
220  google/protobuf/unittest_mset.pb.h                           \
221  google/protobuf/unittest_optimize_for.pb.cc                  \
222  google/protobuf/unittest_optimize_for.pb.h                   \
223  google/protobuf/unittest_embed_optimize_for.pb.cc            \
224  google/protobuf/unittest_embed_optimize_for.pb.h             \
225  google/protobuf/unittest_custom_options.pb.cc                \
226  google/protobuf/unittest_custom_options.pb.h                 \
227  google/protobuf/unittest_lite_imports_nonlite.pb.cc          \
228  google/protobuf/unittest_lite_imports_nonlite.pb.h           \
229  google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.cc  \
230  google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.h
231
232BUILT_SOURCES = $(protoc_outputs)
233
234if USE_EXTERNAL_PROTOC
235
236unittest_proto_middleman: $(protoc_inputs)
237	$(PROTOC) -I$(srcdir) --cpp_out=. $(protoc_inputs)
238	touch unittest_proto_middleman
239
240else
241
242# This rule is a little weird.  The first prereq is the protoc executable
243# and the rest are its inputs.  Therefore, $^ -- which expands to the
244# list of prereqs -- is actually a valid command.  We have to place "./" in
245# front of it in case protoc is in the current directory.  protoc allows
246# flags to appear after input file names, so we happily stick the flags on
247# the end.
248#
249# For reference, if we didn't have to worry about VPATH (i.e., building from
250# a directory other than the package root), we could have just written this:
251#   ./protoc$(EXEEXT) -I$(srcdir) --cpp_out=. $(protoc_inputs)
252unittest_proto_middleman: protoc$(EXEEXT) $(protoc_inputs)
253	./$^ -I$(srcdir) --cpp_out=.
254	touch unittest_proto_middleman
255
256endif
257
258$(protoc_outputs): unittest_proto_middleman
259
260COMMON_TEST_SOURCES =                                          \
261  google/protobuf/test_util.cc                                 \
262  google/protobuf/test_util.h                                  \
263  google/protobuf/testing/googletest.cc                        \
264  google/protobuf/testing/googletest.h                         \
265  google/protobuf/testing/file.cc                              \
266  google/protobuf/testing/file.h
267
268check_PROGRAMS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test $(GZCHECKPROGRAMS)
269protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
270                      $(top_builddir)/gtest/lib/libgtest.la       \
271                      $(top_builddir)/gtest/lib/libgtest_main.la
272protobuf_test_CPPFLAGS = -I$(top_srcdir)/gtest/include         \
273                         -I$(top_builddir)/gtest/include
274# Disable optimization for tests unless the user explicitly asked for it,
275# since test_util.cc takes forever to compile with optimization (with GCC).
276# See configure.ac for more info.
277protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
278protobuf_test_SOURCES =                                        \
279  google/protobuf/stubs/common_unittest.cc                     \
280  google/protobuf/stubs/once_unittest.cc                       \
281  google/protobuf/stubs/strutil_unittest.cc                    \
282  google/protobuf/stubs/structurally_valid_unittest.cc         \
283  google/protobuf/descriptor_database_unittest.cc              \
284  google/protobuf/descriptor_unittest.cc                       \
285  google/protobuf/dynamic_message_unittest.cc                  \
286  google/protobuf/extension_set_unittest.cc                    \
287  google/protobuf/generated_message_reflection_unittest.cc     \
288  google/protobuf/message_unittest.cc                          \
289  google/protobuf/reflection_ops_unittest.cc                   \
290  google/protobuf/repeated_field_unittest.cc                   \
291  google/protobuf/text_format_unittest.cc                      \
292  google/protobuf/unknown_field_set_unittest.cc                \
293  google/protobuf/wire_format_unittest.cc                      \
294  google/protobuf/io/coded_stream_unittest.cc                  \
295  google/protobuf/io/printer_unittest.cc                       \
296  google/protobuf/io/tokenizer_unittest.cc                     \
297  google/protobuf/io/zero_copy_stream_unittest.cc              \
298  google/protobuf/compiler/command_line_interface_unittest.cc  \
299  google/protobuf/compiler/importer_unittest.cc                \
300  google/protobuf/compiler/parser_unittest.cc                  \
301  google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc       \
302  google/protobuf/compiler/cpp/cpp_unittest.cc                 \
303  $(COMMON_TEST_SOURCES)
304nodist_protobuf_test_SOURCES = $(protoc_outputs)
305
306# Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined.
307protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
308                      $(top_builddir)/gtest/lib/libgtest.la       \
309                      $(top_builddir)/gtest/lib/libgtest_main.la
310protobuf_lazy_descriptor_test_CPPFLAGS = -I$(top_srcdir)/gtest/include    \
311                                         -I$(top_builddir)/gtest/include  \
312                                         -DPROTOBUF_TEST_NO_DESCRIPTORS
313protobuf_lazy_descriptor_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
314protobuf_lazy_descriptor_test_SOURCES =                        \
315  google/protobuf/compiler/cpp/cpp_unittest.cc                 \
316  $(COMMON_TEST_SOURCES)
317nodist_protobuf_lazy_descriptor_test_SOURCES = $(protoc_outputs)
318
319# Build lite_unittest separately, since it doesn't use gtest.
320protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la
321protobuf_lite_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
322protobuf_lite_test_SOURCES =                                           \
323  google/protobuf/lite_unittest.cc                                     \
324  google/protobuf/test_util_lite.cc                                    \
325  google/protobuf/test_util_lite.h
326nodist_protobuf_lite_test_SOURCES = $(protoc_lite_outputs)
327
328if HAVE_ZLIB
329zcgzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la
330zcgzip_SOURCES = google/protobuf/testing/zcgzip.cc
331
332zcgunzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la
333zcgunzip_SOURCES = google/protobuf/testing/zcgunzip.cc
334endif
335
336TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test $(GZTESTS)
337