Commit c337d9f9 authored by Feng Xiao's avatar Feng Xiao

Remove the use of BUILT_SOURCES

Fixes https://github.com/google/protobuf/issues/3912

[BUILT_SOURCES](https://www.gnu.org/software/automake/manual/html_node/Sources.html)
is used with [Automake's automatic dependency tracking](https://www.gnu.org/software/automake/manual/html_node/Dependencies.html#Dependencies)
but doesn't work well in protobuf when cross-compiling. Their presence
causes maek to always generate them even when they are not requested
and as a result causes cross-compilation to fail because the built protoc
cannot be used to generate unittest protos (see: https://github.com/google/protobuf/issues/3912).

Removing it with explicit dependencies fixes the build issue when running
'make', 'make all', 'make install' at cross-compilation. It doesn't affect
'make protoc' because BUILT_SOURCES only works for the implicit targets
'all', 'check' or 'install'.
parent 80e016e8
......@@ -722,8 +722,6 @@ protoc_outputs = \
google/protobuf/util/message_differencer_unittest.pb.cc \
google/protobuf/util/message_differencer_unittest.pb.h
BUILT_SOURCES = $(protoc_outputs) google/protobuf/compiler/js/well_known_types_embed.cc
if USE_EXTERNAL_PROTOC
unittest_proto_middleman: $(protoc_inputs)
......@@ -846,9 +844,8 @@ protobuf_test_SOURCES = \
google/protobuf/util/time_util_test.cc \
google/protobuf/util/type_resolver_util_test.cc \
$(COMMON_TEST_SOURCES)
nodist_protobuf_test_SOURCES = $(protoc_outputs)
$(am_protobuf_test_OBJECTS): unittest_proto_middleman
# Run cpp_unittest again with PROTOBUF_TEST_NO_DESCRIPTORS defined.
protobuf_lazy_descriptor_test_LDADD = $(PTHREAD_LIBS) libprotobuf.la \
......@@ -864,6 +861,7 @@ protobuf_lazy_descriptor_test_SOURCES = \
google/protobuf/compiler/cpp/cpp_unittest.cc \
$(COMMON_TEST_SOURCES)
nodist_protobuf_lazy_descriptor_test_SOURCES = $(protoc_outputs)
$(am_protobuf_lazy_descriptor_test_OBJECTS): unittest_proto_middleman
COMMON_LITE_TEST_SOURCES = \
google/protobuf/arena_test_util.cc \
......@@ -888,6 +886,7 @@ protobuf_lite_test_SOURCES = \
google/protobuf/lite_unittest.cc \
$(COMMON_LITE_TEST_SOURCES)
nodist_protobuf_lite_test_SOURCES = $(protoc_lite_outputs)
$(am_protobuf_lite_test_OBJECTS): unittest_proto_middleman
# lite_arena_unittest depends on gtest because teboring@ found that without
# gtest when building the test internally our memory sanitizer doesn't detect
......@@ -903,6 +902,7 @@ protobuf_lite_arena_test_SOURCES = \
google/protobuf/lite_arena_unittest.cc \
$(COMMON_LITE_TEST_SOURCES)
nodist_protobuf_lite_arena_test_SOURCES = $(protoc_lite_outputs)
$(am_protobuf_lite_arena_test_OBJECTS): unittest_proto_middleman
# Test plugin binary.
test_plugin_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment