1
2benchmarks_protoc_inputs =                                     \
3  benchmarks.proto                                             \
4  benchmark_messages_proto3.proto
5
6benchmarks_protoc_inputs_proto2 =                              \
7  benchmark_messages_proto2.proto
8
9benchmarks_protoc_outputs =                                    \
10  benchmarks.pb.cc                                             \
11  benchmarks.pb.h                                              \
12  benchmark_messages_proto3.pb.cc                              \
13  benchmark_messages_proto3.pb.h
14
15benchmarks_protoc_outputs_proto2 =                             \
16  benchmark_messages_proto2.pb.cc                              \
17  benchmark_messages_proto2.pb.h
18
19bin_PROGRAMS = generate-datasets
20
21generate_datasets_LDADD = $(top_srcdir)/src/libprotobuf.la
22generate_datasets_SOURCES = generate_datasets.cc
23generate_datasets_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)
24nodist_generate_datasets_SOURCES =                             \
25  $(benchmarks_protoc_outputs)                                 \
26  $(benchmarks_protoc_outputs_proto2)
27
28# Explicit deps because BUILT_SOURCES are only done before a "make all/check"
29# so a direct "make test_cpp" could fail if parallel enough.
30# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually
31generate_datasets-generate_datasets.$(OBJEXT): benchmarks.pb.h
32
33$(benchmarks_protoc_outputs): protoc_middleman
34$(benchmarks_protoc_outputs_proto2): protoc_middleman2
35
36CLEANFILES =                                                   \
37  $(benchmarks_protoc_outputs)                                 \
38  $(benchmarks_protoc_outputs_proto2)                          \
39  protoc_middleman                                             \
40  protoc_middleman2                                            \
41  dataset.*
42
43MAINTAINERCLEANFILES =   \
44  Makefile.in
45
46if USE_EXTERNAL_PROTOC
47
48protoc_middleman: $(benchmarks_protoc_inputs)
49	$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. $(benchmarks_protoc_inputs)
50	touch protoc_middleman
51
52protoc_middleman2: $(benchmarks_protoc_inputs_proto2)
53	$(PROTOC) -I$(srcdir) -I$(top_srcdir) --cpp_out=. $(benchmarks_protoc_inputs_proto2)
54	touch protoc_middleman2
55
56else
57
58# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is
59# relative to srcdir, which may not be the same as the current directory when
60# building out-of-tree.
61protoc_middleman: $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs)
62	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd $(benchmarks_protoc_inputs) )
63	touch protoc_middleman
64
65protoc_middleman2: $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs_proto2) $(well_known_type_protoc_inputs)
66	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd $(benchmarks_protoc_inputs_proto2) )
67	touch protoc_middleman
68
69endif
70