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                         google/protobuf/compiler/plugin.proto
29
30# Not sure why these don't get cleaned automatically.
31clean-local:
32	rm -f *.loT
33
34CLEANFILES = $(protoc_outputs) unittest_proto_middleman \
35             testzip.jar testzip.list testzip.proto testzip.zip
36
37MAINTAINERCLEANFILES =   \
38  Makefile.in
39
40nobase_include_HEADERS =                                        \
41  google/protobuf/stubs/atomicops.h                             \
42  google/protobuf/stubs/atomicops_internals_arm_gcc.h           \
43  google/protobuf/stubs/atomicops_internals_arm_qnx.h           \
44  google/protobuf/stubs/atomicops_internals_atomicword_compat.h \
45  google/protobuf/stubs/atomicops_internals_macosx.h            \
46  google/protobuf/stubs/atomicops_internals_mips_gcc.h          \
47  google/protobuf/stubs/atomicops_internals_pnacl.h             \
48  google/protobuf/stubs/atomicops_internals_x86_gcc.h           \
49  google/protobuf/stubs/atomicops_internals_x86_msvc.h          \
50  google/protobuf/stubs/common.h                                \
51  google/protobuf/stubs/platform_macros.h                       \
52  google/protobuf/stubs/once.h                                  \
53  google/protobuf/stubs/template_util.h                         \
54  google/protobuf/stubs/type_traits.h                           \
55  google/protobuf/descriptor.h                                  \
56  google/protobuf/descriptor.pb.h                               \
57  google/protobuf/descriptor_database.h                         \
58  google/protobuf/dynamic_message.h                             \
59  google/protobuf/extension_set.h                               \
60  google/protobuf/generated_enum_reflection.h                   \
61  google/protobuf/generated_message_util.h                      \
62  google/protobuf/generated_message_reflection.h                \
63  google/protobuf/message.h                                     \
64  google/protobuf/message_lite.h                                \
65  google/protobuf/reflection_ops.h                              \
66  google/protobuf/repeated_field.h                              \
67  google/protobuf/service.h                                     \
68  google/protobuf/text_format.h                                 \
69  google/protobuf/unknown_field_set.h                           \
70  google/protobuf/wire_format.h                                 \
71  google/protobuf/wire_format_lite.h                            \
72  google/protobuf/wire_format_lite_inl.h                        \
73  google/protobuf/io/coded_stream.h                             \
74  $(GZHEADERS)                                                  \
75  google/protobuf/io/printer.h                                  \
76  google/protobuf/io/tokenizer.h                                \
77  google/protobuf/io/zero_copy_stream.h                         \
78  google/protobuf/io/zero_copy_stream_impl.h                    \
79  google/protobuf/io/zero_copy_stream_impl_lite.h               \
80  google/protobuf/compiler/code_generator.h                     \
81  google/protobuf/compiler/command_line_interface.h             \
82  google/protobuf/compiler/importer.h                           \
83  google/protobuf/compiler/parser.h                             \
84  google/protobuf/compiler/plugin.h                             \
85  google/protobuf/compiler/plugin.pb.h                          \
86  google/protobuf/compiler/cpp/cpp_generator.h                  \
87  google/protobuf/compiler/java/java_generator.h                \
88  google/protobuf/compiler/python/python_generator.h
89
90lib_LTLIBRARIES = libprotobuf-lite.la libprotobuf.la libprotoc.la
91
92libprotobuf_lite_la_LIBADD = $(PTHREAD_LIBS)
93libprotobuf_lite_la_LDFLAGS = -version-info 8:0:0 -export-dynamic -no-undefined
94libprotobuf_lite_la_SOURCES =                                  \
95  google/protobuf/stubs/atomicops_internals_x86_gcc.cc         \
96  google/protobuf/stubs/atomicops_internals_x86_msvc.cc        \
97  google/protobuf/stubs/common.cc                              \
98  google/protobuf/stubs/once.cc                                \
99  google/protobuf/stubs/hash.h                                 \
100  google/protobuf/stubs/map-util.h                             \
101  google/protobuf/stubs/stl_util.h                             \
102  google/protobuf/stubs/stringprintf.cc                        \
103  google/protobuf/stubs/stringprintf.h                         \
104  google/protobuf/extension_set.cc                             \
105  google/protobuf/generated_message_util.cc                    \
106  google/protobuf/message_lite.cc                              \
107  google/protobuf/repeated_field.cc                            \
108  google/protobuf/wire_format_lite.cc                          \
109  google/protobuf/io/coded_stream.cc                           \
110  google/protobuf/io/coded_stream_inl.h                        \
111  google/protobuf/io/zero_copy_stream.cc                       \
112  google/protobuf/io/zero_copy_stream_impl_lite.cc
113
114libprotobuf_la_LIBADD = $(PTHREAD_LIBS)
115libprotobuf_la_LDFLAGS = -version-info 8:0:0 -export-dynamic -no-undefined
116libprotobuf_la_SOURCES =                                       \
117  $(libprotobuf_lite_la_SOURCES)                               \
118  google/protobuf/stubs/strutil.cc                             \
119  google/protobuf/stubs/strutil.h                              \
120  google/protobuf/stubs/substitute.cc                          \
121  google/protobuf/stubs/substitute.h                           \
122  google/protobuf/stubs/structurally_valid.cc                  \
123  google/protobuf/descriptor.cc                                \
124  google/protobuf/descriptor.pb.cc                             \
125  google/protobuf/descriptor_database.cc                       \
126  google/protobuf/dynamic_message.cc                           \
127  google/protobuf/extension_set_heavy.cc                       \
128  google/protobuf/generated_message_reflection.cc              \
129  google/protobuf/message.cc                                   \
130  google/protobuf/reflection_ops.cc                            \
131  google/protobuf/service.cc                                   \
132  google/protobuf/text_format.cc                               \
133  google/protobuf/unknown_field_set.cc                         \
134  google/protobuf/wire_format.cc                               \
135  google/protobuf/io/gzip_stream.cc                            \
136  google/protobuf/io/printer.cc                                \
137  google/protobuf/io/tokenizer.cc                              \
138  google/protobuf/io/zero_copy_stream_impl.cc                  \
139  google/protobuf/compiler/importer.cc                         \
140  google/protobuf/compiler/parser.cc
141
142libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la
143libprotoc_la_LDFLAGS = -version-info 8:0:0 -export-dynamic -no-undefined
144libprotoc_la_SOURCES =                                         \
145  google/protobuf/compiler/code_generator.cc                   \
146  google/protobuf/compiler/command_line_interface.cc           \
147  google/protobuf/compiler/plugin.cc                           \
148  google/protobuf/compiler/plugin.pb.cc                        \
149  google/protobuf/compiler/subprocess.cc                       \
150  google/protobuf/compiler/subprocess.h                        \
151  google/protobuf/compiler/zip_writer.cc                       \
152  google/protobuf/compiler/zip_writer.h                        \
153  google/protobuf/compiler/cpp/cpp_enum.cc                     \
154  google/protobuf/compiler/cpp/cpp_enum.h                      \
155  google/protobuf/compiler/cpp/cpp_enum_field.cc               \
156  google/protobuf/compiler/cpp/cpp_enum_field.h                \
157  google/protobuf/compiler/cpp/cpp_extension.cc                \
158  google/protobuf/compiler/cpp/cpp_extension.h                 \
159  google/protobuf/compiler/cpp/cpp_field.cc                    \
160  google/protobuf/compiler/cpp/cpp_field.h                     \
161  google/protobuf/compiler/cpp/cpp_file.cc                     \
162  google/protobuf/compiler/cpp/cpp_file.h                      \
163  google/protobuf/compiler/cpp/cpp_generator.cc                \
164  google/protobuf/compiler/cpp/cpp_helpers.cc                  \
165  google/protobuf/compiler/cpp/cpp_helpers.h                   \
166  google/protobuf/compiler/cpp/cpp_message.cc                  \
167  google/protobuf/compiler/cpp/cpp_message.h                   \
168  google/protobuf/compiler/cpp/cpp_message_field.cc            \
169  google/protobuf/compiler/cpp/cpp_message_field.h             \
170  google/protobuf/compiler/cpp/cpp_options.h                   \
171  google/protobuf/compiler/cpp/cpp_primitive_field.cc          \
172  google/protobuf/compiler/cpp/cpp_primitive_field.h           \
173  google/protobuf/compiler/cpp/cpp_service.cc                  \
174  google/protobuf/compiler/cpp/cpp_service.h                   \
175  google/protobuf/compiler/cpp/cpp_string_field.cc             \
176  google/protobuf/compiler/cpp/cpp_string_field.h              \
177  google/protobuf/compiler/java/java_enum.cc                   \
178  google/protobuf/compiler/java/java_enum.h                    \
179  google/protobuf/compiler/java/java_enum_field.cc             \
180  google/protobuf/compiler/java/java_enum_field.h              \
181  google/protobuf/compiler/java/java_extension.cc              \
182  google/protobuf/compiler/java/java_extension.h               \
183  google/protobuf/compiler/java/java_field.cc                  \
184  google/protobuf/compiler/java/java_field.h                   \
185  google/protobuf/compiler/java/java_file.cc                   \
186  google/protobuf/compiler/java/java_file.h                    \
187  google/protobuf/compiler/java/java_generator.cc              \
188  google/protobuf/compiler/java/java_helpers.cc                \
189  google/protobuf/compiler/java/java_helpers.h                 \
190  google/protobuf/compiler/java/java_message.cc                \
191  google/protobuf/compiler/java/java_message.h                 \
192  google/protobuf/compiler/java/java_message_field.cc          \
193  google/protobuf/compiler/java/java_message_field.h           \
194  google/protobuf/compiler/java/java_primitive_field.cc        \
195  google/protobuf/compiler/java/java_primitive_field.h         \
196  google/protobuf/compiler/java/java_service.cc                \
197  google/protobuf/compiler/java/java_service.h                 \
198  google/protobuf/compiler/java/java_string_field.cc           \
199  google/protobuf/compiler/java/java_string_field.h            \
200  google/protobuf/compiler/java/java_doc_comment.cc            \
201  google/protobuf/compiler/java/java_doc_comment.h             \
202  google/protobuf/compiler/python/python_generator.cc
203
204bin_PROGRAMS = protoc
205protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la
206protoc_SOURCES = google/protobuf/compiler/main.cc
207
208# Tests ==============================================================
209
210protoc_inputs =                                                \
211  google/protobuf/unittest.proto                               \
212  google/protobuf/unittest_empty.proto                         \
213  google/protobuf/unittest_import.proto                        \
214  google/protobuf/unittest_import_public.proto                 \
215  google/protobuf/unittest_mset.proto                          \
216  google/protobuf/unittest_optimize_for.proto                  \
217  google/protobuf/unittest_embed_optimize_for.proto            \
218  google/protobuf/unittest_custom_options.proto                \
219  google/protobuf/unittest_lite.proto                          \
220  google/protobuf/unittest_import_lite.proto                   \
221  google/protobuf/unittest_import_public_lite.proto            \
222  google/protobuf/unittest_lite_imports_nonlite.proto          \
223  google/protobuf/unittest_no_generic_services.proto           \
224  google/protobuf/compiler/cpp/cpp_test_bad_identifiers.proto
225
226EXTRA_DIST =                                                   \
227  $(protoc_inputs)                                             \
228  solaris/libstdc++.la                                         \
229  google/protobuf/io/gzip_stream.h                             \
230  google/protobuf/io/gzip_stream_unittest.sh                   \
231  google/protobuf/testdata/golden_message                      \
232  google/protobuf/testdata/golden_packed_fields_message        \
233  google/protobuf/testdata/text_format_unittest_data.txt       \
234  google/protobuf/testdata/text_format_unittest_extensions_data.txt  \
235  google/protobuf/package_info.h                               \
236  google/protobuf/io/package_info.h                            \
237  google/protobuf/compiler/package_info.h                      \
238  google/protobuf/compiler/zip_output_unittest.sh              \
239  google/protobuf/unittest_enormous_descriptor.proto
240
241protoc_lite_outputs =                                          \
242  google/protobuf/unittest_lite.pb.cc                          \
243  google/protobuf/unittest_lite.pb.h                           \
244  google/protobuf/unittest_import_lite.pb.cc                   \
245  google/protobuf/unittest_import_lite.pb.h                    \
246  google/protobuf/unittest_import_public_lite.pb.cc            \
247  google/protobuf/unittest_import_public_lite.pb.h
248
249protoc_outputs =                                               \
250  $(protoc_lite_outputs)                                       \
251  google/protobuf/unittest.pb.cc                               \
252  google/protobuf/unittest.pb.h                                \
253  google/protobuf/unittest_empty.pb.cc                         \
254  google/protobuf/unittest_empty.pb.h                          \
255  google/protobuf/unittest_import.pb.cc                        \
256  google/protobuf/unittest_import.pb.h                         \
257  google/protobuf/unittest_import_public.pb.cc                 \
258  google/protobuf/unittest_import_public.pb.h                  \
259  google/protobuf/unittest_mset.pb.cc                          \
260  google/protobuf/unittest_mset.pb.h                           \
261  google/protobuf/unittest_optimize_for.pb.cc                  \
262  google/protobuf/unittest_optimize_for.pb.h                   \
263  google/protobuf/unittest_embed_optimize_for.pb.cc            \
264  google/protobuf/unittest_embed_optimize_for.pb.h             \
265  google/protobuf/unittest_custom_options.pb.cc                \
266  google/protobuf/unittest_custom_options.pb.h                 \
267  google/protobuf/unittest_lite_imports_nonlite.pb.cc          \
268  google/protobuf/unittest_lite_imports_nonlite.pb.h           \
269  google/protobuf/unittest_no_generic_services.pb.cc           \
270  google/protobuf/unittest_no_generic_services.pb.h            \
271  google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.cc  \
272  google/protobuf/compiler/cpp/cpp_test_bad_identifiers.pb.h
273
274BUILT_SOURCES = $(protoc_outputs)
275
276if USE_EXTERNAL_PROTOC
277
278unittest_proto_middleman: $(protoc_inputs)
279	$(PROTOC) -I$(srcdir) --cpp_out=. $^
280	touch unittest_proto_middleman
281
282else
283
284# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is
285# relative to srcdir, which may not be the same as the current directory when
286# building out-of-tree.
287unittest_proto_middleman: protoc$(EXEEXT) $(protoc_inputs)
288	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/protoc$(EXEEXT) -I. --cpp_out=$$oldpwd $(protoc_inputs) )
289	touch unittest_proto_middleman
290
291endif
292
293$(protoc_outputs): unittest_proto_middleman
294
295COMMON_TEST_SOURCES =                                          \
296  google/protobuf/test_util.cc                                 \
297  google/protobuf/test_util.h                                  \
298  google/protobuf/testing/googletest.cc                        \
299  google/protobuf/testing/googletest.h                         \
300  google/protobuf/testing/file.cc                              \
301  google/protobuf/testing/file.h
302
303check_PROGRAMS = protoc protobuf-test protobuf-lazy-descriptor-test \
304                 protobuf-lite-test test_plugin $(GZCHECKPROGRAMS)
305protobuf_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
306                      $(top_builddir)/gtest/lib/libgtest.la       \
307                      $(top_builddir)/gtest/lib/libgtest_main.la
308protobuf_test_CPPFLAGS = -I$(top_srcdir)/gtest/include         \
309                         -I$(top_builddir)/gtest/include
310# Disable optimization for tests unless the user explicitly asked for it,
311# since test_util.cc takes forever to compile with optimization (with GCC).
312# See configure.ac for more info.
313protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
314protobuf_test_SOURCES =                                        \
315  google/protobuf/stubs/common_unittest.cc                     \
316  google/protobuf/stubs/once_unittest.cc                       \
317  google/protobuf/stubs/strutil_unittest.cc                    \
318  google/protobuf/stubs/structurally_valid_unittest.cc         \
319  google/protobuf/stubs/stringprintf_unittest.cc               \
320  google/protobuf/stubs/template_util_unittest.cc              \
321  google/protobuf/stubs/type_traits_unittest.cc                \
322  google/protobuf/descriptor_database_unittest.cc              \
323  google/protobuf/descriptor_unittest.cc                       \
324  google/protobuf/dynamic_message_unittest.cc                  \
325  google/protobuf/extension_set_unittest.cc                    \
326  google/protobuf/generated_message_reflection_unittest.cc     \
327  google/protobuf/message_unittest.cc                          \
328  google/protobuf/reflection_ops_unittest.cc                   \
329  google/protobuf/repeated_field_unittest.cc                   \
330  google/protobuf/repeated_field_reflection_unittest.cc        \
331  google/protobuf/text_format_unittest.cc                      \
332  google/protobuf/unknown_field_set_unittest.cc                \
333  google/protobuf/wire_format_unittest.cc                      \
334  google/protobuf/io/coded_stream_unittest.cc                  \
335  google/protobuf/io/printer_unittest.cc                       \
336  google/protobuf/io/tokenizer_unittest.cc                     \
337  google/protobuf/io/zero_copy_stream_unittest.cc              \
338  google/protobuf/compiler/command_line_interface_unittest.cc  \
339  google/protobuf/compiler/importer_unittest.cc                \
340  google/protobuf/compiler/mock_code_generator.cc              \
341  google/protobuf/compiler/mock_code_generator.h               \
342  google/protobuf/compiler/parser_unittest.cc                  \
343  google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc       \
344  google/protobuf/compiler/cpp/cpp_unittest.h                  \
345  google/protobuf/compiler/cpp/cpp_unittest.cc                 \
346  google/protobuf/compiler/cpp/cpp_plugin_unittest.cc          \
347  google/protobuf/compiler/java/java_plugin_unittest.cc        \
348  google/protobuf/compiler/java/java_doc_comment_unittest.cc   \
349  google/protobuf/compiler/python/python_plugin_unittest.cc    \
350  $(COMMON_TEST_SOURCES)
351nodist_protobuf_test_SOURCES = $(protoc_outputs)
352
353# Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined.
354protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
355                      $(top_builddir)/gtest/lib/libgtest.la       \
356                      $(top_builddir)/gtest/lib/libgtest_main.la
357protobuf_lazy_descriptor_test_CPPFLAGS = -I$(top_srcdir)/gtest/include    \
358                                         -I$(top_builddir)/gtest/include  \
359                                         -DPROTOBUF_TEST_NO_DESCRIPTORS
360protobuf_lazy_descriptor_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
361protobuf_lazy_descriptor_test_SOURCES =                        \
362  google/protobuf/compiler/cpp/cpp_unittest.cc                 \
363  $(COMMON_TEST_SOURCES)
364nodist_protobuf_lazy_descriptor_test_SOURCES = $(protoc_outputs)
365
366# Build lite_unittest separately, since it doesn't use gtest.
367protobuf_lite_test_LDADD = $(PTHREAD_LIBS) libprotobuf-lite.la
368protobuf_lite_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
369protobuf_lite_test_SOURCES =                                           \
370  google/protobuf/lite_unittest.cc                                     \
371  google/protobuf/test_util_lite.cc                                    \
372  google/protobuf/test_util_lite.h
373nodist_protobuf_lite_test_SOURCES = $(protoc_lite_outputs)
374
375# Test plugin binary.
376test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
377                    $(top_builddir)/gtest/lib/libgtest.la
378test_plugin_CPPFLAGS = -I$(top_srcdir)/gtest/include         \
379                       -I$(top_builddir)/gtest/include
380test_plugin_SOURCES =                                          \
381  google/protobuf/compiler/mock_code_generator.cc              \
382  google/protobuf/testing/file.cc                              \
383  google/protobuf/testing/file.h                               \
384  google/protobuf/compiler/test_plugin.cc
385
386if HAVE_ZLIB
387zcgzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la
388zcgzip_SOURCES = google/protobuf/testing/zcgzip.cc
389
390zcgunzip_LDADD = $(PTHREAD_LIBS) libprotobuf.la
391zcgunzip_SOURCES = google/protobuf/testing/zcgunzip.cc
392endif
393
394TESTS = protobuf-test protobuf-lazy-descriptor-test protobuf-lite-test \
395        google/protobuf/compiler/zip_output_unittest.sh $(GZTESTS)
396