• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1benchmarks_protoc_inputs_benchmark_wrapper =                               \
2	benchmarks.proto
3
4benchmarks_protoc_inputs =                                                 \
5	datasets/google_message1/proto3/benchmark_message1_proto3.proto
6
7benchmarks_protoc_inputs_proto2 =                                          \
8	datasets/google_message1/proto2/benchmark_message1_proto2.proto          \
9	datasets/google_message2/benchmark_message2.proto                        \
10	datasets/google_message3/benchmark_message3.proto                        \
11	datasets/google_message3/benchmark_message3_1.proto                      \
12	datasets/google_message3/benchmark_message3_2.proto                      \
13	datasets/google_message3/benchmark_message3_3.proto                      \
14	datasets/google_message3/benchmark_message3_4.proto                      \
15	datasets/google_message3/benchmark_message3_5.proto                      \
16	datasets/google_message3/benchmark_message3_6.proto                      \
17	datasets/google_message3/benchmark_message3_7.proto                      \
18	datasets/google_message3/benchmark_message3_8.proto                      \
19	datasets/google_message4/benchmark_message4.proto                        \
20	datasets/google_message4/benchmark_message4_1.proto                      \
21	datasets/google_message4/benchmark_message4_2.proto                      \
22	datasets/google_message4/benchmark_message4_3.proto
23
24make_tmp_dir:
25	mkdir -p 'tmp/java/src/main/java'
26	touch make_tmp_dir
27
28
29# We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is
30# relative to srcdir, which may not be the same as the current directory when
31# building out-of-tree.
32protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper)
33	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd/cpp --java_out=$$oldpwd/tmp/java/src/main/java --python_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) )
34	touch protoc_middleman
35
36protoc_middleman2:  make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs_proto2) $(well_known_type_protoc_inputs)
37	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --cpp_out=$$oldpwd/cpp --java_out=$$oldpwd/tmp/java/src/main/java --python_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2) )
38	touch protoc_middleman2
39
40all_data = $$(find $$(cd $(srcdir) && pwd) -type f -name "dataset.*.pb" -not -path "$$(cd $(srcdir) && pwd)/tmp/*")
41
42############# CPP RULES ##############
43
44benchmarks_protoc_outputs =                                                \
45	cpp/benchmarks.pb.cc                                                     \
46	cpp/datasets/google_message1/proto3/benchmark_message1_proto3.pb.cc
47
48benchmarks_protoc_outputs_header =                                         \
49	cpp/benchmarks.pb.h                                                      \
50	cpp/datasets/google_message1/proto3/benchmark_message1_proto3.pb.h
51
52benchmarks_protoc_outputs_proto2_header =                                  \
53	cpp/datasets/google_message1/proto2/benchmark_message1_proto2.pb.h       \
54	cpp/datasets/google_message2/benchmark_message2.pb.h                     \
55	cpp/datasets/google_message3/benchmark_message3.pb.h                     \
56	cpp/datasets/google_message3/benchmark_message3_1.pb.h                   \
57	cpp/datasets/google_message3/benchmark_message3_2.pb.h                   \
58	cpp/datasets/google_message3/benchmark_message3_3.pb.h                   \
59	cpp/datasets/google_message3/benchmark_message3_4.pb.h                   \
60	cpp/datasets/google_message3/benchmark_message3_5.pb.h                   \
61	cpp/datasets/google_message3/benchmark_message3_6.pb.h                   \
62	cpp/datasets/google_message3/benchmark_message3_7.pb.h                   \
63	cpp/datasets/google_message3/benchmark_message3_8.pb.h                   \
64	cpp/datasets/google_message4/benchmark_message4.pb.h                     \
65	cpp/datasets/google_message4/benchmark_message4_1.pb.h                   \
66	cpp/datasets/google_message4/benchmark_message4_2.pb.h                   \
67	cpp/datasets/google_message4/benchmark_message4_3.pb.h
68
69benchmarks_protoc_outputs_proto2 =                                         \
70	cpp/datasets/google_message1/proto2/benchmark_message1_proto2.pb.cc      \
71	cpp/datasets/google_message2/benchmark_message2.pb.cc                    \
72	cpp/datasets/google_message3/benchmark_message3.pb.cc                    \
73	cpp/datasets/google_message3/benchmark_message3_1.pb.cc                  \
74	cpp/datasets/google_message3/benchmark_message3_2.pb.cc                  \
75	cpp/datasets/google_message3/benchmark_message3_3.pb.cc                  \
76	cpp/datasets/google_message3/benchmark_message3_4.pb.cc                  \
77	cpp/datasets/google_message3/benchmark_message3_5.pb.cc                  \
78	cpp/datasets/google_message3/benchmark_message3_6.pb.cc                  \
79	cpp/datasets/google_message3/benchmark_message3_7.pb.cc                  \
80	cpp/datasets/google_message3/benchmark_message3_8.pb.cc                  \
81	cpp/datasets/google_message4/benchmark_message4.pb.cc                    \
82	cpp/datasets/google_message4/benchmark_message4_1.pb.cc                  \
83	cpp/datasets/google_message4/benchmark_message4_2.pb.cc                  \
84	cpp/datasets/google_message4/benchmark_message4_3.pb.cc
85
86
87$(benchmarks_protoc_outputs): protoc_middleman
88$(benchmarks_protoc_outputs_header): protoc_middleman
89$(benchmarks_protoc_outputs_proto2): protoc_middleman2
90$(benchmarks_protoc_outputs_proto2_header): protoc_middleman2
91
92initialize_submodule:
93	oldpwd=`pwd`
94	cd $(top_srcdir) && git submodule update --init -r third_party/benchmark && cd third_party/benchmark \
95	 && cmake -DCMAKE_BUILD_TYPE=Release && make
96	cd $$oldpwd
97	touch initialize_submodule
98
99$(top_srcdir)/third_party/benchmark/src/libbenchmark.a: initialize_submodule
100
101AM_CXXFLAGS = $(NO_OPT_CXXFLAGS) $(PROTOBUF_OPT_FLAG) -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare
102
103bin_PROGRAMS = cpp-benchmark
104
105cpp_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
106cpp_benchmark_SOURCES = cpp/cpp_benchmark.cc
107cpp_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(top_srcdir)/third_party/benchmark/include
108# Explicit deps because BUILT_SOURCES are only done before a "make all/check"
109# so a direct "make test_cpp" could fail if parallel enough.
110# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually
111cpp/cpp_benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
112cpp/benchmark-cpp_benchmark.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
113nodist_cpp_benchmark_SOURCES =                                             \
114	$(benchmarks_protoc_outputs)                                             \
115	$(benchmarks_protoc_outputs_proto2)                                      \
116	$(benchmarks_protoc_outputs_proto2_header)                               \
117	$(benchmarks_protoc_outputs_header)
118
119cpp: protoc_middleman protoc_middleman2 cpp-benchmark initialize_submodule
120	./cpp-benchmark $(all_data)
121
122############ CPP RULES END ############
123
124############# JAVA RULES ##############
125
126java_benchmark_testing_files =                                      \
127	java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java
128
129javac_middleman: $(java_benchmark_testing_files) protoc_middleman protoc_middleman2
130	cp -r $(srcdir)/java tmp
131	mkdir -p tmp/java/lib
132	cp $(top_srcdir)/java/core/target/*.jar tmp/java/lib/protobuf-java.jar
133	cd tmp/java && mvn clean compile assembly:single -Dprotobuf.version=$(PACKAGE_VERSION) && cd ../..
134	@touch javac_middleman
135
136java-benchmark: javac_middleman
137	@echo "Writing shortcut script java-benchmark..."
138	@echo '#! /bin/bash' > java-benchmark
139	@echo 'all_data=""' >> java-benchmark
140	@echo 'conf=()' >> java-benchmark
141	@echo 'data_files=""' >> java-benchmark
142	@echo 'for arg in $$@; do if [[ $${arg:0:1} == "-" ]]; then conf+=($$arg); else data_files+="$$arg,"; fi; done' >> java-benchmark
143	@echo 'java -cp '\"tmp/java/target/*:$(top_srcdir)/java/core/target/*:$(top_srcdir)/java/util/target/*\"" \\" >>java-benchmark
144	@echo '   com.google.caliper.runner.CaliperMain com.google.protobuf.ProtoCaliperBenchmark -i runtime '"\\"  >> java-benchmark
145	@echo '   -b serializeToByteArray,serializeToMemoryStream,deserializeFromByteArray,deserializeFromMemoryStream '"\\" >> java-benchmark
146	@echo '   -DdataFile=$${data_files:0:-1} $${conf[*]}' >> java-benchmark
147	@chmod +x java-benchmark
148
149java: protoc_middleman protoc_middleman2 java-benchmark
150	./java-benchmark $(all_data)
151
152############# JAVA RULES END ##############
153
154
155############# PYTHON RULES ##############
156
157python_add_init: protoc_middleman protoc_middleman2
158	all_file=`find tmp -type f -regex '.*\.py'` &&                   \
159	for file in $${all_file[@]}; do                                  \
160		path="$${file%/*}";                                            \
161		while true; do                                                 \
162			touch "$$path/__init__.py" && chmod +x "$$path/__init__.py"; \
163			if [[ $$path != *"/"* ]]; then break; fi;                    \
164			path=$${path%/*};                                            \
165		done                                                           \
166	done
167
168python_cpp_pkg_flags = `pkg-config --cflags --libs python3`
169
170lib_LTLIBRARIES = libbenchmark_messages.la
171libbenchmark_messages_la_SOURCES = python/python_benchmark_messages.cc
172libbenchmark_messages_la_LIBADD = $(top_srcdir)/src/.libs/libprotobuf.la
173libbenchmark_messages_la_LDFLAGS = -version-info 1:0:0 -export-dynamic
174libbenchmark_messages_la_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp $(python_cpp_pkg_flags)
175libbenchmark_messages_la-python_benchmark_messages.$(OBJEXT): $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header) $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2)
176nodist_libbenchmark_messages_la_SOURCES =                         \
177	$(benchmarks_protoc_outputs)                                    \
178	$(benchmarks_protoc_outputs_proto2)                             \
179	$(benchmarks_protoc_outputs_proto2_header)                      \
180	$(benchmarks_protoc_outputs_header)
181
182python-pure-python-benchmark: python_add_init
183	@echo "Writing shortcut script python-pure-python-benchmark..."
184	@echo '#! /bin/bash' > python-pure-python-benchmark
185	@echo export LD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-pure-python-benchmark
186	@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-pure-python-benchmark
187	@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'python\' >> python-pure-python-benchmark
188	@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-pure-python-benchmark
189	@echo python3 tmp/py_benchmark.py '$$@' >> python-pure-python-benchmark
190	@chmod +x python-pure-python-benchmark
191
192python-cpp-reflection-benchmark: python_add_init
193	@echo "Writing shortcut script python-cpp-reflection-benchmark..."
194	@echo '#! /bin/bash' > python-cpp-reflection-benchmark
195	@echo export LD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-reflection-benchmark
196	@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-reflection-benchmark
197	@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-reflection-benchmark
198	@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-reflection-benchmark
199	@echo python3 tmp/py_benchmark.py '$$@' >> python-cpp-reflection-benchmark
200	@chmod +x python-cpp-reflection-benchmark
201
202python-cpp-generated-code-benchmark: python_add_init libbenchmark_messages.la
203	@echo "Writing shortcut script python-cpp-generated-code-benchmark..."
204	@echo '#! /bin/bash' > python-cpp-generated-code-benchmark
205	@echo export LD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-generated-code-benchmark
206	@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-generated-code-benchmark
207	@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-generated-code-benchmark
208	@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-generated-code-benchmark
209	@echo python3 tmp/py_benchmark.py --cpp_generated '$$@' >> python-cpp-generated-code-benchmark
210	@chmod +x python-cpp-generated-code-benchmark
211
212python-pure-python: python-pure-python-benchmark
213	./python-pure-python-benchmark $(all_data)
214
215python-cpp-reflection: python-cpp-reflection-benchmark
216	./python-cpp-reflection-benchmark $(all_data)
217
218python-cpp-generated-code: python-cpp-generated-code-benchmark
219	./python-cpp-generated-code-benchmark $(all_data)
220
221############# PYTHON RULES END ##############
222
223############# GO RULES BEGIN ##############
224
225benchmarks_protoc_inputs_proto2_message1 =                                 \
226	datasets/google_message1/proto2/benchmark_message1_proto2.proto
227
228benchmarks_protoc_inputs_proto2_message2 =                                 \
229	datasets/google_message2/benchmark_message2.proto
230
231benchmarks_protoc_inputs_proto2_message3 =                                 \
232	datasets/google_message3/benchmark_message3.proto                        \
233	datasets/google_message3/benchmark_message3_1.proto                      \
234	datasets/google_message3/benchmark_message3_2.proto                      \
235	datasets/google_message3/benchmark_message3_3.proto                      \
236	datasets/google_message3/benchmark_message3_4.proto                      \
237	datasets/google_message3/benchmark_message3_5.proto                      \
238	datasets/google_message3/benchmark_message3_6.proto                      \
239	datasets/google_message3/benchmark_message3_7.proto                      \
240	datasets/google_message3/benchmark_message3_8.proto
241
242benchmarks_protoc_inputs_proto2_message4 =                                 \
243	datasets/google_message4/benchmark_message4.proto                        \
244	datasets/google_message4/benchmark_message4_1.proto                      \
245	datasets/google_message4/benchmark_message4_2.proto                      \
246	datasets/google_message4/benchmark_message4_3.proto
247
248go_protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks_protoc_inputs) $(well_known_type_protoc_inputs) $(benchmarks_protoc_inputs_proto2_message1) $(benchmarks_protoc_inputs_proto2_message2) $(benchmarks_protoc_inputs_proto2_message3) $(benchmarks_protoc_inputs_proto2_message4) $(well_known_type_protoc_inputs)
249	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs) )
250	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_benchmark_wrapper) )
251	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message1) )
252	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message2) )
253	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message3) )
254	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message4) )
255	touch go_protoc_middleman
256
257go-benchmark: go_protoc_middleman
258	@echo "Writing shortcut script go-benchmark..."
259	@echo '#! /bin/bash' > go-benchmark
260	@echo 'cd $(srcdir)/go' >> go-benchmark
261	@echo 'all_data=""' >> go-benchmark
262	@echo 'conf=()' >> go-benchmark
263	@echo 'data_files=()' >> go-benchmark
264	@echo 'for arg in $$@; do if [[ $${arg:0:1} == "-" ]]; then conf+=($$arg); else data_files+=("$$arg"); fi; done' >> go-benchmark
265	@echo 'go test -bench=. $${conf[*]} -- $${data_files[*]}' >> go-benchmark
266	@echo 'cd ..' >> go-benchmark
267	@chmod +x go-benchmark
268
269go: go_protoc_middleman go-benchmark
270	./go-benchmark $(all_data)
271
272############# GO RULES END ##############
273
274############# GOGO RULES BEGIN ############
275
276cpp_no_group_benchmarks_protoc_outputs_header =                             \
277	gogo/cpp_no_group/benchmarks.pb.h                                         \
278	gogo/cpp_no_group/datasets/google_message1/proto3/benchmark_message1_proto3.pb.h
279
280cpp_no_group_benchmarks_protoc_outputs =                                    \
281	gogo/cpp_no_group/benchmarks.pb.cc                                        \
282	gogo/cpp_no_group/datasets/google_message1/proto3/benchmark_message1_proto3.pb.cc
283
284cpp_no_group_benchmarks_protoc_outputs_proto2_header =                      \
285	gogo/cpp_no_group/datasets/google_message1/proto2/benchmark_message1_proto2.pb.h \
286	gogo/cpp_no_group/datasets/google_message2/benchmark_message2.pb.h        \
287	gogo/cpp_no_group/datasets/google_message3/benchmark_message3.pb.h        \
288	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_1.pb.h      \
289	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_2.pb.h      \
290	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_3.pb.h      \
291	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_4.pb.h      \
292	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_5.pb.h      \
293	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_6.pb.h      \
294	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_7.pb.h      \
295	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_8.pb.h      \
296	gogo/cpp_no_group/datasets/google_message4/benchmark_message4.pb.h        \
297	gogo/cpp_no_group/datasets/google_message4/benchmark_message4_1.pb.h      \
298	gogo/cpp_no_group/datasets/google_message4/benchmark_message4_2.pb.h      \
299	gogo/cpp_no_group/datasets/google_message4/benchmark_message4_3.pb.h
300
301cpp_no_group_benchmarks_protoc_outputs_proto2 =                             \
302	gogo/cpp_no_group/datasets/google_message1/proto2/benchmark_message1_proto2.pb.cc \
303	gogo/cpp_no_group/datasets/google_message2/benchmark_message2.pb.cc       \
304	gogo/cpp_no_group/datasets/google_message3/benchmark_message3.pb.cc       \
305	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_1.pb.cc     \
306	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_2.pb.cc     \
307	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_3.pb.cc     \
308	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_4.pb.cc     \
309	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_5.pb.cc     \
310	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_6.pb.cc     \
311	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_7.pb.cc     \
312	gogo/cpp_no_group/datasets/google_message3/benchmark_message3_8.pb.cc     \
313	gogo/cpp_no_group/datasets/google_message4/benchmark_message4.pb.cc       \
314	gogo/cpp_no_group/datasets/google_message4/benchmark_message4_1.pb.cc     \
315	gogo/cpp_no_group/datasets/google_message4/benchmark_message4_2.pb.cc     \
316	gogo/cpp_no_group/datasets/google_message4/benchmark_message4_3.pb.cc
317
318$(cpp_no_group_benchmarks_protoc_outputs): cpp_no_group_protoc_middleman
319$(cpp_no_group_benchmarks_protoc_outputs_header): cpp_no_group_protoc_middleman
320$(cpp_no_group_benchmarks_protoc_outputs_proto2): cpp_no_group_protoc_middleman
321$(cpp_no_group_benchmarks_protoc_outputs_proto2_header): cpp_no_group_protoc_middleman
322
323generate_cpp_no_group_benchmark_code:
324	cp $(srcdir)/cpp/cpp_benchmark.cc gogo/cpp_no_group/cpp_benchmark.cc
325	sed -i -e "s/\#include \"datasets/\#include \"gogo\/cpp_no_group\/datasets/g" gogo/cpp_no_group/cpp_benchmark.cc
326	sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc
327	touch generate_cpp_no_group_benchmark_code
328
329bin_PROGRAMS += cpp-no-group-benchmark
330cpp_no_group_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
331cpp_no_group_benchmark_SOURCES = gogo/cpp_no_group/cpp_benchmark.cc
332cpp_no_group_benchmark_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/gogo/cpp_no_group -I$(top_srcdir)/third_party/benchmark/include
333# Explicit deps because BUILT_SOURCES are only done before a "make all/check"
334# so a direct "make test_cpp" could fail if parallel enough.
335# See: https://www.gnu.org/software/automake/manual/html_node/Built-Sources-Example.html#Recording-Dependencies-manually
336gogo/cpp_no_group/cpp_no_group_benchmark-cpp_benchmark.$(OBJEXT): $(cpp_no_group_benchmarks_protoc_outputs) $(cpp_no_group_benchmarks_protoc_outputs_proto2) $(cpp_no_group_benchmarks_protoc_outputs_header) \
337	$(cpp_no_group_benchmarks_protoc_outputs_proto2_header) $(top_srcdir)/third_party/benchmark/src/libbenchmark.a generate_cpp_no_group_benchmark_code
338gogo/cpp_no_group/cpp_benchmark.cc: generate_cpp_no_group_benchmark_code
339nodist_cpp_no_group_benchmark_SOURCES =                                    \
340	$(cpp_no_group_benchmarks_protoc_outputs_proto2)                         \
341	$(cpp_no_group_benchmarks_protoc_outputs)                                \
342	$(cpp_no_group_benchmarks_protoc_outputs_header)                         \
343	$(cpp_no_group_benchmarks_protoc_outputs_proto2_header)
344
345cpp_no_group: cpp_no_group_protoc_middleman generate_gogo_data cpp-no-group-benchmark
346	./cpp-no-group-benchmark $(gogo_data)
347
348gogo_proto_middleman: protoc-gen-gogoproto
349	mkdir -p "tmp/gogo_proto"
350	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-gogoproto --gogoproto_out=$$oldpwd/tmp/gogo_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) )
351	touch gogo_proto_middleman
352
353gogo_data = $$(for data in $(all_data); do echo "tmp/gogo_data$${data\#$(srcdir)}"; done | xargs)
354
355generate_gogo_data: protoc_middleman protoc_middleman2 gogo-data-scrubber
356	mkdir -p `dirname $(gogo_data)`
357	./gogo-data-scrubber $(all_data) $(gogo_data)
358	touch generate_gogo_data
359
360make_tmp_dir_gogo:
361	mkdir -p tmp/go_no_group/benchmark_code
362	mkdir -p tmp/gogofast/benchmark_code
363	mkdir -p tmp/gogofaster/benchmark_code
364	mkdir -p tmp/gogoslick/benchmark_code
365	touch make_tmp_dir_gogo
366
367go_no_group_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
368	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs) )
369	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_benchmark_wrapper) )
370	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message1) )
371	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message2) )
372	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message3) )
373	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --go_out=$$oldpwd/tmp/go_no_group $(benchmarks_protoc_inputs_proto2_message4) )
374	touch go_no_group_protoc_middleman
375
376cpp_no_group_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
377	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs) )
378	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_benchmark_wrapper) )
379	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message1) )
380	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message2) )
381	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message3) )
382	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --cpp_out=$$oldpwd/gogo/cpp_no_group $(benchmarks_protoc_inputs_proto2_message4) )
383	touch cpp_no_group_protoc_middleman
384
385gogofast_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
386	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs) )
387	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_benchmark_wrapper) )
388	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message1) )
389	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message2) )
390	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message3) )
391	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofast_out=$$oldpwd/tmp/gogofast $(benchmarks_protoc_inputs_proto2_message4) )
392	touch gogofast_protoc_middleman
393
394gogofaster_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
395	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs) )
396	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_benchmark_wrapper) )
397	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message1) )
398	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message2) )
399	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message3) )
400	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogofaster_out=$$oldpwd/tmp/gogofaster $(benchmarks_protoc_inputs_proto2_message4) )
401	touch gogofaster_protoc_middleman
402
403gogoslick_protoc_middleman: make_tmp_dir_gogo $(top_srcdir)/src/protoc$(EXEEXT) gogo_proto_middleman $(well_known_type_protoc_inputs)
404	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs) )
405	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_benchmark_wrapper) )
406	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message1) )
407	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message2) )
408	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message3) )
409	oldpwd=`pwd` && ( cd $(srcdir)/tmp/gogo_proto && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$$oldpwd/$(top_srcdir)/src --gogoslick_out=$$oldpwd/tmp/gogoslick $(benchmarks_protoc_inputs_proto2_message4) )
410	touch gogoslick_protoc_middleman
411
412generate-gogo-benchmark-code:
413	@echo '#! /bin/bash' > generate-gogo-benchmark-code
414	@echo 'cp $(srcdir)/go/go_benchmark_test.go tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code
415	@echo 'sed -i -e "s/\.\.\/tmp/../g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code
416	@echo 'sed -i -e "s/b\.Run(\"\(.*\)\"/b.Run(\"\1\_$$1\"/g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go' >> generate-gogo-benchmark-code
417	@echo 'if [[ $$2 == 1 ]]; then sed -i -e "s/github\.com\/golang/github.com\/gogo/g" tmp/$$1/benchmark_code/$$1_benchmark1_test.go; fi ' >> generate-gogo-benchmark-code
418	@chmod +x generate-gogo-benchmark-code
419
420generate_all_gogo_benchmark_code: generate-gogo-benchmark-code make_tmp_dir_gogo
421	./generate-gogo-benchmark-code go_no_group 0
422	./generate-gogo-benchmark-code gogofast 1
423	./generate-gogo-benchmark-code gogofaster 1
424	./generate-gogo-benchmark-code gogoslick 1
425
426gogo-benchmark:
427	@echo "Writing shortcut script gogo-benchmark..."
428	@echo '#! /bin/bash' > gogo-benchmark
429	@echo 'cd tmp/$$1/benchmark_code' >> gogo-benchmark
430	@echo 'shift' >> gogo-benchmark
431	@echo 'all_data=""' >> gogo-benchmark
432	@echo 'for data_file in $$@; do all_data="$$all_data ../../../$$data_file"; done' >> gogo-benchmark
433	@echo 'go test -bench=. -- $$all_data' >> gogo-benchmark
434	@echo 'cd ../..' >> gogo-benchmark
435	@chmod +x gogo-benchmark
436
437go_no_group: go_no_group_protoc_middleman generate_gogo_data generate_all_gogo_benchmark_code gogo-benchmark
438	./gogo-benchmark go_no_group $(gogo_data)
439
440gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
441	./gogo-benchmark gogofast $(gogo_data)
442
443gogofaster: gogofaster_protoc_middleman  generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
444	./gogo-benchmark gogofaster $(gogo_data)
445
446gogoslick: gogoslick_protoc_middleman  generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
447	./gogo-benchmark gogoslick $(gogo_data)
448
449
450############# GOGO RULES END ############
451
452
453############ UTIL RULES BEGIN ############
454
455bin_PROGRAMS += protoc-gen-gogoproto gogo-data-scrubber protoc-gen-proto2_to_proto3 proto3-data-stripper
456
457protoc_gen_gogoproto_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/src/libprotoc.la
458protoc_gen_gogoproto_SOURCES = util/protoc-gen-gogoproto.cc
459protoc_gen_gogoproto_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util
460
461gogo_data_scrubber_LDADD = $(top_srcdir)/src/libprotobuf.la
462gogo_data_scrubber_SOURCES = util/gogo_data_scrubber.cc
463gogo_data_scrubber_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util
464util/gogo_data_scrubber-gogo_data_scrubber.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header)
465nodist_gogo_data_scrubber_SOURCES =                                        \
466	$(benchmarks_protoc_outputs)                                             \
467	$(benchmarks_protoc_outputs_proto2)                                      \
468	$(benchmarks_protoc_outputs_proto2_header)                               \
469	$(benchmarks_protoc_outputs_header)
470
471protoc_gen_proto2_to_proto3_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/src/libprotoc.la
472protoc_gen_proto2_to_proto3_SOURCES = util/protoc-gen-proto2_to_proto3.cc
473protoc_gen_proto2_to_proto3_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util
474
475proto3_data_stripper_LDADD = $(top_srcdir)/src/libprotobuf.la
476proto3_data_stripper_SOURCES = util/proto3_data_stripper.cc
477proto3_data_stripper_CPPFLAGS = -I$(top_srcdir)/src -I$(srcdir)/cpp -I$(srcdir)/util
478util/proto3_data_stripper-proto3_data_stripper.$(OBJEXT): $(benchmarks_protoc_outputs) $(benchmarks_protoc_outputs_proto2) $(benchmarks_protoc_outputs_header) $(benchmarks_protoc_outputs_proto2_header)
479nodist_proto3_data_stripper_SOURCES =                                      \
480	$(benchmarks_protoc_outputs)                                             \
481	$(benchmarks_protoc_outputs_proto2)                                      \
482	$(benchmarks_protoc_outputs_proto2_header)                               \
483	$(benchmarks_protoc_outputs_header)
484
485
486############ UTIL RULES END ############
487
488############ PROTO3 PREPARATION BEGIN #############
489
490proto3_proto_middleman: protoc-gen-proto2_to_proto3
491	mkdir -p "tmp/proto3_proto"
492	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-proto2_to_proto3 --proto2_to_proto3_out=$$oldpwd/tmp/proto3_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) )
493	touch proto3_proto_middleman
494
495full_srcdir = $$(cd $(srcdir) && pwd)
496proto3_data = $$(for data in $(all_data); do echo $(full_srcdir)"/tmp/proto3_data$${data\#$(full_srcdir)}"; done | xargs)
497
498generate_proto3_data: protoc_middleman protoc_middleman2 proto3-data-stripper
499	mkdir -p `dirname $(proto3_data)`
500	./proto3-data-stripper $(all_data) $(proto3_data)
501	touch generate_proto3_data
502
503############ PROTO3 PREPARATION END #############
504
505############ PHP RULES BEGIN #################
506
507proto3_middleman_php: proto3_proto_middleman
508	mkdir -p "tmp/php"
509	oldpwd=`pwd` && ( cd tmp/proto3_proto && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --php_out=$$oldpwd/tmp/php $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) )
510	touch proto3_middleman_php
511
512php-benchmark: proto3_middleman_php generate_proto3_data
513	mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark"
514	cp php/autoload.php "tmp/php"
515	@echo "Writing shortcut script php-benchmark..."
516	@echo '#! /bin/bash' > php-benchmark
517	@echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-benchmark
518	@echo 'cd tmp/php' >> php-benchmark
519	@echo 'export CURRENT_DIR=$$(pwd)' >> php-benchmark
520	@echo 'php -d auto_prepend_file="autoload.php" -d include_path="$$(pwd)" Google/Protobuf/Benchmark/PhpBenchmark.php $$@' >> php-benchmark
521	@echo 'cd ../..' >> php-benchmark
522	@chmod +x php-benchmark
523
524php: php-benchmark proto3_middleman_php
525	./php-benchmark --behavior_prefix="php" $(proto3_data)
526
527php_c_extension:
528	cd $(top_srcdir)/php/ext/google/protobuf && phpize && ./configure CFLAGS='-O3' && make -j8
529
530php-c-benchmark: proto3_middleman_php generate_proto3_data php_c_extension php_c_extension
531	mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark"
532	cp php/autoload.php "tmp/php"
533	@echo "Writing shortcut script php-c-benchmark..."
534	@echo '#! /bin/bash' > php-c-benchmark
535	@echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-c-benchmark
536	@echo 'export PROTOBUF_PHP_EXTDIR="$$PROTOBUF_PHP_SRCDIR/../ext/google/protobuf/modules"' >> php-c-benchmark
537	@echo 'cd tmp/php' >> php-c-benchmark
538	@echo 'export CURRENT_DIR=$$(pwd)' >> php-c-benchmark
539	@echo 'php -d auto_prepend_file="autoload.php" -d include_path="$$(pwd)" -d extension="$$PROTOBUF_PHP_EXTDIR/protobuf.so" Google/Protobuf/Benchmark/PhpBenchmark.php $$@' >> php-c-benchmark
540	@echo 'cd ../..' >> php-c-benchmark
541	@chmod +x php-c-benchmark
542
543php_c: php-c-benchmark proto3_middleman_php
544	./php-c-benchmark --behavior_prefix="php_c" $(proto3_data)
545
546
547############ PHP RULES END #################
548
549############ protobuf.js RULE BEGIN #############
550
551pbjs_preparation:
552	mkdir -p tmp/protobuf.js
553	cd tmp/protobuf.js && git clone https://github.com/dcodeIO/protobuf.js.git && \
554			cd protobuf.js && npm install && npm run build
555	cd tmp/protobuf.js && npm install benchmark
556	cp protobuf.js/* tmp/protobuf.js
557	cp js/benchmark_suite.js tmp/protobuf.js
558	touch pbjs_preparation
559
560pbjs_middleman: pbjs_preparation
561	export OLDDIR=$$(pwd) && cd tmp/protobuf.js && node generate_pbjs_files.js --target static-module --include_path=$$OLDDIR -o generated_bundle_code.js $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2)
562	touch pbjs_middleman
563
564pbjs-benchmark: pbjs_middleman
565	@echo '#! /bin/bash' > pbjs-benchmark
566	@echo 'cd tmp/protobuf.js' >> pbjs-benchmark
567	@echo 'sed -i "s/protobufjs/.\/protobuf.js/g" generated_bundle_code.js' >> pbjs-benchmark
568	@echo 'env NODE_PATH=".:./node_modules:$$NODE_PATH" node protobufjs_benchmark.js $$@' >> pbjs-benchmark
569	@chmod +x pbjs-benchmark
570
571pbjs: pbjs-benchmark
572	./pbjs-benchmark $(all_data)
573
574############ protobuf.js RULE END #############
575
576############ JS RULE BEGIN #############
577
578js_preparation:
579	mkdir -p tmp/js
580	oldpwd=$$(pwd) && cd $(top_srcdir)/js && npm install && npm test
581	cd tmp/js && npm install benchmark
582	cp js/* tmp/js
583	touch js_preparation
584
585js_middleman: js_preparation
586	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --js_out=import_style=commonjs,binary:$$oldpwd/tmp/js $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2))
587	touch js_middleman
588
589js-benchmark: js_middleman
590	@echo '#! /bin/bash' > js-benchmark
591	@echo 'export TOP_JS_SRCDIR=$$(cd $(top_srcdir)/js && pwd)' >> js-benchmark
592	@echo 'cd tmp/js' >> js-benchmark
593	@echo 'env NODE_PATH="$$TOP_JS_SRCDIR:.:./node_modules:$$NODE_PATH" node --max-old-space-size=4096 js_benchmark.js $$@' >> js-benchmark
594	@chmod +x js-benchmark
595
596js: js-benchmark
597	./js-benchmark $(all_data)
598
599############ JS RULE END #############
600
601EXTRA_DIST =									\
602	$(benchmarks_protoc_inputs_benchmark_wrapper)				\
603	$(benchmarks_protoc_inputs)						\
604	$(benchmarks_protoc_inputs_proto2)					\
605	google_size.proto
606
607MAINTAINERCLEANFILES =                                                     \
608	Makefile.in
609
610CLEANFILES =                                                               \
611	$(benchmarks_protoc_outputs)                                             \
612	$(benchmarks_protoc_outputs_header)                                      \
613	$(benchmarks_protoc_outputs_proto2)                                      \
614	$(benchmarks_protoc_outputs_proto2_header)                               \
615	initialize_submodule                                                     \
616	make_tmp_dir                                                             \
617	protoc_middleman                                                         \
618	protoc_middleman2                                                        \
619	javac_middleman                                                          \
620	java-benchmark                                                           \
621	python_cpp_proto_library                                                 \
622	python-pure-python-benchmark                                             \
623	python-cpp-reflection-benchmark                                          \
624	python-cpp-generated-code-benchmark                                      \
625	go-benchmark                                                             \
626	go_protoc_middleman                                                      \
627	make_tmp_dir_gogo                                                        \
628	gogo_proto_middleman                                                     \
629	generate_gogo_data                                                       \
630	go_no_group_protoc_middleman                                             \
631	go_no_group                                                              \
632	go-no-group-benchmark                                                    \
633	$(cpp_no_group_benchmarks_protoc_outputs_header)                         \
634	$(cpp_no_group_benchmarks_protoc_outputs)                                \
635	$(cpp_no_group_benchmarks_protoc_outputs_proto2_header)                  \
636	$(cpp_no_group_benchmarks_protoc_outputs_proto2)                         \
637	generate_all_gogo_benchmark_code                                         \
638	generate-gogo-benchmark-code                                             \
639	cpp_no_group_protoc_middleman                                            \
640	generate_cpp_no_group_benchmark_code                                     \
641	generate_gogo_benchmark_code                                             \
642	gogofast_protoc_middleman                                                \
643	gogofast                                                                 \
644	gogofaster_protoc_middleman                                              \
645	gogofaster                                                               \
646	gogoslick_protoc_middleman                                               \
647	gogoslick                                                                \
648	gogo-benchmark                                                           \
649	gogo/cpp_no_group/cpp_benchmark.*                                        \
650	proto3_proto_middleman                                                   \
651	generate_proto3_data                                                     \
652	php-benchmark                                                            \
653	php-c-benchmark                                                          \
654	proto3_middleman_php                                                     \
655	pbjs_preparation                                                         \
656	pbjs_middleman                                                           \
657	pbjs-benchmark                                                           \
658	js_preparation                                                           \
659	js_middleman                                                             \
660	js-benchmark
661
662clean-local:
663	-rm -rf tmp/*
664
665