aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/Makefile.template
diff options
context:
space:
mode:
Diffstat (limited to 'templates/Makefile.template')
-rw-r--r--templates/Makefile.template78
1 files changed, 57 insertions, 21 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template
index e84ceebf22..0e3b9926b7 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -49,6 +49,19 @@
sources_that_need_openssl = set()
sources_that_don_t_need_openssl = set()
+
+ # warnings we'd like, but that dont exist in all compilers
+ PREFERRED_WARNINGS=['shadow', 'extra-semi']
+ CHECK_WARNINGS=PREFERRED_WARNINGS + ['no-shift-negative-value']
+
+ def warning_var(fmt, warning):
+ return fmt % warning.replace('-', '_').upper()
+
+ def neg_warning(warning):
+ if warning[0:3] == 'no-':
+ return warning[3:]
+ else:
+ return 'no-' + warning
%>
@@ -187,17 +200,14 @@
CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc
HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false)
- CHECK_SHADOW_WORKS_CMD = $(CC) -std=c99 -Werror -Wshadow -o $(TMPOUT) -c test/build/shadow.c
- HAS_WORKING_SHADOW = $(shell $(CHECK_SHADOW_WORKS_CMD) 2> /dev/null && echo true || echo false)
- ifeq ($(HAS_WORKING_SHADOW),true)
- W_SHADOW=-Wshadow
- endif
-
- CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD = $(CC) -std=c99 -Werror -Wno-shift-negative-value -o $(TMPOUT) -c test/build/empty.c
- HAS_NO_SHIFT_NEGATIVE_VALUE = $(shell $(CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD) 2> /dev/null && echo true || echo false)
- ifeq ($(HAS_NO_SHIFT_NEGATIVE_VALUE),true)
- W_NO_SHIFT_NEGATIVE_VALUE=-Wno-shift-negative-value
+ %for warning in CHECK_WARNINGS:
+ ${warning_var('CHECK_%s_WORKS_CMD', warning)} = $(CC) -std=c99 -Werror -W${warning} -o $(TMPOUT) -c test/build/${warning}.c
+ ${warning_var('HAS_WORKING_%s', warning)} = $(shell $(${warning_var('CHECK_%s_WORKS_CMD', warning)}) 2> /dev/null && echo true || echo false)
+ ifeq ($(${warning_var('HAS_WORKING_%s', warning)}),true)
+ ${warning_var('W_%s', warning)}=-W${warning}
+ ${warning_var('NO_W_%s', warning)}=-W${neg_warning(warning)}
endif
+ %endfor
# The HOST compiler settings are used to compile the protoc plugins.
# In most cases, you won't have to change anything, but if you are
@@ -213,7 +223,7 @@
DEFINES += $(EXTRA_DEFINES)
endif
- CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW)
+ CFLAGS += -std=c99 -Wsign-conversion -Wconversion ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)}
ifeq ($(HAS_CXX11),true)
CXXFLAGS += -std=c++11
else
@@ -913,6 +923,7 @@
pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc
+ ifeq ($(EMBED_OPENSSL),true)
privatelibs_cxx: \
% for lib in libs:
% if 'Makefile' in lib.get('build_system', ['Makefile']):
@@ -921,6 +932,18 @@
% endif
% endif
% endfor
+
+ else
+ privatelibs_cxx: \
+ % for lib in libs:
+ % if 'Makefile' in lib.get('build_system', ['Makefile']):
+ % if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None) and not lib.boringssl:
+ $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
+ % endif
+ % endif
+ % endfor
+
+ endif
ifeq ($(HAS_ZOOKEEPER),true)
@@ -948,12 +971,23 @@
% endfor
+ ifeq ($(EMBED_OPENSSL),true)
buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\</%text>
% for tgt in targets:
% if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None):
$(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text>
% endif
% endfor
+
+ else
+ buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\</%text>
+ % for tgt in targets:
+ % if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None) and not tgt.boringssl:
+ $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text>
+ % endif
+ % endfor
+
+ endif
ifeq ($(HAS_ZOOKEEPER),true)
@@ -1197,7 +1231,7 @@
$(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc:
$(E) "[MAKE] Generating $@"
$(Q) mkdir -p $(@D)
- $(Q) echo -e "$(GRPC_ZOOKEEPER_PC_FILE)" >$@
+ $(Q) echo "$(GRPC_ZOOKEEPER_PC_FILE)" | tr , '\n' >$@
$(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc:
$(E) "[MAKE] Generating $@"
@@ -1217,12 +1251,12 @@
$(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) ${' '.join('$(GENDIR)/%s.pb.cc' % q for q in proto_deps.get(p, []))}
$(E) "[PROTOC] Generating protobuf CC file from $<"
$(Q) mkdir -p `dirname $@`
- $(Q) $(PROTOC) --cpp_out=$(GENDIR) $<
+ $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --cpp_out=$(GENDIR) $<
$(GENDIR)/${p}.grpc.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) ${' '.join('$(GENDIR)/%s.pb.cc $(GENDIR)/%s.grpc.pb.cc' % (q,q) for q in proto_deps.get(p, []))}
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@`
- $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $<
+ $(Q) $(PROTOC) -Ithird_party/protobuf/src -I. --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $<
endif
% endfor
@@ -1421,17 +1455,19 @@
@echo "Your system looks ready to go."
@echo
else
- @echo "We couldn't find protoc 3.0.0+ installed on your system. 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 "Warning: it looks like protoc 3.0.0+ isn't installed on your system,"
+ @echo "which means that you won't be able to compile .proto files for use"
+ @echo "with gRPC."
@echo
+ @echo "If you are just using pre-compiled protocol buffers, or you otherwise"
+ @echo "have no need to compile .proto files, you can ignore this."
@echo
- @echo "Please download and install protobuf 3.0.0+ from:"
+ @echo "If you do need protobuf for some reason, you can download and install"
+ @echo "it from:"
@echo
@echo " https://github.com/google/protobuf/releases"
@echo
- @echo "Once you've done so, or if you think this message is in error,"
- @echo "you can re-run this check by doing:"
+ @echo "Once you've done so, you can re-run this check by doing:"
@echo
@echo " make verify-install"
endif
@@ -1698,7 +1734,7 @@
# boringssl needs an override to ensure that it does not include
# system openssl headers regardless of other configuration
# we do so here with a target specific variable assignment
- $(${tgt.name.upper()}_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value
+ $(${tgt.name.upper()}_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value $(NO_W_EXTRA_SEMI)
$(${tgt.name.upper()}_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS)
$(${tgt.name.upper()}_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE
% else: