diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-02-18 17:42:12 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-02-18 17:42:12 -0800 |
commit | 45d26690bf1a2a50e08332cd991e6ed33f1be680 (patch) | |
tree | 9848fef6c55e9f2ab8142d6ab040aee629cf71f5 | |
parent | fb89ee38d5d464a48b9866d7c7941976a031e8fb (diff) | |
parent | 522d7122a8ac44adb4885782287ed73214b9f48d (diff) |
Merge pull request #600 from nicolasnoble/make-install
Polishing Makefile to better install targets.
-rw-r--r-- | INSTALL | 5 | ||||
-rw-r--r-- | Makefile | 68 | ||||
-rw-r--r-- | build.json | 4 | ||||
-rw-r--r-- | templates/Makefile.template | 70 |
4 files changed, 84 insertions, 63 deletions
@@ -23,6 +23,11 @@ Building the python wrapper requires the following: # apt-get install python-all-dev python-virtualenv +If you want to install in a different directory than the default /usr/lib, you can +override it on the command line: + + # make install prefix=/opt + ******************************* * More detailled instructions * @@ -332,9 +332,9 @@ endif .SECONDARY = %.pb.h %.pb.cc -PROTOC_PLUGINS= $(BINDIR)/$(CONFIG)/cpp_plugin $(BINDIR)/$(CONFIG)/ruby_plugin +PROTOC_PLUGINS = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin ifeq ($(DEP_MISSING),) -all: static shared +all: static shared plugins dep_error: @echo "You shouldn't see this message - all of your dependencies are correct." else @@ -498,7 +498,7 @@ timeout_encoding_test: $(BINDIR)/$(CONFIG)/timeout_encoding_test transport_metadata_test: $(BINDIR)/$(CONFIG)/transport_metadata_test async_end2end_test: $(BINDIR)/$(CONFIG)/async_end2end_test channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test -cpp_plugin: $(BINDIR)/$(CONFIG)/cpp_plugin +grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin credentials_test: $(BINDIR)/$(CONFIG)/credentials_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test interop_client: $(BINDIR)/$(CONFIG)/interop_client @@ -508,7 +508,7 @@ pubsub_publisher_test: $(BINDIR)/$(CONFIG)/pubsub_publisher_test pubsub_subscriber_test: $(BINDIR)/$(CONFIG)/pubsub_subscriber_test qps_client: $(BINDIR)/$(CONFIG)/qps_client qps_server: $(BINDIR)/$(CONFIG)/qps_server -ruby_plugin: $(BINDIR)/$(CONFIG)/ruby_plugin +grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin status_test: $(BINDIR)/$(CONFIG)/status_test thread_pool_test: $(BINDIR)/$(CONFIG)/thread_pool_test chttp2_fake_security_cancel_after_accept_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test @@ -905,6 +905,8 @@ shared_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) shared_csharp: shared_c $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) grpc_csharp_ext: shared_csharp +plugins: $(PROTOC_PLUGINS) + privatelibs: privatelibs_c privatelibs_cxx privatelibs_c: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags.a $(LIBDIR)/$(CONFIG)/libend2end_test_empty_batch.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_thread_stress.a $(LIBDIR)/$(CONFIG)/libend2end_test_writes_done_hangs_with_pending_read.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_thread_stress_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_writes_done_hangs_with_pending_read_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a @@ -1912,7 +1914,7 @@ $(OBJDIR)/$(CONFIG)/%.o : %.cc $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< -install: install_c install_cxx +install: install_c install_cxx install-protobuf install-plugins install_c: install-headers_c install-static_c install-shared_c @@ -1946,6 +1948,8 @@ install-static_cxx: static_cxx strip-static_cxx $(E) "[INSTALL] Installing libgrpc++.a" $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(prefix)/lib/libgrpc++.a + + install-shared_c: shared_c strip-shared_c ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing gpr.$(SHARED_EXT)" @@ -1986,7 +1990,8 @@ ifneq ($(SYSTEM),Darwin) endif endif -install-shared_cxx: shared_cxx strip-shared_cxx + +install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing grpc++.$(SHARED_EXT)" $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc++.$(SHARED_EXT) $(prefix)/lib/grpc++.$(SHARED_EXT) @@ -2004,6 +2009,7 @@ ifneq ($(SYSTEM),Darwin) endif endif + install-shared_csharp: shared_csharp strip-shared_csharp ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing grpc_csharp_ext.$(SHARED_EXT)" @@ -2022,7 +2028,29 @@ ifneq ($(SYSTEM),Darwin) endif endif + +install-protobuf: $(PROTOBUF_DEP) +ifneq ($(PROTOBUF_DEP),) + $(E) "[INSTALL] Installing embedded protobufs" + $(Q) $(MAKE) -C third_party/protobuf install prefix=$(prefix) +ifneq ($(SYSTEM),MINGW32) +ifneq ($(SYSTEM),Darwin) + $(Q) ldconfig +endif +endif +endif + +install-plugins: $(PROTOC_PLUGINS) +ifeq ($(SYSTEM),MINGW32) + $(Q) false +else + $(E) "[INSTALL] Installing grpc protoc plugins" + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(prefix)/bin/grpc_cpp_plugin + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin +endif + clean: + $(E) "[CLEAN] Cleaning build directories." $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) @@ -7350,35 +7378,35 @@ endif endif -CPP_PLUGIN_SRC = \ +GRPC_CPP_PLUGIN_SRC = \ src/compiler/cpp_generator.cc \ src/compiler/cpp_plugin.cc \ -CPP_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CPP_PLUGIN_SRC)))) +GRPC_CPP_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_CPP_PLUGIN_SRC)))) ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/cpp_plugin: protobuf_dep_error +$(BINDIR)/$(CONFIG)/grpc_cpp_plugin: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/cpp_plugin: $(PROTOBUF_DEP) $(CPP_PLUGIN_OBJS) +$(BINDIR)/$(CONFIG)/grpc_cpp_plugin: $(PROTOBUF_DEP) $(GRPC_CPP_PLUGIN_OBJS) $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(CPP_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/cpp_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_CPP_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_cpp_plugin endif $(OBJDIR)/$(CONFIG)/src/compiler/cpp_generator.o: $(OBJDIR)/$(CONFIG)/src/compiler/cpp_plugin.o: -deps_cpp_plugin: $(CPP_PLUGIN_OBJS:.o=.dep) +deps_grpc_cpp_plugin: $(GRPC_CPP_PLUGIN_OBJS:.o=.dep) ifneq ($(NO_DEPS),true) --include $(CPP_PLUGIN_OBJS:.o=.dep) +-include $(GRPC_CPP_PLUGIN_OBJS:.o=.dep) endif @@ -7677,35 +7705,35 @@ endif endif -RUBY_PLUGIN_SRC = \ +GRPC_RUBY_PLUGIN_SRC = \ src/compiler/ruby_generator.cc \ src/compiler/ruby_plugin.cc \ -RUBY_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(RUBY_PLUGIN_SRC)))) +GRPC_RUBY_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_RUBY_PLUGIN_SRC)))) ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/ruby_plugin: protobuf_dep_error +$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/ruby_plugin: $(PROTOBUF_DEP) $(RUBY_PLUGIN_OBJS) +$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: $(PROTOBUF_DEP) $(GRPC_RUBY_PLUGIN_OBJS) $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/ruby_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_ruby_plugin endif $(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o: $(OBJDIR)/$(CONFIG)/src/compiler/ruby_plugin.o: -deps_ruby_plugin: $(RUBY_PLUGIN_OBJS:.o=.dep) +deps_grpc_ruby_plugin: $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) ifneq ($(NO_DEPS),true) --include $(RUBY_PLUGIN_OBJS:.o=.dep) +-include $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) endif diff --git a/build.json b/build.json index c552228496..c7c640d2c2 100644 --- a/build.json +++ b/build.json @@ -1575,7 +1575,7 @@ ] }, { - "name": "cpp_plugin", + "name": "grpc_cpp_plugin", "build": "protoc", "language": "c++", "headers": [ @@ -1747,7 +1747,7 @@ ] }, { - "name": "ruby_plugin", + "name": "grpc_ruby_plugin", "build": "protoc", "language": "c++", "src": [ diff --git a/templates/Makefile.template b/templates/Makefile.template index 178ace6bcf..79ec95dd13 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -349,7 +349,7 @@ endif .SECONDARY = %.pb.h %.pb.cc -PROTOC_PLUGINS=\ +PROTOC_PLUGINS =\ % for tgt in targets: % if tgt.build == 'protoc': $(BINDIR)/$(CONFIG)/${tgt.name}\ @@ -357,7 +357,7 @@ PROTOC_PLUGINS=\ % endfor ifeq ($(DEP_MISSING),) -all: static shared\ +all: static shared plugins\ % for tgt in targets: % if tgt.build == 'all': $(BINDIR)/$(CONFIG)/${tgt.name}\ @@ -538,6 +538,8 @@ shared_csharp: shared_c \ grpc_csharp_ext: shared_csharp +plugins: $(PROTOC_PLUGINS) + privatelibs: privatelibs_c privatelibs_cxx privatelibs_c: \ @@ -716,7 +718,7 @@ $(OBJDIR)/$(CONFIG)/%.o : %.cc $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< -install: install_c install_cxx +install: install_c install_cxx install-protobuf install-plugins install_c: install-headers_c install-static_c install-shared_c @@ -758,9 +760,9 @@ install-static_cxx: static_cxx strip-static_cxx % endif % endfor -install-shared_c: shared_c strip-shared_c +<%def name="install_shared(lang_filter)">\ % for lib in libs: -% if lib.language == "c": +% if lib.language == lang_filter: % if lib.build == "all": ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" @@ -781,56 +783,42 @@ ifneq ($(SYSTEM),Darwin) $(Q) ldconfig endif endif +</%def> -install-shared_cxx: shared_cxx strip-shared_cxx -% for lib in libs: -% if lib.language == "c++": -% if lib.build == "all": -ifeq ($(SYSTEM),MINGW32) - $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a -else - $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) -ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so -endif -endif -% endif -% endif -% endfor +install-shared_c: shared_c strip-shared_c +${install_shared("c")} + +install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c +${install_shared("c++")} + +install-shared_csharp: shared_csharp strip-shared_csharp +${install_shared("csharp")} + +install-protobuf: $(PROTOBUF_DEP) +ifneq ($(PROTOBUF_DEP),) + $(E) "[INSTALL] Installing embedded protobufs" + $(Q) $(MAKE) -C third_party/protobuf install prefix=$(prefix) ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) $(Q) ldconfig endif endif +endif -install-shared_csharp: shared_csharp strip-shared_csharp -% for lib in libs: -% if lib.language == "csharp": -% if lib.build == "all": +install-plugins: $(PROTOC_PLUGINS) ifeq ($(SYSTEM),MINGW32) - $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a + $(Q) false else - $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) -ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so -endif -endif -% endif + $(E) "[INSTALL] Installing grpc protoc plugins" +% for tgt in targets: +% if tgt.build == 'protoc': + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name} % endif % endfor -ifneq ($(SYSTEM),MINGW32) -ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig -endif endif clean: + $(E) "[CLEAN] Cleaning build directories." $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) |