From f58b9ef68124134eb8ed122a6087c2ef14bb22c0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 15 Jan 2015 09:09:12 -0800 Subject: [PATCH] Remove protoc_plugins, and use a variable. Files that have dependencies on phony targets are always remade, leading to much unnecessary compiling of the C++ tests. --- Makefile | 17 ++++++++--------- templates/Makefile.template | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 4a7321b82a4..93a65829916 100644 --- a/Makefile +++ b/Makefile @@ -202,6 +202,7 @@ endif .SECONDARY = %.pb.h %.pb.cc +PROTOC_PLUGINS= bins/$(CONFIG)/cpp_plugin bins/$(CONFIG)/ruby_plugin ifeq ($(DEP_MISSING),) all: static shared dep_error: @@ -901,8 +902,6 @@ test_cxx: buildtests_cxx tools: privatelibs bins/$(CONFIG)/gen_hpack_tables bins/$(CONFIG)/grpc_fetch_oauth2 -protoc_plugins: bins/$(CONFIG)/cpp_plugin bins/$(CONFIG)/ruby_plugin - buildbenchmarks: privatelibs bins/$(CONFIG)/grpc_completion_queue_benchmark bins/$(CONFIG)/low_level_ping_pong_benchmark benchmarks: buildbenchmarks @@ -937,37 +936,37 @@ strip-shared_cxx: shared_cxx $(E) "[STRIP] Stripping libgrpc++.so" $(Q) $(STRIP) libs/$(CONFIG)/libgrpc++.$(SHARED_EXT) -gens/test/cpp/interop/empty.pb.cc: test/cpp/interop/empty.proto protoc_plugins +gens/test/cpp/interop/empty.pb.cc: test/cpp/interop/empty.proto $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< -gens/test/cpp/interop/messages.pb.cc: test/cpp/interop/messages.proto protoc_plugins +gens/test/cpp/interop/messages.pb.cc: test/cpp/interop/messages.proto $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< -gens/test/cpp/interop/test.pb.cc: test/cpp/interop/test.proto protoc_plugins +gens/test/cpp/interop/test.pb.cc: test/cpp/interop/test.proto $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< -gens/test/cpp/qps/qpstest.pb.cc: test/cpp/qps/qpstest.proto protoc_plugins +gens/test/cpp/qps/qpstest.pb.cc: test/cpp/qps/qpstest.proto $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< -gens/test/cpp/util/echo.pb.cc: test/cpp/util/echo.proto protoc_plugins +gens/test/cpp/util/echo.pb.cc: test/cpp/util/echo.proto $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< -gens/test/cpp/util/echo_duplicate.pb.cc: test/cpp/util/echo_duplicate.proto protoc_plugins +gens/test/cpp/util/echo_duplicate.pb.cc: test/cpp/util/echo_duplicate.proto $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< -gens/test/cpp/util/messages.pb.cc: test/cpp/util/messages.proto protoc_plugins +gens/test/cpp/util/messages.pb.cc: test/cpp/util/messages.proto $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $< diff --git a/templates/Makefile.template b/templates/Makefile.template index bd49f5a24de..8cd3805a2e7 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -219,6 +219,13 @@ endif .SECONDARY = %.pb.h %.pb.cc +PROTOC_PLUGINS=\ +% for tgt in targets: +% if tgt.build == 'protoc': + bins/$(CONFIG)/${tgt.name}\ +% endif +% endfor + ifeq ($(DEP_MISSING),) all: static shared\ % for tgt in targets: @@ -394,14 +401,6 @@ tools: privatelibs\ % endfor -protoc_plugins:\ -% for tgt in targets: -% if tgt.build == 'protoc': - bins/$(CONFIG)/${tgt.name}\ -% endif -% endfor - - buildbenchmarks: privatelibs\ % for tgt in targets: % if tgt.build == 'benchmark': @@ -459,7 +458,7 @@ strip-shared_cxx: shared_cxx % endfor % for p in protos: -gens/${p}.pb.cc: ${p}.proto protoc_plugins +gens/${p}.pb.cc: ${p}.proto $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/$(CONFIG)/cpp_plugin $<