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