aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/Makefile.template
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-20 20:35:06 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2015-02-20 20:35:06 -0800
commit1426a23c181d9ffd8a11e96cf2f5b5c4a1380bb2 (patch)
tree70d0a578818f7ade81fb049f57d79e6abd40e213 /templates/Makefile.template
parent3f0ddff8690d0309c43427f41c48c1bdc63bbacb (diff)
parent98ab998c29105a42f4a99407822d56cf58a1efd8 (diff)
Merge pull request #698 from nicolasnoble/verify-install
Adding a helpful installation message about protobuf.
Diffstat (limited to 'templates/Makefile.template')
-rw-r--r--templates/Makefile.template39
1 files changed, 36 insertions, 3 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 0ac901f69b..60416525f8 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -251,6 +251,7 @@ OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/ope
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_CMD = which protoc
PROTOC_CHECK_CMD = protoc --version | grep -q libprotoc.3
ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG)
@@ -261,10 +262,11 @@ LIBS += profiler
endif
endif
+HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false)
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)
+HAS_SYSTEM_PROTOBUF = $(HAS_SYSTEM_PROTOBUF_VERIFY)
else
# override system libraries if the config requires a custom compiled library
HAS_SYSTEM_OPENSSL_ALPN = false
@@ -272,7 +274,12 @@ HAS_SYSTEM_ZLIB = false
HAS_SYSTEM_PROTOBUF = false
endif
+HAS_PROTOC = $(shell $(PROTOC_CMD) && echo true || echo false)
+ifeq ($(HAS_PROTOC),true)
HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false)
+else
+HAS_VALID_PROTOC = false
+endif
ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
HAS_EMBEDDED_OPENSSL_ALPN = false
@@ -344,6 +351,13 @@ ifeq ($(MAKECMDGOALS),clean)
NO_DEPS = true
endif
+INSTALL_OK = false
+ifeq ($(HAS_VALID_PROTOC),true)
+ifeq ($(HAS_SYSTEM_PROTOBUF_VERIFY),true)
+INSTALL_OK = true
+endif
+endif
+
.SECONDARY = %.pb.h %.pb.cc
PROTOC_PLUGINS =\
@@ -481,7 +495,7 @@ third_party/protobuf/configure:
$(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure
$(E) "[MAKE] Building protobuf"
- $(Q)(cd third_party/protobuf ; CC="$(CC)" CPPFLAGS="-fPIC" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g" CXXFLAGS="-DLANG_CXX11 -std=c++11" CPPFLAGS="$(CPPFLAGS_$(CONFIG)) -g" ./configure --disable-shared --enable-static)
+ $(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g" CXXFLAGS="-DLANG_CXX11 -std=c++11" CPPFLAGS="-fPIC $(CPPFLAGS_$(CONFIG)) -g" ./configure --disable-shared --enable-static)
$(Q)$(MAKE) -C third_party/protobuf clean
$(Q)$(MAKE) -C third_party/protobuf
$(Q)mkdir -p $(LIBDIR)/$(CONFIG)/protobuf
@@ -715,7 +729,7 @@ $(OBJDIR)/$(CONFIG)/%.o : %.cc
$(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
-install: install_c install_cxx install-plugins
+install: install_c install_cxx install-plugins verify-install
install_c: install-headers_c install-static_c install-shared_c
@@ -810,6 +824,25 @@ else
% endfor
endif
+verify-install:
+ifeq ($(SYSTEM_OK),true)
+ @echo "Your system looks ready to go."
+ @echo
+else
+ @echo "Your system doesn't have protoc 3.0.0+ installed. While this"
+ @echo "won't prevent grpc from working, you won't be able to compile"
+ @echo "and run any meaningful code with it."
+ @echo
+ @echo
+ @echo "Please download and install protobuf 3.0.0+ from:"
+ @echo
+ @echo " https://github.com/google/protobuf/releases"
+ @echo
+ @echo "Once you've done so, you can re-run this check by doing:"
+ @echo
+ @echo " make verify-install"
+endif
+
clean:
$(E) "[CLEAN] Cleaning build directories."
$(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR)