diff --git a/INSTALL b/INSTALL index b7c1d46884eb1a1868f32d078b848e881fa3a9af..e3c05707db0400c99e8687c0c15864f9855b9838 100644 --- a/INSTALL +++ b/INSTALL @@ -14,10 +14,14 @@ A typical unix installation won't require any more steps than running: $ make # make install -You don't need anything else than GNU Make and gcc. Under a Debian or -Ubuntu system, this should boil down to the following package: +You don't need anything else than GNU Make, gcc and autotools. Under a Debian +or Ubuntu system, this should boil down to the following packages: - # apt-get install build-essential python-all-dev python-virtualenv + # apt-get install build-essential autoconf libtool + +Building the python wrapper requires the following: + + # apt-get install python-all-dev python-virtualenv ******************************* @@ -68,33 +72,23 @@ Compiling and running grpc plain-C tests dont't require any more dependency. Compiling and running grpc C++ tests depend on protobuf 3.0.0, gtest and -gflags. Although gflags and protobuf are provided in third_party, you will -need to manually install these dependencies on your system to run these tests. +gflags. Although gflags is provided in third_party, you will need to manually +install that dependency on your system to run these tests. Under a Debian or Ubuntu system, you can install the gtests and gflags packages using apt-get: # apt-get install libgflags-dev libgtest-dev -However, protobuf 3.0.0 isn't in a debian package yet: you'll need to compile -and install it from the sources in the third_party. Note that if you already -have the protobuf and protoc packages installed on your system, they will most -likely interfere, and you'll need to uninstall them first. +However, protobuf 3.0.0 isn't in a debian package yet, but the Makefile will +automatically try and compile the one present in third_party if you cloned the +repository recursively, and that it detects your system is lacking it. Compiling and installing protobuf 3.0.0 requires a few more dependencies in -itself, notably the autoconf suite, curl, and unzip. If you have apt-get, you -can install these dependencies this way: - - # apt-get install unzip curl autoconf libtool +itself, notably the autoconf suite. If you have apt-get, you can install +these dependencies this way: -Then, you can build and install protobuf 3.0.0: - - $ cd third_party/protobuf - $ ./autogen.sh - $ ./configure - $ make - # make install - # ldconfig + # apt-get install autoconf libtool A word on OpenSSL diff --git a/Makefile b/Makefile index 297c2004e9f7bae03d21b16e0bc1c552a3360e4b..4e226164600f3e821bb27d7ed708da3b7a8c5ffb 100644 --- a/Makefile +++ b/Makefile @@ -132,8 +132,6 @@ else LIBS = rt m z pthread LDFLAGS += -pthread endif -LIBSXX = protobuf -LIBS_PROTOC = protoc protobuf ifneq ($(wildcard /usr/src/gtest/src/gtest-all.cc),) GTEST_LIB = /usr/src/gtest/src/gtest-all.cc -I/usr/src/gtest @@ -157,7 +155,6 @@ CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) LDFLAGS += $(ARCH_FLAGS) LDLIBS += $(addprefix -l, $(LIBS)) LDLIBSXX += $(addprefix -l, $(LIBSXX)) -HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) HOST_CPPFLAGS = $(CPPFLAGS) HOST_CFLAGS = $(CFLAGS) @@ -188,6 +185,8 @@ endif OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/zlib.c -lz $(LDFLAGS) PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/perftools.c -lprofiler $(LDFLAGS) +PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o /dev/null test/build/protobuf.cc -lprotobuf $(LDFLAGS) +PROTOC_CHECK_CMD = protoc --version | grep -q libprotoc.3 ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_PERFTOOLS = $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || echo false) @@ -200,12 +199,16 @@ endif ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) +HAS_SYSTEM_PROTOBUF = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false) else # override system libraries if the config requires a custom compiled library HAS_SYSTEM_OPENSSL_ALPN = false HAS_SYSTEM_ZLIB = false +HAS_SYSTEM_PROTOBUF = false endif +HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false) + ifeq ($(wildcard third_party/openssl/ssl/ssl.h),) HAS_EMBEDDED_OPENSSL_ALPN = false else @@ -218,11 +221,20 @@ else HAS_EMBEDDED_ZLIB = true endif +ifeq ($(wildcard third_party/protobuf/src/google/protobuf/descriptor.pb.h),) +HAS_EMBEDDED_PROTOBUF = false +ifneq ($(HAS_VALID_PROTOC),true) +NO_PROTOC = true +endif +else +HAS_EMBEDDED_PROTOBUF = true +endif + ifeq ($(HAS_SYSTEM_ZLIB),false) ifeq ($(HAS_EMBEDDED_ZLIB),true) ZLIB_DEP = libs/$(CONFIG)/zlib/libz.a CPPFLAGS += -Ithird_party/zlib -LDFLAGS += -Lthird_party/zlib +LDFLAGS += -Llibs/$(CONFIG)/zlib else DEP_MISSING += zlib endif @@ -244,6 +256,24 @@ endif LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) +ifeq ($(HAS_SYSTEM_PROTOBUF),false) +ifeq ($(HAS_EMBEDDED_PROTOBUF),true) +PROTOBUF_DEP = libs/$(CONFIG)/protobuf/libprotobuf.a +CPPFLAGS += -Ithird_party/protobuf/src +LDFLAGS += -Llibs/$(CONFIG)/protobuf +PROTOC = bins/$(CONFIG)/protobuf/protoc +else +NO_PROTOBUF = true +endif +else +endif + +LIBS_PROTOBUF = protobuf +LIBS_PROTOC = protoc protobuf + +LDLIBS_PROTOBUF += $(addprefix -l, $(LIBS_PROTOBUF)) +HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) + ifeq ($(MAKECMDGOALS),clean) NO_DEPS = true endif @@ -287,6 +317,10 @@ endif openssl_dep_error: openssl_dep_message git_update stop +protobuf_dep_error: protobuf_dep_message git_update stop + +protoc_dep_error: protoc_dep_message git_update stop + openssl_dep_message: @echo @echo "DEPENDENCY ERROR" @@ -301,6 +335,34 @@ openssl_dep_message: @echo " make run_dep_checks" @echo +protobuf_dep_message: + @echo + @echo "DEPENDENCY ERROR" + @echo + @echo "The target you are trying to run requires protobuf 3.0.0+" + @echo "Your system doesn't have it, and neither does the third_party directory." + @echo + @echo "Please consult INSTALL to get more information." + @echo + @echo "If you need information about why these tests failed, run:" + @echo + @echo " make run_dep_checks" + @echo + +protoc_dep_message: + @echo + @echo "DEPENDENCY ERROR" + @echo + @echo "The target you are trying to run requires protobuf-compiler 3.0.0+" + @echo "Your system doesn't have it, and neither does the third_party directory." + @echo + @echo "Please consult INSTALL to get more information." + @echo + @echo "If you need information about why these tests failed, run:" + @echo + @echo " make run_dep_checks" + @echo + stop: @false @@ -688,6 +750,9 @@ chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_legacy run_dep_checks: $(OPENSSL_ALPN_CHECK_CMD) || true $(ZLIB_CHECK_CMD) || true + $(PERFTOOLS_CHECK_CMD) || true + $(PROTOBUF_CHECK_CMD) || true + $(PROTOC_CHECK_CMD) || true libs/$(CONFIG)/zlib/libz.a: $(E) "[MAKE] Building zlib" @@ -709,6 +774,21 @@ endif $(Q)mkdir -p libs/$(CONFIG)/openssl $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a libs/$(CONFIG)/openssl +third_party/protobuf/configure: + $(E) "[AUTOGEN] Preparing protobuf" + $(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete) + +libs/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure + $(E) "[MAKE] Building protobuf" + $(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g" CXXFLAGS="-DLANG_CXX11 -std=c++11" CPPFLAGS="$(CPPFLAGS_$(CONFIG)) -g" ./configure --disable-shared --enable-static) + $(Q)$(MAKE) -C third_party/protobuf clean + $(Q)$(MAKE) -C third_party/protobuf + $(Q)mkdir -p libs/$(CONFIG)/protobuf + $(Q)mkdir -p bins/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/.libs/libprotoc.a libs/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/.libs/libprotobuf.a libs/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/protoc bins/$(CONFIG)/protobuf + static: static_c static_cxx static_c: libs/$(CONFIG)/libgpr.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgrpc_csharp_ext.a libs/$(CONFIG)/libgrpc_unsecure.a @@ -1516,55 +1596,95 @@ ifeq ($(CONFIG),opt) $(Q) $(STRIP) libs/$(CONFIG)/libgrpc++.$(SHARED_EXT) endif -gens/examples/tips/empty.pb.cc: examples/tips/empty.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/examples/tips/empty.pb.cc: protoc_dep_error +else +gens/examples/tips/empty.pb.cc: examples/tips/empty.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/examples/tips/label.pb.cc: examples/tips/label.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/examples/tips/label.pb.cc: protoc_dep_error +else +gens/examples/tips/label.pb.cc: examples/tips/label.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/examples/tips/pubsub.pb.cc: examples/tips/pubsub.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/examples/tips/pubsub.pb.cc: protoc_dep_error +else +gens/examples/tips/pubsub.pb.cc: examples/tips/pubsub.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/test/cpp/interop/empty.pb.cc: test/cpp/interop/empty.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/test/cpp/interop/empty.pb.cc: protoc_dep_error +else +gens/test/cpp/interop/empty.pb.cc: test/cpp/interop/empty.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/test/cpp/interop/messages.pb.cc: test/cpp/interop/messages.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/test/cpp/interop/messages.pb.cc: protoc_dep_error +else +gens/test/cpp/interop/messages.pb.cc: test/cpp/interop/messages.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/test/cpp/interop/test.pb.cc: test/cpp/interop/test.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/test/cpp/interop/test.pb.cc: protoc_dep_error +else +gens/test/cpp/interop/test.pb.cc: test/cpp/interop/test.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/test/cpp/qps/qpstest.pb.cc: test/cpp/qps/qpstest.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/test/cpp/qps/qpstest.pb.cc: protoc_dep_error +else +gens/test/cpp/qps/qpstest.pb.cc: test/cpp/qps/qpstest.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/test/cpp/util/echo.pb.cc: test/cpp/util/echo.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/test/cpp/util/echo.pb.cc: protoc_dep_error +else +gens/test/cpp/util/echo.pb.cc: test/cpp/util/echo.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/test/cpp/util/echo_duplicate.pb.cc: test/cpp/util/echo_duplicate.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/test/cpp/util/echo_duplicate.pb.cc: protoc_dep_error +else +gens/test/cpp/util/echo_duplicate.pb.cc: test/cpp/util/echo_duplicate.proto $(PROTOBUF_DEP) $(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 $< +endif -gens/test/cpp/util/messages.pb.cc: test/cpp/util/messages.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/test/cpp/util/messages.pb.cc: protoc_dep_error +else +gens/test/cpp/util/messages.pb.cc: test/cpp/util/messages.proto $(PROTOBUF_DEP) $(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 $< +endif objs/$(CONFIG)/%.o : %.c @@ -1785,7 +1905,6 @@ else endif endif - ifneq ($(NO_DEPS),true) -include $(LIBGPR_OBJS:.o=.dep) endif @@ -1840,7 +1959,11 @@ libs/$(CONFIG)/libgpr_test_util.a: openssl_dep_error else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/util/test_config.c: $(OPENSSL_DEP) endif @@ -1856,7 +1979,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -2004,7 +2126,11 @@ endif else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. src/core/security/auth.c: $(OPENSSL_DEP) src/core/security/base64.c: $(OPENSSL_DEP) src/core/security/credentials.c: $(OPENSSL_DEP) @@ -2154,7 +2280,6 @@ else endif endif - endif ifneq ($(NO_SECURE),true) @@ -2296,7 +2421,11 @@ endif else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. src/csharp/ext/grpc_csharp_ext.c: $(OPENSSL_DEP) endif @@ -2329,7 +2458,6 @@ else endif endif - endif ifneq ($(NO_SECURE),true) @@ -2367,7 +2495,11 @@ libs/$(CONFIG)/libgrpc_test_util.a: openssl_dep_error else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/end2end/cq_verifier.c: $(OPENSSL_DEP) test/core/end2end/data/prod_roots_certs.c: $(OPENSSL_DEP) test/core/end2end/data/server1_cert.c: $(OPENSSL_DEP) @@ -2394,7 +2526,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -2554,7 +2685,6 @@ else endif endif - ifneq ($(NO_DEPS),true) -include $(LIBGRPC_UNSECURE_OBJS:.o=.dep) endif @@ -2718,7 +2848,24 @@ endif else +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +libs/$(CONFIG)/libgrpc++.a: protobuf_dep_error + +ifeq ($(SYSTEM),MINGW32) +libs/$(CONFIG)/grpc++.$(SHARED_EXT): protobuf_dep_error +else +libs/$(CONFIG)/libgrpc++.$(SHARED_EXT): protobuf_dep_error +endif + +else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. src/cpp/client/channel.cc: $(OPENSSL_DEP) src/cpp/client/channel_arguments.cc: $(OPENSSL_DEP) src/cpp/client/client_context.cc: $(OPENSSL_DEP) @@ -2741,7 +2888,7 @@ src/cpp/util/status.cc: $(OPENSSL_DEP) src/cpp/util/time.cc: $(OPENSSL_DEP) endif -libs/$(CONFIG)/libgrpc++.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIBGRPC++_OBJS) +libs/$(CONFIG)/libgrpc++.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f libs/$(CONFIG)/libgrpc++.a @@ -2770,6 +2917,7 @@ else endif endif +endif endif @@ -2818,9 +2966,21 @@ ifeq ($(NO_SECURE),true) libs/$(CONFIG)/libgrpc++_test_util.a: openssl_dep_error +else + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +libs/$(CONFIG)/libgrpc++_test_util.a: protobuf_dep_error + + else ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/cpp/util/messages.proto: $(OPENSSL_DEP) test/cpp/util/echo.proto: $(OPENSSL_DEP) test/cpp/util/echo_duplicate.proto: $(OPENSSL_DEP) @@ -2828,7 +2988,7 @@ test/cpp/end2end/async_test_server.cc: $(OPENSSL_DEP) test/cpp/util/create_test_channel.cc: $(OPENSSL_DEP) endif -libs/$(CONFIG)/libgrpc++_test_util.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIBGRPC++_TEST_UTIL_OBJS) +libs/$(CONFIG)/libgrpc++_test_util.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(PROTOBUF_DEP) $(LIBGRPC++_TEST_UTIL_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f libs/$(CONFIG)/libgrpc++_test_util.a @@ -2840,6 +3000,7 @@ endif +endif endif @@ -2873,9 +3034,21 @@ ifeq ($(NO_SECURE),true) libs/$(CONFIG)/libtips_client_lib.a: openssl_dep_error +else + +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +libs/$(CONFIG)/libtips_client_lib.a: protobuf_dep_error + + else ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. examples/tips/label.proto: $(OPENSSL_DEP) examples/tips/empty.proto: $(OPENSSL_DEP) examples/tips/pubsub.proto: $(OPENSSL_DEP) @@ -2883,7 +3056,7 @@ examples/tips/publisher.cc: $(OPENSSL_DEP) examples/tips/subscriber.cc: $(OPENSSL_DEP) endif -libs/$(CONFIG)/libtips_client_lib.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIBTIPS_CLIENT_LIB_OBJS) +libs/$(CONFIG)/libtips_client_lib.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(PROTOBUF_DEP) $(LIBTIPS_CLIENT_LIB_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f libs/$(CONFIG)/libtips_client_lib.a @@ -2895,6 +3068,7 @@ endif +endif endif @@ -2926,7 +3100,11 @@ libs/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a: openssl_dep_error else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/end2end/fixtures/chttp2_fake_security.c: $(OPENSSL_DEP) endif @@ -2942,7 +3120,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -2969,7 +3146,11 @@ libs/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a: openssl_dep_error else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/end2end/fixtures/chttp2_fullstack.c: $(OPENSSL_DEP) endif @@ -2985,7 +3166,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -3012,7 +3192,11 @@ libs/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a: openssl_dep_err else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c: $(OPENSSL_DEP) endif @@ -3028,7 +3212,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -3055,7 +3238,11 @@ libs/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a: ope else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c: $(OPENSSL_DEP) endif @@ -3071,7 +3258,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -3098,7 +3284,11 @@ libs/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a: openssl_dep_error else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/end2end/fixtures/chttp2_socket_pair.c: $(OPENSSL_DEP) endif @@ -3114,7 +3304,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -3141,7 +3330,11 @@ libs/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a: opens else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c: $(OPENSSL_DEP) endif @@ -3157,7 +3350,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -3187,7 +3379,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_AFTER_ACCEPT_OBJS:.o=.dep) endif @@ -3213,7 +3404,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_AFTER_ACCEPT_AND_WRITES_CLOSED_OBJS:.o=.dep) endif @@ -3239,7 +3429,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_AFTER_INVOKE_OBJS:.o=.dep) endif @@ -3265,7 +3454,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_BEFORE_INVOKE_OBJS:.o=.dep) endif @@ -3291,7 +3479,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_IN_A_VACUUM_OBJS:.o=.dep) endif @@ -3317,7 +3504,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CENSUS_SIMPLE_REQUEST_OBJS:.o=.dep) endif @@ -3343,7 +3529,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_DISAPPEARING_SERVER_OBJS:.o=.dep) endif @@ -3369,7 +3554,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_EARLY_SERVER_SHUTDOWN_FINISHES_INFLIGHT_CALLS_OBJS:.o=.dep) endif @@ -3395,7 +3579,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_EARLY_SERVER_SHUTDOWN_FINISHES_TAGS_OBJS:.o=.dep) endif @@ -3447,7 +3630,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_GRACEFUL_SERVER_SHUTDOWN_OBJS:.o=.dep) endif @@ -3473,7 +3655,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_INVOKE_LARGE_REQUEST_OBJS:.o=.dep) endif @@ -3499,7 +3680,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_MAX_CONCURRENT_STREAMS_OBJS:.o=.dep) endif @@ -3525,7 +3705,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_NO_OP_OBJS:.o=.dep) endif @@ -3551,7 +3730,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_PING_PONG_STREAMING_OBJS:.o=.dep) endif @@ -3577,7 +3755,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_BINARY_METADATA_AND_PAYLOAD_OBJS:.o=.dep) endif @@ -3603,7 +3780,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_METADATA_AND_PAYLOAD_OBJS:.o=.dep) endif @@ -3629,7 +3805,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_PAYLOAD_OBJS:.o=.dep) endif @@ -3655,7 +3830,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_WITH_LARGE_METADATA_OBJS:.o=.dep) endif @@ -3681,7 +3855,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_WITH_PAYLOAD_OBJS:.o=.dep) endif @@ -3707,7 +3880,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_SIMPLE_DELAYED_REQUEST_OBJS:.o=.dep) endif @@ -3733,7 +3905,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_SIMPLE_REQUEST_OBJS:.o=.dep) endif @@ -3759,7 +3930,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_THREAD_STRESS_OBJS:.o=.dep) endif @@ -3785,7 +3955,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_WRITES_DONE_HANGS_WITH_PENDING_READ_OBJS:.o=.dep) endif @@ -3811,7 +3980,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_AFTER_ACCEPT_LEGACY_OBJS:.o=.dep) endif @@ -3837,7 +4005,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_AFTER_ACCEPT_AND_WRITES_CLOSED_LEGACY_OBJS:.o=.dep) endif @@ -3863,7 +4030,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_AFTER_INVOKE_LEGACY_OBJS:.o=.dep) endif @@ -3889,7 +4055,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_BEFORE_INVOKE_LEGACY_OBJS:.o=.dep) endif @@ -3915,7 +4080,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CANCEL_IN_A_VACUUM_LEGACY_OBJS:.o=.dep) endif @@ -3941,7 +4105,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_CENSUS_SIMPLE_REQUEST_LEGACY_OBJS:.o=.dep) endif @@ -3967,7 +4130,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_DISAPPEARING_SERVER_LEGACY_OBJS:.o=.dep) endif @@ -3993,7 +4155,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_EARLY_SERVER_SHUTDOWN_FINISHES_INFLIGHT_CALLS_LEGACY_OBJS:.o=.dep) endif @@ -4019,7 +4180,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_EARLY_SERVER_SHUTDOWN_FINISHES_TAGS_LEGACY_OBJS:.o=.dep) endif @@ -4045,7 +4205,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_GRACEFUL_SERVER_SHUTDOWN_LEGACY_OBJS:.o=.dep) endif @@ -4071,7 +4230,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_INVOKE_LARGE_REQUEST_LEGACY_OBJS:.o=.dep) endif @@ -4097,7 +4255,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_MAX_CONCURRENT_STREAMS_LEGACY_OBJS:.o=.dep) endif @@ -4123,7 +4280,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_NO_OP_LEGACY_OBJS:.o=.dep) endif @@ -4149,7 +4305,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_PING_PONG_STREAMING_LEGACY_OBJS:.o=.dep) endif @@ -4175,7 +4330,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_BINARY_METADATA_AND_PAYLOAD_LEGACY_OBJS:.o=.dep) endif @@ -4201,7 +4355,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_METADATA_AND_PAYLOAD_LEGACY_OBJS:.o=.dep) endif @@ -4227,7 +4380,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_PAYLOAD_LEGACY_OBJS:.o=.dep) endif @@ -4253,7 +4405,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_TRAILING_METADATA_AND_PAYLOAD_LEGACY_OBJS:.o=.dep) endif @@ -4279,7 +4430,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_WITH_LARGE_METADATA_LEGACY_OBJS:.o=.dep) endif @@ -4305,7 +4455,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_REQUEST_WITH_PAYLOAD_LEGACY_OBJS:.o=.dep) endif @@ -4331,7 +4480,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_SIMPLE_DELAYED_REQUEST_LEGACY_OBJS:.o=.dep) endif @@ -4357,7 +4505,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_SIMPLE_REQUEST_LEGACY_OBJS:.o=.dep) endif @@ -4383,7 +4530,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_THREAD_STRESS_LEGACY_OBJS:.o=.dep) endif @@ -4409,7 +4555,6 @@ endif - ifneq ($(NO_DEPS),true) -include $(LIBEND2END_TEST_WRITES_DONE_HANGS_WITH_PENDING_READ_LEGACY_OBJS:.o=.dep) endif @@ -4435,7 +4580,11 @@ libs/$(CONFIG)/libend2end_certs.a: openssl_dep_error else + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. test/core/end2end/data/test_root_cert.c: $(OPENSSL_DEP) test/core/end2end/data/prod_roots_certs.c: $(OPENSSL_DEP) test/core/end2end/data/server1_cert.c: $(OPENSSL_DEP) @@ -4454,7 +4603,6 @@ endif - endif ifneq ($(NO_SECURE),true) @@ -6876,7 +7024,7 @@ else bins/$(CONFIG)/channel_arguments_test: $(CHANNEL_ARGUMENTS_TEST_OBJS) libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(CHANNEL_ARGUMENTS_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/channel_arguments_test + $(Q) $(LDXX) $(LDFLAGS) $(CHANNEL_ARGUMENTS_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/channel_arguments_test endif @@ -6897,10 +7045,21 @@ CPP_PLUGIN_SRC = \ CPP_PLUGIN_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(CPP_PLUGIN_SRC)))) -bins/$(CONFIG)/cpp_plugin: $(CPP_PLUGIN_OBJS) + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins if you don't have protobuf 3.0.0+. + +bins/$(CONFIG)/cpp_plugin: protobuf_dep_error + +else + +bins/$(CONFIG)/cpp_plugin: $(PROTOBUF_DEP) $(CPP_PLUGIN_OBJS) $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(CPP_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o bins/$(CONFIG)/cpp_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(CPP_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o bins/$(CONFIG)/cpp_plugin + +endif objs/$(CONFIG)/src/compiler/cpp_generator.o: objs/$(CONFIG)/src/compiler/cpp_plugin.o: @@ -6928,7 +7087,7 @@ else bins/$(CONFIG)/credentials_test: $(CREDENTIALS_TEST_OBJS) libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(CREDENTIALS_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/credentials_test + $(Q) $(LDXX) $(LDFLAGS) $(CREDENTIALS_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/credentials_test endif @@ -6959,7 +7118,7 @@ else bins/$(CONFIG)/end2end_test: $(END2END_TEST_OBJS) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(END2END_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/end2end_test + $(Q) $(LDXX) $(LDFLAGS) $(END2END_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/end2end_test endif @@ -6993,7 +7152,7 @@ else bins/$(CONFIG)/interop_client: $(INTEROP_CLIENT_OBJS) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(INTEROP_CLIENT_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/interop_client + $(Q) $(LDXX) $(LDFLAGS) $(INTEROP_CLIENT_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/interop_client endif @@ -7030,7 +7189,7 @@ else bins/$(CONFIG)/interop_server: $(INTEROP_SERVER_OBJS) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(INTEROP_SERVER_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/interop_server + $(Q) $(LDXX) $(LDFLAGS) $(INTEROP_SERVER_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/interop_server endif @@ -7065,7 +7224,7 @@ else bins/$(CONFIG)/qps_client: $(QPS_CLIENT_OBJS) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(QPS_CLIENT_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/qps_client + $(Q) $(LDXX) $(LDFLAGS) $(QPS_CLIENT_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/qps_client endif @@ -7098,7 +7257,7 @@ else bins/$(CONFIG)/qps_server: $(QPS_SERVER_OBJS) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(QPS_SERVER_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/qps_server + $(Q) $(LDXX) $(LDFLAGS) $(QPS_SERVER_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/qps_server endif @@ -7120,10 +7279,21 @@ RUBY_PLUGIN_SRC = \ RUBY_PLUGIN_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(RUBY_PLUGIN_SRC)))) -bins/$(CONFIG)/ruby_plugin: $(RUBY_PLUGIN_OBJS) + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins if you don't have protobuf 3.0.0+. + +bins/$(CONFIG)/ruby_plugin: protobuf_dep_error + +else + +bins/$(CONFIG)/ruby_plugin: $(PROTOBUF_DEP) $(RUBY_PLUGIN_OBJS) $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o bins/$(CONFIG)/ruby_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o bins/$(CONFIG)/ruby_plugin + +endif objs/$(CONFIG)/src/compiler/ruby_generator.o: objs/$(CONFIG)/src/compiler/ruby_plugin.o: @@ -7151,7 +7321,7 @@ else bins/$(CONFIG)/status_test: $(STATUS_TEST_OBJS) libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(STATUS_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/status_test + $(Q) $(LDXX) $(LDFLAGS) $(STATUS_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/status_test endif @@ -7182,7 +7352,7 @@ else bins/$(CONFIG)/sync_client_async_server_test: $(SYNC_CLIENT_ASYNC_SERVER_TEST_OBJS) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(SYNC_CLIENT_ASYNC_SERVER_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/sync_client_async_server_test + $(Q) $(LDXX) $(LDFLAGS) $(SYNC_CLIENT_ASYNC_SERVER_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/sync_client_async_server_test endif @@ -7213,7 +7383,7 @@ else bins/$(CONFIG)/thread_pool_test: $(THREAD_POOL_TEST_OBJS) libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(THREAD_POOL_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/thread_pool_test + $(Q) $(LDXX) $(LDFLAGS) $(THREAD_POOL_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/thread_pool_test endif @@ -7244,7 +7414,7 @@ else bins/$(CONFIG)/tips_client: $(TIPS_CLIENT_OBJS) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(TIPS_CLIENT_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/tips_client + $(Q) $(LDXX) $(LDFLAGS) $(TIPS_CLIENT_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/tips_client endif @@ -7275,7 +7445,7 @@ else bins/$(CONFIG)/tips_publisher_test: $(TIPS_PUBLISHER_TEST_OBJS) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(TIPS_PUBLISHER_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/tips_publisher_test + $(Q) $(LDXX) $(LDFLAGS) $(TIPS_PUBLISHER_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/tips_publisher_test endif @@ -7306,7 +7476,7 @@ else bins/$(CONFIG)/tips_subscriber_test: $(TIPS_SUBSCRIBER_TEST_OBJS) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(TIPS_SUBSCRIBER_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/tips_subscriber_test + $(Q) $(LDXX) $(LDFLAGS) $(TIPS_SUBSCRIBER_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libtips_client_lib.a libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/tips_subscriber_test endif diff --git a/templates/Makefile.template b/templates/Makefile.template index c34949cf2a7a2d48dff50caea2920823f5634eae..c5e6d0afaf39681888c990c722bac901c7fc3d69 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -149,8 +149,6 @@ else LIBS = rt m z pthread LDFLAGS += -pthread endif -LIBSXX = protobuf -LIBS_PROTOC = protoc protobuf ifneq ($(wildcard /usr/src/gtest/src/gtest-all.cc),) GTEST_LIB = /usr/src/gtest/src/gtest-all.cc -I/usr/src/gtest @@ -174,7 +172,6 @@ CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) LDFLAGS += $(ARCH_FLAGS) LDLIBS += $(addprefix -l, $(LIBS)) LDLIBSXX += $(addprefix -l, $(LIBSXX)) -HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) HOST_CPPFLAGS = $(CPPFLAGS) HOST_CFLAGS = $(CFLAGS) @@ -205,6 +202,8 @@ endif OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/openssl-alpn.c -lssl -lcrypto -ldl $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/zlib.c -lz $(LDFLAGS) PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/perftools.c -lprofiler $(LDFLAGS) +PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o /dev/null test/build/protobuf.cc -lprotobuf $(LDFLAGS) +PROTOC_CHECK_CMD = protoc --version | grep -q libprotoc.3 ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_PERFTOOLS = $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || echo false) @@ -217,12 +216,16 @@ endif ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) +HAS_SYSTEM_PROTOBUF = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false) else # override system libraries if the config requires a custom compiled library HAS_SYSTEM_OPENSSL_ALPN = false HAS_SYSTEM_ZLIB = false +HAS_SYSTEM_PROTOBUF = false endif +HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false) + ifeq ($(wildcard third_party/openssl/ssl/ssl.h),) HAS_EMBEDDED_OPENSSL_ALPN = false else @@ -235,11 +238,20 @@ else HAS_EMBEDDED_ZLIB = true endif +ifeq ($(wildcard third_party/protobuf/src/google/protobuf/descriptor.pb.h),) +HAS_EMBEDDED_PROTOBUF = false +ifneq ($(HAS_VALID_PROTOC),true) +NO_PROTOC = true +endif +else +HAS_EMBEDDED_PROTOBUF = true +endif + ifeq ($(HAS_SYSTEM_ZLIB),false) ifeq ($(HAS_EMBEDDED_ZLIB),true) ZLIB_DEP = libs/$(CONFIG)/zlib/libz.a CPPFLAGS += -Ithird_party/zlib -LDFLAGS += -Lthird_party/zlib +LDFLAGS += -Llibs/$(CONFIG)/zlib else DEP_MISSING += zlib endif @@ -261,6 +273,24 @@ endif LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) +ifeq ($(HAS_SYSTEM_PROTOBUF),false) +ifeq ($(HAS_EMBEDDED_PROTOBUF),true) +PROTOBUF_DEP = libs/$(CONFIG)/protobuf/libprotobuf.a +CPPFLAGS += -Ithird_party/protobuf/src +LDFLAGS += -Llibs/$(CONFIG)/protobuf +PROTOC = bins/$(CONFIG)/protobuf/protoc +else +NO_PROTOBUF = true +endif +else +endif + +LIBS_PROTOBUF = protobuf +LIBS_PROTOC = protoc protobuf + +LDLIBS_PROTOBUF += $(addprefix -l, $(LIBS_PROTOBUF)) +HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) + ifeq ($(MAKECMDGOALS),clean) NO_DEPS = true endif @@ -316,6 +346,10 @@ endif openssl_dep_error: openssl_dep_message git_update stop +protobuf_dep_error: protobuf_dep_message git_update stop + +protoc_dep_error: protoc_dep_message git_update stop + openssl_dep_message: @echo @echo "DEPENDENCY ERROR" @@ -330,6 +364,34 @@ openssl_dep_message: @echo " make run_dep_checks" @echo +protobuf_dep_message: + @echo + @echo "DEPENDENCY ERROR" + @echo + @echo "The target you are trying to run requires protobuf 3.0.0+" + @echo "Your system doesn't have it, and neither does the third_party directory." + @echo + @echo "Please consult INSTALL to get more information." + @echo + @echo "If you need information about why these tests failed, run:" + @echo + @echo " make run_dep_checks" + @echo + +protoc_dep_message: + @echo + @echo "DEPENDENCY ERROR" + @echo + @echo "The target you are trying to run requires protobuf-compiler 3.0.0+" + @echo "Your system doesn't have it, and neither does the third_party directory." + @echo + @echo "Please consult INSTALL to get more information." + @echo + @echo "If you need information about why these tests failed, run:" + @echo + @echo " make run_dep_checks" + @echo + stop: @false @@ -340,6 +402,9 @@ ${tgt.name}: bins/$(CONFIG)/${tgt.name} run_dep_checks: $(OPENSSL_ALPN_CHECK_CMD) || true $(ZLIB_CHECK_CMD) || true + $(PERFTOOLS_CHECK_CMD) || true + $(PROTOBUF_CHECK_CMD) || true + $(PROTOC_CHECK_CMD) || true libs/$(CONFIG)/zlib/libz.a: $(E) "[MAKE] Building zlib" @@ -361,6 +426,21 @@ endif $(Q)mkdir -p libs/$(CONFIG)/openssl $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a libs/$(CONFIG)/openssl +third_party/protobuf/configure: + $(E) "[AUTOGEN] Preparing protobuf" + $(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete) + +libs/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure + $(E) "[MAKE] Building protobuf" + $(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g" CXXFLAGS="-DLANG_CXX11 -std=c++11" CPPFLAGS="$(CPPFLAGS_$(CONFIG)) -g" ./configure --disable-shared --enable-static) + $(Q)$(MAKE) -C third_party/protobuf clean + $(Q)$(MAKE) -C third_party/protobuf + $(Q)mkdir -p libs/$(CONFIG)/protobuf + $(Q)mkdir -p bins/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/.libs/libprotoc.a libs/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/.libs/libprotobuf.a libs/$(CONFIG)/protobuf + $(Q)cp third_party/protobuf/src/protoc bins/$(CONFIG)/protobuf + static: static_c static_cxx static_c: \ @@ -531,10 +611,14 @@ ifeq ($(CONFIG),opt) endif % for p in protos: -gens/${p}.pb.cc: ${p}.proto $(PROTOC_PLUGINS) +ifeq ($(NO_PROTOC),true) +gens/${p}.pb.cc: protoc_dep_error +else +gens/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(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 $< +endif % endfor @@ -704,17 +788,60 @@ endif else +% if lib.language == 'c++': +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +libs/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error + +% if lib.build == "all": +ifeq ($(SYSTEM),MINGW32) +libs/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error +else +libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error +endif +% endif + +else +% endif + ifneq ($(OPENSSL_DEP),) +# This is to ensure the embedded OpenSSL is built beforehand, properly +# installing headers to their final destination on the drive. We need this +# otherwise parallel compilation will fail if a source is compiled first. % for src in lib.src: ${src}: $(OPENSSL_DEP) % endfor endif -libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(LIB${lib.name.upper()}_OBJS) +libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\ ## The else here corresponds to the if secure earlier. % else: -libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(LIB${lib.name.upper()}_OBJS) +% if lib.language == 'c++': +ifeq ($(NO_PROTOBUF),true) + +# You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. + +libs/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error + +% if lib.build == "all": +ifeq ($(SYSTEM),MINGW32) +libs/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error +else +libs/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error +endif +% endif + +else + +% endif +libs/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP)\ +% endif +% if lib.language == 'c++': + $(PROTOBUF_DEP)\ % endif + $(LIB${lib.name.upper()}_OBJS) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f libs/$(CONFIG)/lib${lib.name}.a @@ -780,10 +907,15 @@ else endif endif % endif - +% if lib.get('secure', True): ## If the lib was secure, we have to close the Makefile's if that tested ## the presence of an ALPN-capable OpenSSL. -% if lib.get('secure', True): + +endif +% endif +% if lib.language == 'c++': +## If the lib was C++, we have to close the Makefile's if that tested +## the presence of protobuf 3.0.0+ endif % endif @@ -840,7 +972,20 @@ else ## That simplifies the codegen a bit, but prevents a fully defined Makefile. ## I can live with that. ## +% if tgt.build == 'protoc': + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins if you don't have protobuf 3.0.0+. + +bins/$(CONFIG)/${tgt.name}: protobuf_dep_error + +else + +bins/$(CONFIG)/${tgt.name}: $(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\ +% else: bins/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\ +% endif % for dep in tgt.deps: libs/$(CONFIG)/lib${dep}.a\ % endfor @@ -870,9 +1015,9 @@ bins/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\ % endfor % if tgt.language == "c++": % if tgt.build == 'protoc': - $(HOST_LDLIBSXX)\ + $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC)\ % else: - $(LDLIBSXX)\ + $(LDLIBSXX) $(LDLIBS_PROTOBUF)\ % endif % endif % if tgt.build == 'protoc': @@ -886,6 +1031,10 @@ bins/$(CONFIG)/${tgt.name}: $(${tgt.name.upper()}_OBJS)\ $(LDLIBS_SECURE)\ % endif -o bins/$(CONFIG)/${tgt.name} +% if tgt.build == 'protoc': + +endif +% endif % if tgt.get('secure', True): endif diff --git a/test/build/protobuf.cc b/test/build/protobuf.cc new file mode 100644 index 0000000000000000000000000000000000000000..59ead111a66bbea71aae85b1b6cc0d395a1bdf5a --- /dev/null +++ b/test/build/protobuf.cc @@ -0,0 +1,10 @@ +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> + +bool protobuf_test(const google::protobuf::MethodDescriptor *method) { + return method->client_streaming() || method->server_streaming(); +} + +int main() { + return 0; +}