Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1 | %YAML 1.2 |
| 2 | --- | |
| 3 | # GRPC global makefile |
| 4 | # This currently builds C and C++ code. |
| 5 | # This file has been automatically generated from a template file. |
| 6 | # Please look at the templates directory instead. |
| 7 | # This file can be regenerated from the template by running |
| 8 | # tools/buildgen/generate_projects.sh |
Craig Tiller | 3b93548 | 2015-02-16 12:15:48 -0800 | [diff] [blame] | 9 | |
murgatroid99 | 3466c4b | 2016-01-12 10:26:04 -0800 | [diff] [blame] | 10 | # Copyright 2015-2016, Google Inc. |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 11 | # All rights reserved. |
| 12 | # |
| 13 | # Redistribution and use in source and binary forms, with or without |
| 14 | # modification, are permitted provided that the following conditions are |
| 15 | # met: |
| 16 | # |
| 17 | # * Redistributions of source code must retain the above copyright |
| 18 | # notice, this list of conditions and the following disclaimer. |
| 19 | # * Redistributions in binary form must reproduce the above |
| 20 | # copyright notice, this list of conditions and the following disclaimer |
| 21 | # in the documentation and/or other materials provided with the |
| 22 | # distribution. |
| 23 | # * Neither the name of Google Inc. nor the names of its |
| 24 | # contributors may be used to endorse or promote products derived from |
| 25 | # this software without specific prior written permission. |
| 26 | # |
| 27 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 28 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 29 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 30 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 31 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 32 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 33 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 34 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 35 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 36 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 37 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 38 | <%! |
| 39 | import re |
| 40 | import os |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 41 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 42 | proto_re = re.compile('(.*)\\.proto') |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 43 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 44 | def proto_to_cc(filename): |
| 45 | m = proto_re.match(filename) |
| 46 | if not m: |
| 47 | return filename |
| 48 | return '$(GENDIR)/' + m.group(1) + '.pb.cc $(GENDIR)/' + m.group(1) + '.grpc.pb.cc' |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 49 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 50 | sources_that_need_openssl = set() |
| 51 | sources_that_don_t_need_openssl = set() |
| 52 | %> |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 53 | |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 54 | |
Craig Tiller | 71a8604 | 2016-01-15 14:59:58 -0800 | [diff] [blame] | 55 | comma := , |
| 56 | |
| 57 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 58 | # Basic platform detection |
| 59 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 60 | ifeq ($(SYSTEM),) |
| 61 | SYSTEM = $(HOST_SYSTEM) |
| 62 | endif |
| 63 | ifeq ($(SYSTEM),MSYS) |
| 64 | SYSTEM = MINGW32 |
| 65 | endif |
| 66 | ifeq ($(SYSTEM),MINGW64) |
| 67 | SYSTEM = MINGW32 |
| 68 | endif |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 69 | |
| 70 | |
Nicolas "Pixel" Noble | 6dad9b0 | 2015-09-23 18:32:26 +0200 | [diff] [blame] | 71 | MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 72 | ifndef BUILDDIR |
Nicolas "Pixel" Noble | 42b4c28 | 2015-09-17 23:57:08 +0200 | [diff] [blame] | 73 | BUILDDIR_ABSOLUTE = $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) |
| 74 | else |
| 75 | BUILDDIR_ABSOLUTE = $(abspath $(BUILDDIR)) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 76 | endif |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 77 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 78 | HAS_GCC = $(shell which gcc > /dev/null 2> /dev/null && echo true || echo false) |
| 79 | HAS_CC = $(shell which cc > /dev/null 2> /dev/null && echo true || echo false) |
| 80 | HAS_CLANG = $(shell which clang > /dev/null 2> /dev/null && echo true || echo false) |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 81 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 82 | ifeq ($(HAS_CC),true) |
| 83 | DEFAULT_CC = cc |
| 84 | DEFAULT_CXX = c++ |
| 85 | else |
| 86 | ifeq ($(HAS_GCC),true) |
| 87 | DEFAULT_CC = gcc |
| 88 | DEFAULT_CXX = g++ |
| 89 | else |
| 90 | ifeq ($(HAS_CLANG),true) |
| 91 | DEFAULT_CC = clang |
| 92 | DEFAULT_CXX = clang++ |
| 93 | else |
| 94 | DEFAULT_CC = no_c_compiler |
| 95 | DEFAULT_CXX = no_c++_compiler |
| 96 | endif |
| 97 | endif |
| 98 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 99 | |
| 100 | |
Nicolas "Pixel" Noble | 42b4c28 | 2015-09-17 23:57:08 +0200 | [diff] [blame] | 101 | BINDIR = $(BUILDDIR_ABSOLUTE)/bins |
| 102 | OBJDIR = $(BUILDDIR_ABSOLUTE)/objs |
| 103 | LIBDIR = $(BUILDDIR_ABSOLUTE)/libs |
| 104 | GENDIR = $(BUILDDIR_ABSOLUTE)/gens |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 105 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 106 | # Configurations |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 107 | |
Craig Tiller | a0f8517 | 2016-01-20 15:56:06 -0800 | [diff] [blame] | 108 | % for name, args in configs.iteritems(): |
| 109 | VALID_CONFIG_${name} = 1 |
| 110 | % if args.get('compile_the_world', False): |
| 111 | REQUIRE_CUSTOM_LIBRARIES_${name} = 1 |
| 112 | % endif |
Craig Tiller | aff3d50 | 2016-01-20 15:59:31 -0800 | [diff] [blame] | 113 | % for tool, default in [('CC', 'CC'), ('CXX', 'CXX'), ('LD', 'CC'), ('LDXX', 'CXX')]: |
Craig Tiller | a0f8517 | 2016-01-20 15:56:06 -0800 | [diff] [blame] | 114 | ${tool}_${name} = ${args.get(tool, '$(DEFAULT_%s)' % default)} |
| 115 | % endfor |
| 116 | % for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'DEFINES']: |
| 117 | % if args.get(arg, None) is not None: |
| 118 | ${arg}_${name} = ${args.get(arg)} |
| 119 | % endif |
| 120 | % endfor |
| 121 | % if args.get('timeout_multiplier', 1) != 1: |
| 122 | DEFINES_${name} += GRPC_TEST_SLOWDOWN_BUILD_FACTOR=${args.timeout_multiplier} |
| 123 | % endif |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 124 | |
Craig Tiller | a0f8517 | 2016-01-20 15:56:06 -0800 | [diff] [blame] | 125 | % endfor |
Craig Tiller | 699ba21 | 2015-01-13 17:02:20 -0800 | [diff] [blame] | 126 | |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 127 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 128 | # General settings. |
| 129 | # You may want to change these depending on your system. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 130 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 131 | prefix ?= /usr/local |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 132 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 133 | PROTOC = protoc |
| 134 | DTRACE = dtrace |
| 135 | CONFIG ?= opt |
| 136 | CC = $(CC_$(CONFIG)) |
| 137 | CXX = $(CXX_$(CONFIG)) |
| 138 | LD = $(LD_$(CONFIG)) |
| 139 | LDXX = $(LDXX_$(CONFIG)) |
| 140 | AR = ar |
| 141 | ifeq ($(SYSTEM),Linux) |
| 142 | STRIP = strip --strip-unneeded |
| 143 | else |
| 144 | ifeq ($(SYSTEM),Darwin) |
| 145 | STRIP = strip -x |
| 146 | else |
| 147 | STRIP = strip |
| 148 | endif |
| 149 | endif |
| 150 | INSTALL = install |
| 151 | RM = rm -f |
| 152 | PKG_CONFIG = pkg-config |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 153 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 154 | ifndef VALID_CONFIG_$(CONFIG) |
| 155 | $(error Invalid CONFIG value '$(CONFIG)') |
| 156 | endif |
yangg | 102e4fe | 2015-01-06 16:02:50 -0800 | [diff] [blame] | 157 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 158 | ifeq ($(SYSTEM),Linux) |
| 159 | TMPOUT = /dev/null |
| 160 | else |
| 161 | TMPOUT = `mktemp /tmp/test-out-XXXXXX` |
| 162 | endif |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 163 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 164 | # Detect if we can use C++11 |
| 165 | CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc |
| 166 | HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false) |
Craig Tiller | cf133f4 | 2015-02-26 14:05:56 -0800 | [diff] [blame] | 167 | |
Craig Tiller | 82f3f0d | 2016-01-25 11:27:42 -0800 | [diff] [blame^] | 168 | CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD = $(CC) -std=c99 -Werror -Wno-shift-negative-value -o $(TMPOUT) -c test/build/empty.c |
Craig Tiller | 16872b8 | 2016-01-25 10:55:20 -0800 | [diff] [blame] | 169 | HAS_NO_SHIFT_NEGATIVE_VALUE = $(shell $(CHECK_NO_SHIFT_NEGATIVE_VALUE_CMD) 2> /dev/null && echo true || echo false) |
| 170 | ifeq ($(HAS_NO_SHIFT_NEGATIVE_VALUE),true) |
| 171 | W_NO_SHIFT_NEGATIVE_VALUE=-Wno-shift-negative-value |
| 172 | endif |
| 173 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 174 | # The HOST compiler settings are used to compile the protoc plugins. |
| 175 | # In most cases, you won't have to change anything, but if you are |
| 176 | # cross-compiling, you can override these variables from GNU make's |
| 177 | # command line: make CC=cross-gcc HOST_CC=gcc |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 178 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 179 | HOST_CC = $(CC) |
| 180 | HOST_CXX = $(CXX) |
| 181 | HOST_LD = $(LD) |
| 182 | HOST_LDXX = $(LDXX) |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 183 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 184 | ifdef EXTRA_DEFINES |
| 185 | DEFINES += $(EXTRA_DEFINES) |
| 186 | endif |
Craig Tiller | 86fa1c5 | 2015-02-27 09:57:58 -0800 | [diff] [blame] | 187 | |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 188 | CFLAGS += -std=c99 -Wsign-conversion -Wconversion -Wshadow |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 189 | ifeq ($(HAS_CXX11),true) |
| 190 | CXXFLAGS += -std=c++11 |
| 191 | else |
| 192 | CXXFLAGS += -std=c++0x |
| 193 | endif |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 194 | CFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter |
| 195 | CXXFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 196 | LDFLAGS += -g |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 197 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 198 | CPPFLAGS += $(CPPFLAGS_$(CONFIG)) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 199 | CFLAGS += $(CFLAGS_$(CONFIG)) |
| 200 | CXXFLAGS += $(CXXFLAGS_$(CONFIG)) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 201 | DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\" |
| 202 | LDFLAGS += $(LDFLAGS_$(CONFIG)) |
Nicolas "Pixel" Noble | 482d761 | 2015-07-16 23:43:30 +0200 | [diff] [blame] | 203 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 204 | ifneq ($(SYSTEM),MINGW32) |
| 205 | PIC_CPPFLAGS = -fPIC |
| 206 | CPPFLAGS += -fPIC |
| 207 | LDFLAGS += -fPIC |
| 208 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 209 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 210 | INCLUDES = . include $(GENDIR) |
| 211 | LDFLAGS += -Llibs/$(CONFIG) |
Nicolas "Pixel" Noble | 3adab74 | 2015-06-02 00:33:06 +0200 | [diff] [blame] | 212 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 213 | ifeq ($(SYSTEM),Darwin) |
| 214 | ifneq ($(wildcard /usr/local/ssl/include),) |
| 215 | INCLUDES += /usr/local/ssl/include |
| 216 | endif |
| 217 | ifneq ($(wildcard /opt/local/include),) |
| 218 | INCLUDES += /opt/local/include |
| 219 | endif |
| 220 | ifneq ($(wildcard /usr/local/include),) |
| 221 | INCLUDES += /usr/local/include |
| 222 | endif |
| 223 | LIBS = m z |
| 224 | ifneq ($(wildcard /usr/local/ssl/lib),) |
| 225 | LDFLAGS += -L/usr/local/ssl/lib |
| 226 | endif |
| 227 | ifneq ($(wildcard /opt/local/lib),) |
| 228 | LDFLAGS += -L/opt/local/lib |
| 229 | endif |
| 230 | ifneq ($(wildcard /usr/local/lib),) |
| 231 | LDFLAGS += -L/usr/local/lib |
| 232 | endif |
| 233 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 234 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 235 | ifeq ($(SYSTEM),Linux) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 236 | LIBS = rt m pthread |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 237 | LDFLAGS += -pthread |
| 238 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 239 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 240 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 241 | LIBS = m pthread |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 242 | LDFLAGS += -pthread |
| 243 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 244 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 245 | GTEST_LIB = -Ithird_party/googletest/include -Ithird_party/googletest third_party/googletest/src/gtest-all.cc |
| 246 | GTEST_LIB += -lgflags |
| 247 | ifeq ($(V),1) |
| 248 | E = @: |
| 249 | Q = |
| 250 | else |
| 251 | E = @echo |
| 252 | Q = @ |
| 253 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 254 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 255 | VERSION = ${settings.version.major}.${settings.version.minor}.${settings.version.micro}.${settings.version.build} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 256 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 257 | CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) |
| 258 | CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 259 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 260 | LDFLAGS += $(ARCH_FLAGS) |
| 261 | LDLIBS += $(addprefix -l, $(LIBS)) |
| 262 | LDLIBSXX += $(addprefix -l, $(LIBSXX)) |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 263 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 264 | HOST_CPPFLAGS = $(CPPFLAGS) |
| 265 | HOST_CFLAGS = $(CFLAGS) |
| 266 | HOST_CXXFLAGS = $(CXXFLAGS) |
| 267 | HOST_LDFLAGS = $(LDFLAGS) |
| 268 | HOST_LDLIBS = $(LDLIBS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 269 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 270 | # These are automatically computed variables. |
| 271 | # There shouldn't be any need to change anything from now on. |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 272 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 273 | -include cache.mk |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 274 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 275 | CACHE_MK = |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 276 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 277 | HAS_PKG_CONFIG ?= $(shell command -v $(PKG_CONFIG) >/dev/null 2>&1 && echo true || echo false) |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 278 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 279 | ifeq ($(HAS_PKG_CONFIG), true) |
| 280 | CACHE_MK += HAS_PKG_CONFIG = true, |
| 281 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 282 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 283 | PC_TEMPLATE = prefix=$(prefix),\ |
| 284 | exec_prefix=${'\$${prefix}'},\ |
| 285 | includedir=${'\$${prefix}'}/include,\ |
| 286 | libdir=${'\$${exec_prefix}'}/lib,\ |
| 287 | ,\ |
| 288 | Name: $(PC_NAME),\ |
| 289 | Description: $(PC_DESCRIPTION),\ |
| 290 | Version: $(VERSION),\ |
| 291 | Cflags: -I${'\$${includedir}'} $(PC_CFLAGS),\ |
| 292 | Requires.private: $(PC_REQUIRES_PRIVATE),\ |
| 293 | Libs: -L${'\$${libdir}'} $(PC_LIB),\ |
| 294 | Libs.private: $(PC_LIBS_PRIVATE) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 295 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 296 | # gpr .pc file |
| 297 | PC_NAME = gRPC Portable Runtime |
| 298 | PC_DESCRIPTION = gRPC Portable Runtime |
| 299 | PC_CFLAGS = -pthread |
| 300 | PC_REQUIRES_PRIVATE = |
| 301 | PC_LIBS_PRIVATE = -lpthread |
| 302 | PC_LIB = -lgpr |
| 303 | ifneq ($(SYSTEM),Darwin) |
| 304 | PC_LIBS_PRIVATE += -lrt |
| 305 | endif |
| 306 | GPR_PC_FILE := $(PC_TEMPLATE) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 307 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 308 | ifeq ($(SYSTEM),MINGW32) |
| 309 | SHARED_EXT = dll |
| 310 | endif |
| 311 | ifeq ($(SYSTEM),Darwin) |
| 312 | SHARED_EXT = dylib |
| 313 | endif |
| 314 | ifeq ($(SHARED_EXT),) |
| 315 | SHARED_EXT = so.$(VERSION) |
| 316 | endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 317 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 318 | ifeq ($(wildcard .git),) |
| 319 | IS_GIT_FOLDER = false |
| 320 | else |
| 321 | IS_GIT_FOLDER = true |
| 322 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 323 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 324 | ifeq ($(SYSTEM),Linux) |
| 325 | OPENSSL_REQUIRES_DL = true |
| 326 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 327 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 328 | ifeq ($(SYSTEM),Darwin) |
| 329 | OPENSSL_REQUIRES_DL = true |
| 330 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 331 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 332 | ifeq ($(HAS_PKG_CONFIG),true) |
| 333 | OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl |
| 334 | OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl |
| 335 | ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib |
| 336 | PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.0.0-alpha-3 protobuf |
| 337 | else # HAS_PKG_CONFIG |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 338 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 339 | ifeq ($(SYSTEM),MINGW32) |
| 340 | OPENSSL_LIBS = ssl32 eay32 |
| 341 | else |
| 342 | OPENSSL_LIBS = ssl crypto |
| 343 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 344 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 345 | OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) |
| 346 | OPENSSL_NPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) |
| 347 | ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) |
| 348 | PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) |
Craig Tiller | 297fafa | 2015-01-15 15:46:39 -0800 | [diff] [blame] | 349 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 350 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
| 351 | OPENSSL_ALPN_CHECK_CMD += -ldl |
| 352 | OPENSSL_NPN_CHECK_CMD += -ldl |
| 353 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 354 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 355 | endif # HAS_PKG_CONFIG |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 356 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 357 | PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) |
murgatroid99 | 6d9e401 | 2015-07-08 10:22:45 -0700 | [diff] [blame] | 358 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 359 | PROTOC_CHECK_CMD = which protoc > /dev/null |
| 360 | PROTOC_CHECK_VERSION_CMD = protoc --version | grep -q libprotoc.3 |
| 361 | DTRACE_CHECK_CMD = which dtrace > /dev/null |
| 362 | SYSTEMTAP_HEADERS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/systemtap.c $(LDFLAGS) |
| 363 | ZOOKEEPER_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zookeeper.c $(LDFLAGS) -lzookeeper_mt |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 364 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 365 | ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) |
| 366 | HAS_SYSTEM_PERFTOOLS ?= $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 367 | ifeq ($(HAS_SYSTEM_PERFTOOLS),true) |
| 368 | DEFINES += GRPC_HAVE_PERFTOOLS |
| 369 | LIBS += profiler |
| 370 | CACHE_MK += HAS_SYSTEM_PERFTOOLS = true, |
| 371 | endif |
| 372 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 373 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 374 | HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 375 | ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) |
| 376 | HAS_SYSTEM_OPENSSL_ALPN ?= $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 377 | ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) |
| 378 | HAS_SYSTEM_OPENSSL_NPN = true |
| 379 | CACHE_MK += HAS_SYSTEM_OPENSSL_ALPN = true, |
| 380 | else |
| 381 | HAS_SYSTEM_OPENSSL_NPN ?= $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 382 | endif |
| 383 | ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) |
| 384 | CACHE_MK += HAS_SYSTEM_OPENSSL_NPN = true, |
| 385 | endif |
| 386 | HAS_SYSTEM_ZLIB ?= $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 387 | ifeq ($(HAS_SYSTEM_ZLIB),true) |
| 388 | CACHE_MK += HAS_SYSTEM_ZLIB = true, |
| 389 | endif |
| 390 | HAS_SYSTEM_PROTOBUF ?= $(HAS_SYSTEM_PROTOBUF_VERIFY) |
| 391 | ifeq ($(HAS_SYSTEM_PROTOBUF),true) |
| 392 | CACHE_MK += HAS_SYSTEM_PROTOBUF = true, |
| 393 | endif |
| 394 | else |
| 395 | # override system libraries if the config requires a custom compiled library |
| 396 | HAS_SYSTEM_OPENSSL_ALPN = false |
| 397 | HAS_SYSTEM_OPENSSL_NPN = false |
| 398 | HAS_SYSTEM_ZLIB = false |
| 399 | HAS_SYSTEM_PROTOBUF = false |
| 400 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 401 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 402 | HAS_PROTOC ?= $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 403 | ifeq ($(HAS_PROTOC),true) |
| 404 | CACHE_MK += HAS_PROTOC = true, |
| 405 | HAS_VALID_PROTOC ?= $(shell $(PROTOC_CHECK_VERSION_CMD) 2> /dev/null && echo true || echo false) |
| 406 | ifeq ($(HAS_VALID_PROTOC),true) |
| 407 | CACHE_MK += HAS_VALID_PROTOC = true, |
| 408 | endif |
| 409 | else |
| 410 | HAS_VALID_PROTOC = false |
| 411 | endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 412 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 413 | # Check for Systemtap (https://sourceware.org/systemtap/), first by making sure <sys/sdt.h> is present |
| 414 | # in the system and secondly by checking for the "dtrace" binary (on Linux, this is part of the Systemtap |
| 415 | # distribution. It's part of the base system on BSD/Solaris machines). |
| 416 | ifndef HAS_SYSTEMTAP |
| 417 | HAS_SYSTEMTAP_HEADERS = $(shell $(SYSTEMTAP_HEADERS_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 418 | HAS_DTRACE = $(shell $(DTRACE_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 419 | HAS_SYSTEMTAP = false |
| 420 | ifeq ($(HAS_SYSTEMTAP_HEADERS),true) |
| 421 | ifeq ($(HAS_DTRACE),true) |
| 422 | HAS_SYSTEMTAP = true |
| 423 | endif |
| 424 | endif |
| 425 | endif |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 426 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 427 | ifeq ($(HAS_SYSTEMTAP),true) |
| 428 | CACHE_MK += HAS_SYSTEMTAP = true, |
| 429 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 430 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 431 | HAS_ZOOKEEPER = $(shell $(ZOOKEEPER_CHECK_CMD) 2> /dev/null && echo true || echo false) |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 432 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 433 | # Note that for testing purposes, one can do: |
| 434 | # make HAS_EMBEDDED_OPENSSL_ALPN=false |
| 435 | # to emulate the fact we do not have OpenSSL in the third_party folder. |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 436 | ifeq ($(wildcard third_party/boringssl/include/openssl/ssl.h),) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 437 | HAS_EMBEDDED_OPENSSL_ALPN = false |
| 438 | else |
| 439 | HAS_EMBEDDED_OPENSSL_ALPN = true |
| 440 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 441 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 442 | ifeq ($(wildcard third_party/zlib/zlib.h),) |
| 443 | HAS_EMBEDDED_ZLIB = false |
| 444 | else |
| 445 | HAS_EMBEDDED_ZLIB = true |
| 446 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 447 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 448 | ifeq ($(wildcard third_party/protobuf/src/google/protobuf/descriptor.pb.h),) |
| 449 | HAS_EMBEDDED_PROTOBUF = false |
| 450 | ifneq ($(HAS_VALID_PROTOC),true) |
| 451 | NO_PROTOC = true |
| 452 | endif |
| 453 | else |
| 454 | HAS_EMBEDDED_PROTOBUF = true |
| 455 | endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 456 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 457 | PC_REQUIRES_GRPC = gpr |
| 458 | PC_LIBS_GRPC = |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 459 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 460 | ifeq ($(HAS_SYSTEM_ZLIB),false) |
Craig Tiller | 3dca23a | 2016-01-21 11:44:55 -0800 | [diff] [blame] | 461 | ifeq ($(HAS_EMBEDDED_ZLIB), true) |
| 462 | EMBED_ZLIB ?= true |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 463 | else |
| 464 | DEP_MISSING += zlib |
Craig Tiller | 3dca23a | 2016-01-21 11:44:55 -0800 | [diff] [blame] | 465 | EMBED_ZLIB ?= broken |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 466 | endif |
| 467 | else |
Craig Tiller | 3dca23a | 2016-01-21 11:44:55 -0800 | [diff] [blame] | 468 | EMBED_ZLIB ?= false |
| 469 | endif |
| 470 | |
| 471 | ifeq ($(EMBED_ZLIB),true) |
| 472 | ZLIB_DEP = $(LIBDIR)/$(CONFIG)/libz.a |
| 473 | ZLIB_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libz.a |
| 474 | CPPFLAGS += -Ithird_party/zlib |
| 475 | LDFLAGS += -L$(LIBDIR)/$(CONFIG)/zlib |
| 476 | else |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 477 | ifeq ($(HAS_PKG_CONFIG),true) |
| 478 | CPPFLAGS += $(shell $(PKG_CONFIG) --cflags zlib) |
| 479 | LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L zlib) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 480 | LIBS += $(patsubst -l%,%,$(shell $(PKG_CONFIG) --libs-only-l zlib)) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 481 | PC_REQUIRES_GRPC += zlib |
| 482 | else |
| 483 | PC_LIBS_GRPC += -lz |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 484 | LIBS += z |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 485 | endif |
| 486 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 487 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 488 | OPENSSL_PKG_CONFIG = false |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 489 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 490 | PC_REQUIRES_SECURE = |
| 491 | PC_LIBS_SECURE = |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 492 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 493 | ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 494 | EMBED_OPENSSL ?= false |
| 495 | NO_SECURE ?= false |
| 496 | else # HAS_SYSTEM_OPENSSL_ALPN=false |
| 497 | ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true) |
| 498 | EMBED_OPENSSL ?= true |
| 499 | NO_SECURE ?= false |
| 500 | else # HAS_EMBEDDED_OPENSSL_ALPN=false |
| 501 | ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) |
| 502 | EMBED_OPENSSL ?= false |
| 503 | NO_SECURE ?= false |
| 504 | else |
| 505 | NO_SECURE ?= true |
| 506 | endif # HAS_SYSTEM_OPENSSL_NPN=true |
| 507 | endif # HAS_EMBEDDED_OPENSSL_ALPN |
| 508 | endif # HAS_SYSTEM_OPENSSL_ALPN |
| 509 | |
| 510 | OPENSSL_DEP := |
| 511 | OPENSSL_MERGE_LIBS := |
| 512 | ifeq ($(NO_SECURE),false) |
| 513 | ifeq ($(EMBED_OPENSSL),true) |
| 514 | OPENSSL_DEP += $(LIBDIR)/$(CONFIG)/libboringssl.a |
| 515 | OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/libboringssl.a |
| 516 | # need to prefix these to ensure overriding system libraries |
| 517 | CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS) |
| 518 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
| 519 | LIBS_SECURE = dl |
| 520 | endif # OPENSSL_REQUIRES_DL |
| 521 | else # EMBED_OPENSSL=false |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 522 | ifeq ($(HAS_PKG_CONFIG),true) |
| 523 | OPENSSL_PKG_CONFIG = true |
| 524 | PC_REQUIRES_SECURE = openssl |
| 525 | CPPFLAGS := $(shell $(PKG_CONFIG) --cflags openssl) $(CPPFLAGS) |
| 526 | LDFLAGS_OPENSSL_PKG_CONFIG = $(shell $(PKG_CONFIG) --libs-only-L openssl) |
| 527 | ifeq ($(SYSTEM),Linux) |
| 528 | ifneq ($(LDFLAGS_OPENSSL_PKG_CONFIG),) |
| 529 | LDFLAGS_OPENSSL_PKG_CONFIG += $(shell $(PKG_CONFIG) --libs-only-L openssl | sed s/L/Wl,-rpath,/) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 530 | endif # LDFLAGS_OPENSSL_PKG_CONFIG='' |
| 531 | endif # System=Linux |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 532 | LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 533 | else # HAS_PKG_CONFIG=false |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 534 | LIBS_SECURE = $(OPENSSL_LIBS) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 535 | endif # HAS_PKG_CONFIG |
| 536 | ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) |
| 537 | CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 |
| 538 | LIBS_SECURE = $(OPENSSL_LIBS) |
| 539 | endif # HAS_SYSTEM_OPENSSL_NPN |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 540 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
| 541 | LIBS_SECURE += dl |
| 542 | PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 543 | endif # OPENSSL_REQUIRES_DL=true |
| 544 | endif # EMBED_OPENSSL |
| 545 | endif # NO_SECURE |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 546 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 547 | ifeq ($(OPENSSL_PKG_CONFIG),true) |
| 548 | LDLIBS_SECURE += $(shell $(PKG_CONFIG) --libs-only-l openssl) |
| 549 | else |
| 550 | LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) |
| 551 | endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 552 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 553 | # grpc .pc file |
| 554 | PC_NAME = gRPC |
| 555 | PC_DESCRIPTION = high performance general RPC framework |
| 556 | PC_CFLAGS = |
| 557 | PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) $(PC_REQUIRES_SECURE) |
| 558 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) $(PC_LIBS_SECURE) |
| 559 | PC_LIB = -lgrpc |
| 560 | GRPC_PC_FILE := $(PC_TEMPLATE) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 561 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 562 | # gprc_unsecure .pc file |
| 563 | PC_NAME = gRPC unsecure |
| 564 | PC_DESCRIPTION = high performance general RPC framework without SSL |
| 565 | PC_CFLAGS = |
| 566 | PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) |
| 567 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) |
| 568 | PC_LIB = -lgrpc |
| 569 | GRPC_UNSECURE_PC_FILE := $(PC_TEMPLATE) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 570 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 571 | # gprc_zookeeper .pc file |
| 572 | PC_NAME = gRPC zookeeper |
| 573 | PC_DESCRIPTION = gRPC's zookeeper plugin |
| 574 | PC_CFLAGS = |
| 575 | PC_REQUIRES_PRIVATE = |
| 576 | PC_LIBS_PRIVATE = -lzookeeper_mt |
| 577 | GRPC_ZOOKEEPER_PC_FILE := $(PC_TEMPLATE) |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 578 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 579 | PROTOBUF_PKG_CONFIG = false |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 580 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 581 | PC_REQUIRES_GRPCXX = |
| 582 | PC_LIBS_GRPCXX = |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 583 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 584 | CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS) |
Craig Tiller | 16f6dac | 2015-08-24 17:00:04 -0700 | [diff] [blame] | 585 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 586 | ifeq ($(HAS_SYSTEM_PROTOBUF),true) |
| 587 | ifeq ($(HAS_PKG_CONFIG),true) |
| 588 | PROTOBUF_PKG_CONFIG = true |
| 589 | PC_REQUIRES_GRPCXX = protobuf |
| 590 | CPPFLAGS := $(shell $(PKG_CONFIG) --cflags protobuf) $(CPPFLAGS) |
| 591 | LDFLAGS_PROTOBUF_PKG_CONFIG = $(shell $(PKG_CONFIG) --libs-only-L protobuf) |
| 592 | ifeq ($(SYSTEM),Linux) |
| 593 | ifneq ($(LDFLAGS_PROTOBUF_PKG_CONFIG),) |
| 594 | LDFLAGS_PROTOBUF_PKG_CONFIG += $(shell $(PKG_CONFIG) --libs-only-L protobuf | sed s/L/Wl,-rpath,/) |
| 595 | endif |
| 596 | endif |
| 597 | else |
| 598 | PC_LIBS_GRPCXX = -lprotobuf |
| 599 | endif |
| 600 | else |
| 601 | ifeq ($(HAS_EMBEDDED_PROTOBUF),true) |
| 602 | PROTOBUF_DEP = $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a |
| 603 | CPPFLAGS := -Ithird_party/protobuf/src $(CPPFLAGS) |
| 604 | LDFLAGS := -L$(LIBDIR)/$(CONFIG)/protobuf $(LDFLAGS) |
| 605 | PROTOC = $(BINDIR)/$(CONFIG)/protobuf/protoc |
| 606 | else |
| 607 | NO_PROTOBUF = true |
| 608 | endif |
| 609 | endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 610 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 611 | LIBS_PROTOBUF = protobuf |
| 612 | LIBS_PROTOC = protoc protobuf |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 613 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 614 | HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 615 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 616 | ifeq ($(PROTOBUF_PKG_CONFIG),true) |
| 617 | LDLIBS_PROTOBUF += $(shell $(PKG_CONFIG) --libs-only-l protobuf) |
| 618 | else |
| 619 | LDLIBS_PROTOBUF += $(addprefix -l, $(LIBS_PROTOBUF)) |
| 620 | endif |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 621 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 622 | # grpc++ .pc file |
| 623 | PC_NAME = gRPC++ |
| 624 | PC_DESCRIPTION = C++ wrapper for gRPC |
| 625 | PC_CFLAGS = |
| 626 | PC_REQUIRES_PRIVATE = grpc $(PC_REQUIRES_GRPCXX) |
| 627 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPCXX) |
| 628 | PC_LIB = -lgrpc++ |
| 629 | GRPCXX_PC_FILE := $(PC_TEMPLATE) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 630 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 631 | # grpc++_unsecure .pc file |
| 632 | PC_NAME = gRPC++ unsecure |
| 633 | PC_DESCRIPTION = C++ wrapper for gRPC without SSL |
| 634 | PC_CFLAGS = |
| 635 | PC_REQUIRES_PRIVATE = grpc_unsecure $(PC_REQUIRES_GRPCXX) |
| 636 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPCXX) |
| 637 | PC_LIB = -lgrpc++ |
| 638 | GRPCXX_UNSECURE_PC_FILE := $(PC_TEMPLATE) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 639 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 640 | ifeq ($(MAKECMDGOALS),clean) |
| 641 | NO_DEPS = true |
| 642 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 643 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 644 | INSTALL_OK = false |
| 645 | ifeq ($(HAS_VALID_PROTOC),true) |
| 646 | ifeq ($(HAS_SYSTEM_PROTOBUF_VERIFY),true) |
| 647 | INSTALL_OK = true |
| 648 | endif |
| 649 | endif |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 650 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 651 | .SECONDARY = %.pb.h %.pb.cc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 652 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 653 | PROTOC_PLUGINS =\ |
| 654 | % for tgt in targets: |
| 655 | % if tgt.build == 'protoc': |
| 656 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 657 | % endif |
| 658 | % endfor |
Craig Tiller | f58b9ef | 2015-01-15 09:09:12 -0800 | [diff] [blame] | 659 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 660 | ifeq ($(DEP_MISSING),) |
| 661 | all: static shared plugins\ |
| 662 | % for tgt in targets: |
| 663 | % if tgt.build == 'all': |
| 664 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 665 | % endif |
| 666 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 667 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 668 | dep_error: |
| 669 | @echo "You shouldn't see this message - all of your dependencies are correct." |
| 670 | else |
| 671 | all: dep_error git_update stop |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 672 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 673 | dep_error: |
| 674 | @echo |
| 675 | @echo "DEPENDENCY ERROR" |
| 676 | @echo |
| 677 | @echo "You are missing system dependencies that are essential to build grpc," |
| 678 | @echo "and the third_party directory doesn't have them:" |
| 679 | @echo |
| 680 | @echo " $(DEP_MISSING)" |
| 681 | @echo |
| 682 | @echo "Installing the development packages for your system will solve" |
| 683 | @echo "this issue. Please consult INSTALL to get more information." |
| 684 | @echo |
| 685 | @echo "If you need information about why these tests failed, run:" |
| 686 | @echo |
| 687 | @echo " make run_dep_checks" |
| 688 | @echo |
| 689 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 690 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 691 | git_update: |
| 692 | ifeq ($(IS_GIT_FOLDER),true) |
| 693 | @echo "Additionally, since you are in a git clone, you can download the" |
| 694 | @echo "missing dependencies in third_party by running the following command:" |
| 695 | @echo |
| 696 | @echo " git submodule update --init" |
| 697 | @echo |
| 698 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 699 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 700 | openssl_dep_error: openssl_dep_message git_update stop |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 701 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 702 | protobuf_dep_error: protobuf_dep_message git_update stop |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 703 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 704 | protoc_dep_error: protoc_dep_message git_update stop |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 705 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 706 | openssl_dep_message: |
| 707 | @echo |
| 708 | @echo "DEPENDENCY ERROR" |
| 709 | @echo |
| 710 | @echo "The target you are trying to run requires OpenSSL." |
| 711 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 712 | @echo |
| 713 | @echo "Please consult INSTALL to get more information." |
| 714 | @echo |
| 715 | @echo "If you need information about why these tests failed, run:" |
| 716 | @echo |
| 717 | @echo " make run_dep_checks" |
| 718 | @echo |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 719 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 720 | protobuf_dep_message: |
| 721 | @echo |
| 722 | @echo "DEPENDENCY ERROR" |
| 723 | @echo |
| 724 | @echo "The target you are trying to run requires protobuf 3.0.0+" |
| 725 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 726 | @echo |
| 727 | @echo "Please consult INSTALL to get more information." |
| 728 | @echo |
| 729 | @echo "If you need information about why these tests failed, run:" |
| 730 | @echo |
| 731 | @echo " make run_dep_checks" |
| 732 | @echo |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 733 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 734 | protoc_dep_message: |
| 735 | @echo |
| 736 | @echo "DEPENDENCY ERROR" |
| 737 | @echo |
| 738 | @echo "The target you are trying to run requires protobuf-compiler 3.0.0+" |
| 739 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 740 | @echo |
| 741 | @echo "Please consult INSTALL to get more information." |
| 742 | @echo |
| 743 | @echo "If you need information about why these tests failed, run:" |
| 744 | @echo |
| 745 | @echo " make run_dep_checks" |
| 746 | @echo |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 747 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 748 | systemtap_dep_error: |
| 749 | @echo |
| 750 | @echo "DEPENDENCY ERROR" |
| 751 | @echo |
| 752 | @echo "Under the '$(CONFIG)' configutation, the target you are trying " |
| 753 | @echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other " |
| 754 | @echo "platforms such as Solaris and *BSD). " |
| 755 | @echo |
| 756 | @echo "Please consult INSTALL to get more information." |
| 757 | @echo |
David Garcia Quintas | 8954e90 | 2015-04-29 09:46:33 -0700 | [diff] [blame] | 758 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 759 | stop: |
| 760 | @false |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 761 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 762 | % for tgt in targets: |
| 763 | ${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name} |
| 764 | % endfor |
ctiller | 09cb6d5 | 2014-12-19 17:38:22 -0800 | [diff] [blame] | 765 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 766 | run_dep_checks: |
| 767 | $(OPENSSL_ALPN_CHECK_CMD) || true |
| 768 | $(OPENSSL_NPN_CHECK_CMD) || true |
| 769 | $(ZLIB_CHECK_CMD) || true |
| 770 | $(PERFTOOLS_CHECK_CMD) || true |
| 771 | $(PROTOBUF_CHECK_CMD) || true |
| 772 | $(PROTOC_CHECK_VERSION_CMD) || true |
| 773 | $(ZOOKEEPER_CHECK_CMD) || true |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 774 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 775 | third_party/protobuf/configure: |
| 776 | $(E) "[AUTOGEN] Preparing protobuf" |
| 777 | $(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 778 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 779 | $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure |
| 780 | $(E) "[MAKE] Building protobuf" |
| 781 | $(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g $(PROTOBUF_LDFLAGS_EXTRA)" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g $(PROTOBUF_CPPFLAGS_EXTRA)" ./configure --disable-shared --enable-static) |
| 782 | $(Q)$(MAKE) -C third_party/protobuf clean |
| 783 | $(Q)$(MAKE) -C third_party/protobuf |
| 784 | $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/protobuf |
| 785 | $(Q)mkdir -p $(BINDIR)/$(CONFIG)/protobuf |
| 786 | $(Q)cp third_party/protobuf/src/.libs/libprotoc.a $(LIBDIR)/$(CONFIG)/protobuf |
| 787 | $(Q)cp third_party/protobuf/src/.libs/libprotobuf.a $(LIBDIR)/$(CONFIG)/protobuf |
| 788 | $(Q)cp third_party/protobuf/src/protoc $(BINDIR)/$(CONFIG)/protobuf |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 789 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 790 | static: static_c static_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 791 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 792 | static_c: pc_c pc_c_unsecure cache.mk pc_gpr pc_c_zookeeper\ |
| 793 | % for lib in libs: |
| 794 | % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None): |
| 795 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 796 | % endif |
| 797 | % endfor |
| 798 | static_zookeeper_libs |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 799 | |
| 800 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 801 | static_cxx: pc_cxx pc_cxx_unsecure pc_gpr cache.mk \ |
| 802 | % for lib in libs: |
| 803 | % if lib.build == 'all' and lib.language == 'c++': |
| 804 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 805 | % endif |
| 806 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 807 | |
| 808 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 809 | shared: shared_c shared_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 810 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 811 | shared_c: pc_c pc_c_unsecure pc_gpr cache.mk pc_c_zookeeper\ |
| 812 | % for lib in libs: |
| 813 | % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None): |
| 814 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
| 815 | % endif |
| 816 | % endfor |
| 817 | shared_zookeeper_libs |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 818 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 819 | shared_cxx: pc_cxx pc_cxx_unsecure cache.mk\ |
| 820 | % for lib in libs: |
| 821 | % if lib.build == 'all' and lib.language == 'c++': |
| 822 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
| 823 | % endif |
| 824 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 825 | |
| 826 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 827 | shared_csharp: shared_c \ |
| 828 | % for lib in libs: |
| 829 | % if lib.build == 'all' and lib.language == 'csharp': |
| 830 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
| 831 | % endif |
| 832 | % endfor |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 833 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 834 | ifeq ($(HAS_ZOOKEEPER),true) |
| 835 | static_zookeeper_libs:\ |
| 836 | % for lib in libs: |
| 837 | % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []): |
| 838 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 839 | % endif |
| 840 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 841 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 842 | shared_zookeeper_libs:\ |
| 843 | % for lib in libs: |
| 844 | % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []): |
| 845 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
| 846 | % endif |
| 847 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 848 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 849 | else |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 850 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 851 | static_zookeeper_libs: |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 852 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 853 | shared_zookeeper_libs: |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 854 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 855 | endif |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 856 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 857 | grpc_csharp_ext: shared_csharp |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 858 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 859 | plugins: $(PROTOC_PLUGINS) |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 860 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 861 | privatelibs: privatelibs_c privatelibs_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 862 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 863 | privatelibs_c: \ |
| 864 | % for lib in libs: |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 865 | % if lib.build == 'private' and lib.language == 'c' and not lib.get('external_deps', None) and not lib.boringssl: |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 866 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 867 | % endif |
| 868 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 869 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 870 | pc_gpr: $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 871 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 872 | pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 873 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 874 | pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 875 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 876 | ifeq ($(HAS_ZOOKEEPER),true) |
| 877 | pc_c_zookeeper: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc |
| 878 | else |
| 879 | pc_c_zookeeper: |
| 880 | endif |
Hongwei Wang | a3780a8 | 2015-07-17 15:27:18 -0700 | [diff] [blame] | 881 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 882 | pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 883 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 884 | pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 885 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 886 | privatelibs_cxx: \ |
| 887 | % for lib in libs: |
| 888 | % if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None): |
| 889 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 890 | % endif |
| 891 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 892 | |
| 893 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 894 | ifeq ($(HAS_ZOOKEEPER),true) |
| 895 | privatelibs_zookeeper: \ |
| 896 | % for lib in libs: |
| 897 | % if lib.build == 'private' and lib.language == 'c++' and zookeeper in lib.get('external_deps', []): |
| 898 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 899 | % endif |
| 900 | % endfor |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 901 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 902 | else |
| 903 | privatelibs_zookeeper: |
| 904 | endif |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 905 | |
| 906 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 907 | buildtests: buildtests_c buildtests_cxx buildtests_zookeeper |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 908 | |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 909 | buildtests_c: privatelibs_c <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 910 | % for tgt in targets: |
| 911 | % if tgt.build == 'test' and not tgt.language == 'c++' and not tgt.get('external_deps', None): |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 912 | $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 913 | % endif |
| 914 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 915 | |
| 916 | |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 917 | buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 918 | % for tgt in targets: |
| 919 | % if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None): |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 920 | $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 921 | % endif |
| 922 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 923 | |
| 924 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 925 | ifeq ($(HAS_ZOOKEEPER),true) |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 926 | buildtests_zookeeper: privatelibs_zookeeper <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 927 | % for tgt in targets: |
| 928 | % if tgt.build == 'test' and tgt.language == 'c++' and 'zookeeper' in tgt.get('external_deps', []): |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 929 | $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 930 | % endif |
| 931 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 932 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 933 | else |
| 934 | buildtests_zookeeper: |
| 935 | endif |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 936 | |
| 937 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 938 | test: test_c test_cxx test_zookeeper |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 939 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 940 | flaky_test: flaky_test_c flaky_test_cxx flaky_test_zookeeper |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 941 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 942 | test_c: buildtests_c |
| 943 | % for tgt in targets: |
| 944 | % if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None): |
| 945 | $(E) "[RUN] Testing ${tgt.name}" |
| 946 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 947 | % endif |
| 948 | % endfor |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 949 | |
| 950 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 951 | flaky_test_c: buildtests_c |
| 952 | % for tgt in targets: |
| 953 | % if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and tgt.get('flaky', False) and not tgt.get('external_deps', None): |
| 954 | $(E) "[RUN] Testing ${tgt.name}" |
| 955 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 956 | % endif |
| 957 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 958 | |
| 959 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 960 | test_cxx: test_zookeeper buildtests_cxx |
| 961 | % for tgt in targets: |
| 962 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None): |
| 963 | $(E) "[RUN] Testing ${tgt.name}" |
| 964 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 965 | % endif |
| 966 | % endfor |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 967 | |
| 968 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 969 | flaky_test_cxx: buildtests_cxx |
| 970 | % for tgt in targets: |
| 971 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and not tgt.get('external_deps', None): |
| 972 | $(E) "[RUN] Testing ${tgt.name}" |
| 973 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 974 | % endif |
| 975 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 976 | |
| 977 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 978 | ifeq ($(HAS_ZOOKEEPER),true) |
| 979 | test_zookeeper: buildtests_zookeeper |
| 980 | % for tgt in targets: |
| 981 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []): |
| 982 | $(E) "[RUN] Testing ${tgt.name}" |
| 983 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 984 | % endif |
| 985 | % endfor |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 986 | |
| 987 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 988 | flaky_test_zookeeper: buildtests_zookeeper |
| 989 | % for tgt in targets: |
| 990 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []): |
| 991 | $(E) "[RUN] Testing ${tgt.name}" |
| 992 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 993 | % endif |
| 994 | % endfor |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 995 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 996 | else |
| 997 | test_zookeeper: |
| 998 | flaky_test_zookeeper: |
| 999 | endif |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1000 | |
| 1001 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1002 | test_python: static_c |
| 1003 | $(E) "[RUN] Testing python code" |
| 1004 | $(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG) |
Nicolas "Pixel" Noble | 051a28f | 2015-03-17 22:54:54 +0100 | [diff] [blame] | 1005 | |
| 1006 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1007 | tools: tools_c tools_cxx |
Craig Tiller | 7552f0f | 2015-06-19 17:46:20 -0700 | [diff] [blame] | 1008 | |
| 1009 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1010 | tools_c: privatelibs_c\ |
| 1011 | % for tgt in targets: |
| 1012 | % if tgt.build == 'tool' and not tgt.language=='c++': |
| 1013 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 1014 | % endif |
| 1015 | % endfor |
Craig Tiller | 7552f0f | 2015-06-19 17:46:20 -0700 | [diff] [blame] | 1016 | |
| 1017 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1018 | tools_cxx: privatelibs_cxx\ |
| 1019 | % for tgt in targets: |
| 1020 | % if tgt.build == 'tool' and tgt.language=='c++': |
| 1021 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 1022 | % endif |
| 1023 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1024 | |
| 1025 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1026 | buildbenchmarks: privatelibs\ |
| 1027 | % for tgt in targets: |
| 1028 | % if tgt.build == 'benchmark': |
| 1029 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 1030 | % endif |
| 1031 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1032 | |
| 1033 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1034 | benchmarks: buildbenchmarks |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1035 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1036 | strip: strip-static strip-shared |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1037 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1038 | strip-static: strip-static_c strip-static_cxx |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1039 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1040 | strip-shared: strip-shared_c strip-shared_cxx |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1041 | |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1042 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1043 | # TODO(nnoble): the strip target is stripping in-place, instead |
| 1044 | # of copying files in a temporary folder. |
| 1045 | # This prevents proper debugging after running make install. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1046 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1047 | strip-static_c: static_c |
| 1048 | ifeq ($(CONFIG),opt) |
| 1049 | % for lib in libs: |
| 1050 | % if lib.language == "c": |
| 1051 | % if lib.build == "all": |
| 1052 | % if not lib.get('external_deps', None): |
| 1053 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
| 1054 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
| 1055 | % endif |
| 1056 | % endif |
| 1057 | % endif |
| 1058 | % endfor |
| 1059 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1060 | % for lib in libs: |
| 1061 | % if lib.language == "c": |
| 1062 | % if lib.build == "all": |
| 1063 | % if 'zookeeper' in lib.get('external_deps', []): |
| 1064 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
| 1065 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
| 1066 | % endif |
| 1067 | % endif |
| 1068 | % endif |
| 1069 | % endfor |
| 1070 | endif |
| 1071 | endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1072 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1073 | strip-static_cxx: static_cxx |
| 1074 | ifeq ($(CONFIG),opt) |
| 1075 | % for lib in libs: |
| 1076 | % if lib.language == "c++": |
| 1077 | % if lib.build == "all": |
| 1078 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
| 1079 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
| 1080 | % endif |
| 1081 | % endif |
| 1082 | % endfor |
| 1083 | endif |
Nicolas "Pixel" Noble | 4ef9b86 | 2015-08-14 19:35:24 +0200 | [diff] [blame] | 1084 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1085 | strip-shared_c: shared_c |
| 1086 | ifeq ($(CONFIG),opt) |
| 1087 | % for lib in libs: |
| 1088 | % if lib.language == "c": |
| 1089 | % if lib.build == "all": |
| 1090 | % if not lib.get('external_deps', None): |
| 1091 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 1092 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
| 1093 | % endif |
| 1094 | % endif |
| 1095 | % endif |
| 1096 | % endfor |
| 1097 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1098 | % for lib in libs: |
| 1099 | % if lib.language == "c": |
| 1100 | % if lib.build == "all": |
| 1101 | % if 'zookeeper' in lib.get('external_deps', []): |
| 1102 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 1103 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
| 1104 | % endif |
| 1105 | % endif |
| 1106 | % endif |
| 1107 | % endfor |
| 1108 | endif |
| 1109 | endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1110 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1111 | strip-shared_cxx: shared_cxx |
| 1112 | ifeq ($(CONFIG),opt) |
| 1113 | % for lib in libs: |
| 1114 | % if lib.language == "c++": |
| 1115 | % if lib.build == "all": |
| 1116 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 1117 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
| 1118 | % endif |
| 1119 | % endif |
| 1120 | % endfor |
| 1121 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1122 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1123 | strip-shared_csharp: shared_csharp |
| 1124 | ifeq ($(CONFIG),opt) |
| 1125 | % for lib in libs: |
| 1126 | % if lib.language == "csharp": |
| 1127 | % if lib.build == "all": |
| 1128 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 1129 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
| 1130 | % endif |
| 1131 | % endif |
| 1132 | % endfor |
| 1133 | endif |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1134 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1135 | cache.mk:: |
| 1136 | $(E) "[MAKE] Generating $@" |
| 1137 | $(Q) echo "$(CACHE_MK)" | tr , '\n' >$@ |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 1138 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1139 | $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc: |
| 1140 | $(E) "[MAKE] Generating $@" |
| 1141 | $(Q) mkdir -p $(@D) |
| 1142 | $(Q) echo "$(GPR_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1143 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1144 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc: |
| 1145 | $(E) "[MAKE] Generating $@" |
| 1146 | $(Q) mkdir -p $(@D) |
| 1147 | $(Q) echo "$(GRPC_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1148 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1149 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc: |
| 1150 | $(E) "[MAKE] Generating $@" |
| 1151 | $(Q) mkdir -p $(@D) |
| 1152 | $(Q) echo "$(GRPC_UNSECURE_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1153 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1154 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc: |
| 1155 | $(E) "[MAKE] Generating $@" |
| 1156 | $(Q) mkdir -p $(@D) |
| 1157 | $(Q) echo -e "$(GRPC_ZOOKEEPER_PC_FILE)" >$@ |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1158 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1159 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc: |
| 1160 | $(E) "[MAKE] Generating $@" |
| 1161 | $(Q) mkdir -p $(@D) |
| 1162 | $(Q) echo "$(GRPCXX_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1163 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1164 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc: |
| 1165 | $(E) "[MAKE] Generating $@" |
| 1166 | $(Q) mkdir -p $(@D) |
| 1167 | $(Q) echo "$(GRPCXX_UNSECURE_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1168 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1169 | % for p in protos: |
| 1170 | ifeq ($(NO_PROTOC),true) |
| 1171 | $(GENDIR)/${p}.pb.cc: protoc_dep_error |
| 1172 | $(GENDIR)/${p}.grpc.pb.cc: protoc_dep_error |
| 1173 | else |
Craig Tiller | 1b4e330 | 2015-12-17 16:35:00 -0800 | [diff] [blame] | 1174 | $(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) ${' '.join('$(GENDIR)/%s.pb.cc' % q for q in proto_deps.get(p, []))} |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1175 | $(E) "[PROTOC] Generating protobuf CC file from $<" |
| 1176 | $(Q) mkdir -p `dirname $@` |
| 1177 | $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< |
Nicolas "Pixel" Noble | 0caebbf | 2015-04-09 23:08:51 +0200 | [diff] [blame] | 1178 | |
Craig Tiller | 1b4e330 | 2015-12-17 16:35:00 -0800 | [diff] [blame] | 1179 | $(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, []))} |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1180 | $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" |
| 1181 | $(Q) mkdir -p `dirname $@` |
| 1182 | $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< |
| 1183 | endif |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1184 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1185 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1186 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1187 | ifeq ($(CONFIG),stapprof) |
| 1188 | src/core/profiling/stap_timers.c: $(GENDIR)/src/core/profiling/stap_probes.h |
| 1189 | ifeq ($(HAS_SYSTEMTAP),true) |
| 1190 | $(GENDIR)/src/core/profiling/stap_probes.h: src/core/profiling/stap_probes.d |
| 1191 | $(E) "[DTRACE] Compiling $<" |
| 1192 | $(Q) mkdir -p `dirname $@` |
| 1193 | $(Q) $(DTRACE) -C -h -s $< -o $@ |
| 1194 | else |
| 1195 | $(GENDIR)/src/core/profiling/stap_probes.h: systemtap_dep_error stop |
| 1196 | endif |
| 1197 | endif |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 1198 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1199 | $(OBJDIR)/$(CONFIG)/%.o : %.c |
| 1200 | $(E) "[C] Compiling $<" |
| 1201 | $(Q) mkdir -p `dirname $@` |
| 1202 | $(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1203 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1204 | $(OBJDIR)/$(CONFIG)/%.o : $(GENDIR)/%.pb.cc |
| 1205 | $(E) "[CXX] Compiling $<" |
| 1206 | $(Q) mkdir -p `dirname $@` |
| 1207 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1208 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1209 | $(OBJDIR)/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc |
| 1210 | $(E) "[HOSTCXX] Compiling $<" |
| 1211 | $(Q) mkdir -p `dirname $@` |
| 1212 | $(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1213 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1214 | $(OBJDIR)/$(CONFIG)/%.o : %.cc |
| 1215 | $(E) "[CXX] Compiling $<" |
| 1216 | $(Q) mkdir -p `dirname $@` |
| 1217 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1218 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1219 | install: install_c install_cxx install-plugins install-certs verify-install |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1220 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1221 | install_c: install-headers_c install-static_c install-shared_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1222 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1223 | install_cxx: install-headers_cxx install-static_cxx install-shared_cxx |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1224 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1225 | install_csharp: install-shared_csharp install_c |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1226 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1227 | install_grpc_csharp_ext: install_csharp |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1228 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1229 | install-headers: install-headers_c install-headers_cxx |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1230 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1231 | install-headers_c: |
| 1232 | $(E) "[INSTALL] Installing public C headers" |
| 1233 | $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 |
| 1234 | $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1235 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1236 | install-headers_cxx: |
| 1237 | $(E) "[INSTALL] Installing public C++ headers" |
| 1238 | $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 |
| 1239 | $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1240 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1241 | install-static: install-static_c install-static_cxx |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1242 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1243 | install-static_c: static_c strip-static_c install-pkg-config_c |
| 1244 | % for lib in libs: |
| 1245 | % if lib.language == "c": |
| 1246 | % if lib.build == "all": |
| 1247 | % if not lib.get('external_deps', None): |
| 1248 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
| 1249 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1250 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a |
| 1251 | % endif |
| 1252 | % endif |
| 1253 | % endif |
| 1254 | % endfor |
| 1255 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1256 | % for lib in libs: |
| 1257 | % if lib.language == "c": |
| 1258 | % if lib.build == "all": |
| 1259 | % if 'zookeeper' in lib.get('external_deps', []): |
| 1260 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
| 1261 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1262 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a |
| 1263 | % endif |
| 1264 | % endif |
| 1265 | % endif |
| 1266 | % endfor |
| 1267 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1268 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1269 | install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx |
| 1270 | % for lib in libs: |
| 1271 | % if lib.language == "c++": |
| 1272 | % if lib.build == "all": |
| 1273 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
| 1274 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1275 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a |
| 1276 | % endif |
| 1277 | % endif |
| 1278 | % endfor |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1279 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1280 | <%def name="install_shared(lang_filter)">\ |
| 1281 | % for lib in libs: |
| 1282 | % if lib.language == lang_filter: |
| 1283 | % if lib.build == "all": |
| 1284 | % if not lib.get('external_deps', None): |
| 1285 | ifeq ($(SYSTEM),MINGW32) |
| 1286 | $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" |
| 1287 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1288 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) |
| 1289 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a |
| 1290 | else |
| 1291 | $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" |
| 1292 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1293 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) |
| 1294 | ifneq ($(SYSTEM),Darwin) |
| 1295 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major} |
| 1296 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so |
| 1297 | endif |
| 1298 | endif |
| 1299 | % endif |
| 1300 | % endif |
| 1301 | % endif |
| 1302 | % endfor |
| 1303 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1304 | % for lib in libs: |
| 1305 | % if lib.language == lang_filter: |
| 1306 | % if lib.build == "all": |
| 1307 | % if 'zookeeper' in lib.get('external_deps', []): |
| 1308 | ifeq ($(SYSTEM),MINGW32) |
| 1309 | $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" |
| 1310 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1311 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) |
| 1312 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a |
| 1313 | else |
| 1314 | $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" |
| 1315 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1316 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) |
| 1317 | ifneq ($(SYSTEM),Darwin) |
| 1318 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major} |
| 1319 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so |
| 1320 | endif |
| 1321 | endif |
| 1322 | % endif |
| 1323 | % endif |
| 1324 | % endif |
| 1325 | % endfor |
| 1326 | endif |
| 1327 | ifneq ($(SYSTEM),MINGW32) |
| 1328 | ifneq ($(SYSTEM),Darwin) |
| 1329 | $(Q) ldconfig || true |
| 1330 | endif |
| 1331 | endif |
| 1332 | </%def> |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1333 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1334 | install-shared_c: shared_c strip-shared_c install-pkg-config_c |
| 1335 | ${install_shared("c")} |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1336 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1337 | install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx |
| 1338 | ${install_shared("c++")} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1339 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1340 | install-shared_csharp: shared_csharp strip-shared_csharp |
| 1341 | ${install_shared("csharp")} |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1342 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1343 | install-plugins: $(PROTOC_PLUGINS) |
| 1344 | ifeq ($(SYSTEM),MINGW32) |
| 1345 | $(Q) false |
| 1346 | else |
| 1347 | $(E) "[INSTALL] Installing grpc protoc plugins" |
| 1348 | % for tgt in targets: |
| 1349 | % if tgt.build == 'protoc': |
| 1350 | $(Q) $(INSTALL) -d $(prefix)/bin |
| 1351 | $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name} |
| 1352 | % endif |
| 1353 | % endfor |
| 1354 | endif |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1355 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1356 | install-pkg-config_c: pc_gpr pc_c pc_c_unsecure pc_c_zookeeper |
| 1357 | $(E) "[INSTALL] Installing C pkg-config files" |
| 1358 | $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig |
| 1359 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc $(prefix)/lib/pkgconfig/gpr.pc |
| 1360 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc |
| 1361 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc |
| 1362 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1363 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc $(prefix)/lib/pkgconfig/grpc_zookeeper.pc |
| 1364 | endif |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1365 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1366 | install-pkg-config_cxx: pc_cxx pc_cxx_unsecure |
| 1367 | $(E) "[INSTALL] Installing C++ pkg-config files" |
| 1368 | $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig |
| 1369 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc $(prefix)/lib/pkgconfig/grpc++.pc |
| 1370 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc $(prefix)/lib/pkgconfig/grpc++_unsecure.pc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1371 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1372 | install-certs: etc/roots.pem |
| 1373 | $(E) "[INSTALL] Installing root certificates" |
| 1374 | $(Q) $(INSTALL) -d $(prefix)/share/grpc |
| 1375 | $(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem |
Nicolas "Pixel" Noble | 161ea23 | 2015-02-22 05:48:53 +0100 | [diff] [blame] | 1376 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1377 | verify-install: |
| 1378 | ifeq ($(INSTALL_OK),true) |
| 1379 | @echo "Your system looks ready to go." |
| 1380 | @echo |
| 1381 | else |
| 1382 | @echo "We couldn't find protoc 3.0.0+ installed on your system. While this" |
| 1383 | @echo "won't prevent grpc from working, you won't be able to compile" |
| 1384 | @echo "and run any meaningful code with it." |
| 1385 | @echo |
| 1386 | @echo |
| 1387 | @echo "Please download and install protobuf 3.0.0+ from:" |
| 1388 | @echo |
| 1389 | @echo " https://github.com/google/protobuf/releases" |
| 1390 | @echo |
| 1391 | @echo "Once you've done so, or if you think this message is in error," |
| 1392 | @echo "you can re-run this check by doing:" |
| 1393 | @echo |
| 1394 | @echo " make verify-install" |
| 1395 | endif |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1396 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1397 | clean: |
| 1398 | $(E) "[CLEAN] Cleaning build directories." |
| 1399 | $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) cache.mk |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1400 | |
| 1401 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1402 | # The various libraries |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1403 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1404 | % for lib in libs: |
| 1405 | ${makelib(lib)} |
| 1406 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1407 | |
| 1408 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1409 | # All of the test targets, and protoc plugins |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1410 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1411 | % for tgt in targets: |
| 1412 | ${maketarget(tgt)} |
| 1413 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1414 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1415 | <%def name="makelib(lib)"> |
| 1416 | LIB${lib.name.upper()}_SRC = \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1417 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1418 | % for src in lib.src: |
| 1419 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1420 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1421 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1422 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1423 | % if "public_headers" in lib: |
| 1424 | % if lib.language == "c++": |
| 1425 | PUBLIC_HEADERS_CXX += \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1426 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1427 | % else: |
| 1428 | PUBLIC_HEADERS_C += \\ |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1429 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1430 | % endif |
| 1431 | % for hdr in lib.public_headers: |
| 1432 | ${hdr} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1433 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1434 | % endfor |
| 1435 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1436 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1437 | LIB${lib.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC)))) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1438 | |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1439 | % if lib.boringssl: |
| 1440 | # boringssl needs an override to ensure that it does not include |
| 1441 | # system openssl headers regardless of other configuration |
| 1442 | # we do so here with a target specific variable assignment |
| 1443 | $(LIB${lib.name.upper()}_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -fvisibility=hidden |
| 1444 | $(LIB${lib.name.upper()}_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) -fvisibility=hidden |
| 1445 | $(LIB${lib.name.upper()}_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE |
Craig Tiller | 3dca23a | 2016-01-21 11:44:55 -0800 | [diff] [blame] | 1446 | % elif lib.zlib: |
Craig Tiller | 16872b8 | 2016-01-25 10:55:20 -0800 | [diff] [blame] | 1447 | $(LIB${lib.name.upper()}_OBJS): CFLAGS := $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-implicit-function-declaration $(W_NO_SHIFT_NEGATIVE_VALUE) -fvisibility=hidden |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1448 | % else: |
| 1449 | % endif |
| 1450 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1451 | ## If the library requires OpenSSL, let's add some restrictions. |
| 1452 | % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 1453 | ifeq ($(NO_SECURE),true) |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1454 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1455 | # You can't build secure libraries if you don't have OpenSSL. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1456 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1457 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1458 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1459 | % if lib.build == "all": |
| 1460 | ifeq ($(SYSTEM),MINGW32) |
| 1461 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): openssl_dep_error |
| 1462 | else |
| 1463 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): openssl_dep_error |
| 1464 | endif |
| 1465 | % endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1466 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1467 | else |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1468 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1469 | % if lib.language == 'c++': |
| 1470 | ifeq ($(NO_PROTOBUF),true) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1471 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1472 | # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1473 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1474 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1475 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1476 | % if lib.build == "all": |
| 1477 | ifeq ($(SYSTEM),MINGW32) |
| 1478 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error |
| 1479 | else |
| 1480 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error |
| 1481 | endif |
| 1482 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1483 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1484 | else |
| 1485 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1486 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1487 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\ |
| 1488 | ## The else here corresponds to the if secure earlier. |
| 1489 | % else: |
| 1490 | % if lib.language == 'c++': |
| 1491 | ifeq ($(NO_PROTOBUF),true) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1492 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1493 | # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1494 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1495 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1496 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1497 | % if lib.build == "all": |
| 1498 | ifeq ($(SYSTEM),MINGW32) |
| 1499 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error |
| 1500 | else |
| 1501 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error |
| 1502 | endif |
| 1503 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1504 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1505 | else |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1506 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1507 | % endif |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1508 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP) \ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1509 | % endif |
| 1510 | % if lib.language == 'c++': |
| 1511 | $(PROTOBUF_DEP)\ |
| 1512 | % endif |
| 1513 | $(LIB${lib.name.upper()}_OBJS) |
| 1514 | $(E) "[AR] Creating $@" |
| 1515 | $(Q) mkdir -p `dirname $@` |
| 1516 | $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
| 1517 | $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) |
| 1518 | % if lib.get('baselib', False): |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1519 | $(Q) rm -rf $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name} |
| 1520 | $(Q) ( mkdir -p $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/grpc ; <%text>\</%text> |
| 1521 | cd $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/grpc ; <%text>\</%text> |
| 1522 | $(AR) x $(LIBDIR)/$(CONFIG)/lib${lib.name}.a ) |
| 1523 | $(Q) for l in $(ZLIB_MERGE_LIBS) ; do ( <%text>\</%text> |
| 1524 | mkdir -p $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/zlib ; <%text>\</%text> |
| 1525 | cd $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/zlib ; <%text>\</%text> |
| 1526 | <%text>$(AR) x $${l}</%text> ) ; done |
| 1527 | $(Q) for l in $(ZLIB_MERGE_LIBS) ; do ( <%text>\</%text> |
| 1528 | mkdir -p $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/zlib ; <%text>\</%text> |
| 1529 | cd $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/zlib ; <%text>\</%text> |
| 1530 | <%text>$(AR) x $${l}</%text> ) ; done |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1531 | % if lib.get('secure', 'check') == True: |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1532 | $(Q) for l in $(OPENSSL_MERGE_LIBS) ; do ( <%text>\</%text> |
| 1533 | mkdir -p $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/ssl ; <%text>\</%text> |
| 1534 | cd $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/ssl ; <%text>\</%text> |
| 1535 | <%text>$(AR) x $${l}</%text> ) ; done |
| 1536 | $(Q) for l in $(OPENSSL_MERGE_LIBS) ; do ( <%text>\</%text> |
| 1537 | mkdir -p $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/ssl ; <%text>\</%text> |
| 1538 | cd $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/ssl ; <%text>\</%text> |
| 1539 | <%text>$(AR) x $${l}</%text> ) ; done |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1540 | % endif |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1541 | $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/*/__.SYMDEF* |
| 1542 | $(Q) ar rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name}/*/* |
| 1543 | $(Q) rm -rf $(BUILDDIR_ABSOLUTE)/tmp-merge-${lib.name} |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1544 | % endif |
| 1545 | ifeq ($(SYSTEM),Darwin) |
| 1546 | $(Q) ranlib $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
| 1547 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1548 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1549 | <% |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1550 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1551 | if lib.language == 'c++': |
| 1552 | ld = '$(LDXX)' |
| 1553 | else: |
| 1554 | ld = '$(LD)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1555 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1556 | out_base = '$(LIBDIR)/$(CONFIG)/' + lib.name |
| 1557 | out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1558 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1559 | common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1560 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1561 | libs = '' |
| 1562 | lib_deps = ' $(ZLIB_DEP)' |
| 1563 | mingw_libs = '' |
| 1564 | mingw_lib_deps = ' $(ZLIB_DEP)' |
| 1565 | if lib.language == 'c++': |
| 1566 | lib_deps += ' $(PROTOBUF_DEP)' |
| 1567 | mingw_lib_deps += ' $(PROTOBUF_DEP)' |
Jan Tattermusch | 324140c | 2016-01-12 08:54:01 -0800 | [diff] [blame] | 1568 | if lib.get('deps_linkage', None) == 'static': |
| 1569 | for dep in lib.get('deps', []): |
| 1570 | lib_archive = '$(LIBDIR)/$(CONFIG)/lib' + dep + '.a' |
| 1571 | common = common + ' ' + lib_archive |
| 1572 | lib_deps = lib_deps + ' ' + lib_archive |
| 1573 | mingw_lib_deps = mingw_lib_deps + ' ' + lib_archive |
| 1574 | else: |
| 1575 | for dep in lib.get('deps', []): |
| 1576 | libs = libs + ' -l' + dep |
| 1577 | lib_deps = lib_deps + ' $(LIBDIR)/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)' |
| 1578 | mingw_libs = mingw_libs + ' -l' + dep + '-imp' |
| 1579 | mingw_lib_deps = mingw_lib_deps + ' $(LIBDIR)/$(CONFIG)/' + dep + '.$(SHARED_EXT)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1580 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1581 | security = lib.get('secure', 'check') |
| 1582 | if security == True: |
| 1583 | common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)' |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1584 | common = common + ' $(ZLIB_MERGE_LIBS)' |
Nicolas "Pixel" Noble | a7c162c | 2015-07-24 20:21:51 +0200 | [diff] [blame] | 1585 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1586 | if security in [True, 'check']: |
| 1587 | for src in lib.src: |
| 1588 | if not proto_re.match(src): |
| 1589 | sources_that_need_openssl.add(src) |
| 1590 | else: |
| 1591 | for src in lib.src: |
| 1592 | sources_that_don_t_need_openssl.add(src) |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1593 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1594 | if 'zookeeper' in lib.get('external_deps', []): |
| 1595 | libs = libs + ' -lzookeeper_mt' |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1596 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1597 | if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 1598 | lib_deps = lib_deps + ' $(OPENSSL_DEP)' |
| 1599 | mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)' |
Nicolas "Pixel" Noble | dda049c | 2015-02-21 00:39:32 +0100 | [diff] [blame] | 1600 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1601 | if lib.language == 'c++': |
| 1602 | common = common + ' $(LDLIBSXX) $(LDLIBS_PROTOBUF)' |
| 1603 | %> |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1604 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1605 | % if lib.build == "all": |
| 1606 | ifeq ($(SYSTEM),MINGW32) |
| 1607 | ${out_base}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps} |
| 1608 | $(E) "[LD] Linking $@" |
| 1609 | $(Q) mkdir -p `dirname $@` |
| 1610 | $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=${out_base}.def -Wl,--out-implib=${out_libbase}-imp.a -o ${out_base}.$(SHARED_EXT) ${common}${mingw_libs} |
| 1611 | else |
| 1612 | ${out_libbase}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${lib_deps} |
| 1613 | $(E) "[LD] Linking $@" |
| 1614 | $(Q) mkdir -p `dirname $@` |
| 1615 | ifeq ($(SYSTEM),Darwin) |
| 1616 | $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name lib${lib.name}.$(SHARED_EXT) -dynamiclib -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} |
| 1617 | else |
| 1618 | $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.version.major} -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} |
| 1619 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so.${settings.version.major} |
| 1620 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so |
| 1621 | endif |
| 1622 | endif |
| 1623 | % endif |
| 1624 | % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 1625 | ## If the lib was secure, we have to close the Makefile's if that tested |
| 1626 | ## the presence of OpenSSL. |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1627 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1628 | endif |
| 1629 | % endif |
| 1630 | % if lib.language == 'c++': |
| 1631 | ## If the lib was C++, we have to close the Makefile's if that tested |
| 1632 | ## the presence of protobuf 3.0.0+ |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1633 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1634 | endif |
| 1635 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1636 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1637 | % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 1638 | ifneq ($(NO_SECURE),true) |
| 1639 | % endif |
| 1640 | ifneq ($(NO_DEPS),true) |
| 1641 | -include $(LIB${lib.name.upper()}_OBJS:.o=.dep) |
| 1642 | endif |
| 1643 | % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 1644 | endif |
| 1645 | % endif |
| 1646 | % for src in lib.src: |
| 1647 | % if not proto_re.match(src) and any(proto_re.match(src2) for src2 in lib.src): |
| 1648 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: ${' '.join(proto_to_cc(src2) for src2 in lib.src if proto_re.match(src2))} |
| 1649 | % endif |
| 1650 | % endfor |
| 1651 | </%def> |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1652 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1653 | <%def name="maketarget(tgt)"><% has_no_sources = not tgt.src %> |
| 1654 | % if not has_no_sources: |
| 1655 | ${tgt.name.upper()}_SRC = \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1656 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1657 | % for src in tgt.src: |
| 1658 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1659 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1660 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1661 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1662 | ${tgt.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC)))) |
| 1663 | % endif |
| 1664 | % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check': |
| 1665 | ifeq ($(NO_SECURE),true) |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1666 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1667 | # You can't build secure targets if you don't have OpenSSL. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1668 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1669 | $(BINDIR)/$(CONFIG)/${tgt.name}: openssl_dep_error |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1670 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1671 | else |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1672 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1673 | % endif |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1674 | |
| 1675 | % if tgt.boringssl: |
| 1676 | # boringssl needs an override to ensure that it does not include |
| 1677 | # system openssl headers regardless of other configuration |
| 1678 | # we do so here with a target specific variable assignment |
| 1679 | $(${tgt.name.upper()}_OBJS): CFLAGS := -Ithird_party/boringssl/include $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value |
| 1680 | $(${tgt.name.upper()}_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) |
| 1681 | $(${tgt.name.upper()}_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE |
| 1682 | % else: |
| 1683 | % endif |
| 1684 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1685 | ## |
| 1686 | ## We're not trying to add a dependency on building zlib and openssl here, |
| 1687 | ## as it's already done in the libraries. We're assuming that the build |
| 1688 | ## trickles down, and that a secure target requires a secure version of |
| 1689 | ## a library. |
| 1690 | ## |
| 1691 | ## That simplifies the codegen a bit, but prevents a fully defined Makefile. |
| 1692 | ## I can live with that. |
| 1693 | ## |
| 1694 | % if tgt.build == 'protoc' or tgt.language == 'c++': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1695 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1696 | ifeq ($(NO_PROTOBUF),true) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1697 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1698 | # You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1699 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1700 | $(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1701 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1702 | else |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1703 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1704 | $(BINDIR)/$(CONFIG)/${tgt.name}: \ |
| 1705 | % if not has_no_sources: |
| 1706 | $(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\ |
| 1707 | % endif |
| 1708 | % else: |
| 1709 | $(BINDIR)/$(CONFIG)/${tgt.name}: \ |
| 1710 | % if not has_no_sources: |
| 1711 | $(${tgt.name.upper()}_OBJS)\ |
| 1712 | % endif |
| 1713 | % endif |
| 1714 | % for dep in tgt.deps: |
| 1715 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
| 1716 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1717 | |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1718 | % if tgt.language == "c++" or tgt.boringssl: |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1719 | ## C++ targets specificies. |
| 1720 | % if tgt.build == 'protoc': |
| 1721 | $(E) "[HOSTLD] Linking $@" |
| 1722 | $(Q) mkdir -p `dirname $@` |
| 1723 | $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) \ |
| 1724 | % if not has_no_sources: |
| 1725 | $(${tgt.name.upper()}_OBJS)\ |
| 1726 | % endif |
| 1727 | % else: |
| 1728 | $(E) "[LD] Linking $@" |
| 1729 | $(Q) mkdir -p `dirname $@` |
| 1730 | $(Q) $(LDXX) $(LDFLAGS) \ |
| 1731 | % if not has_no_sources: |
| 1732 | $(${tgt.name.upper()}_OBJS)\ |
| 1733 | % endif |
| 1734 | % endif |
| 1735 | % else: |
| 1736 | ## C-only targets specificities. |
| 1737 | $(E) "[LD] Linking $@" |
| 1738 | $(Q) mkdir -p `dirname $@` |
| 1739 | $(Q) $(LD) $(LDFLAGS) \ |
| 1740 | % if not has_no_sources: |
| 1741 | $(${tgt.name.upper()}_OBJS)\ |
| 1742 | % endif |
| 1743 | % endif |
| 1744 | % for dep in tgt.deps: |
| 1745 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
| 1746 | % endfor |
| 1747 | % if 'zookeeper' in tgt.get('external_deps', []): |
| 1748 | -lzookeeper_mt\ |
| 1749 | % endif |
| 1750 | % if tgt.language == "c++": |
| 1751 | % if tgt.build == 'protoc': |
| 1752 | $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC)\ |
| 1753 | % else: |
| 1754 | $(LDLIBSXX) $(LDLIBS_PROTOBUF)\ |
| 1755 | % endif |
| 1756 | % endif |
| 1757 | % if tgt.build == 'protoc': |
| 1758 | $(HOST_LDLIBS)\ |
| 1759 | % else: |
| 1760 | $(LDLIBS)\ |
| 1761 | % endif |
| 1762 | % if tgt.build == 'protoc': |
| 1763 | $(HOST_LDLIBS_PROTOC)\ |
| 1764 | % elif tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check': |
| 1765 | $(LDLIBS_SECURE)\ |
| 1766 | % endif |
| 1767 | % if tgt.language == 'c++' and tgt.build == 'test': |
| 1768 | $(GTEST_LIB)\ |
| 1769 | % elif tgt.language == 'c++' and tgt.build == 'benchmark': |
| 1770 | $(GTEST_LIB)\ |
| 1771 | % endif |
| 1772 | -o $(BINDIR)/$(CONFIG)/${tgt.name} |
| 1773 | % if tgt.build == 'protoc' or tgt.language == 'c++': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1774 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1775 | endif |
| 1776 | % endif |
| 1777 | % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1778 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1779 | endif |
| 1780 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1781 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1782 | % for src in tgt.src: |
| 1783 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \ |
| 1784 | % for dep in tgt.deps: |
| 1785 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
| 1786 | % endfor |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 1787 | |
Craig Tiller | ab23045 | 2016-01-04 08:18:43 -0800 | [diff] [blame] | 1788 | % if tgt.language == 'c89': |
| 1789 | % for src in tgt.src: |
Craig Tiller | ea21ca2 | 2016-01-04 12:34:29 -0800 | [diff] [blame] | 1790 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o : ${src} |
| 1791 | $(E) "[C] Compiling $<" |
| 1792 | $(Q) mkdir -p `dirname $@` |
| 1793 | $(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -std=c89 -pedantic -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Craig Tiller | ab23045 | 2016-01-04 08:18:43 -0800 | [diff] [blame] | 1794 | % endfor |
| 1795 | % endif |
| 1796 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1797 | % endfor |
| 1798 | % if not has_no_sources: |
| 1799 | deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep) |
| 1800 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1801 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1802 | % if not has_no_sources: |
| 1803 | % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check': |
| 1804 | ifneq ($(NO_SECURE),true) |
| 1805 | % endif |
| 1806 | ifneq ($(NO_DEPS),true) |
| 1807 | -include $(${tgt.name.upper()}_OBJS:.o=.dep) |
| 1808 | endif |
| 1809 | % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check': |
| 1810 | endif |
| 1811 | % endif |
| 1812 | % endif |
Nicolas "Pixel" Noble | 472bb68 | 2015-11-03 19:09:01 +0100 | [diff] [blame] | 1813 | % for src in tgt.src: |
| 1814 | % if not proto_re.match(src) and any(proto_re.match(src2) for src2 in tgt.src): |
| 1815 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: ${' '.join(proto_to_cc(src2) for src2 in tgt.src if proto_re.match(src2))} |
| 1816 | % endif |
| 1817 | % endfor |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1818 | </%def> |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1819 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1820 | ifneq ($(OPENSSL_DEP),) |
| 1821 | # This is to ensure the embedded OpenSSL is built beforehand, properly |
| 1822 | # installing headers to their final destination on the drive. We need this |
| 1823 | # otherwise parallel compilation will fail if a source is compiled first. |
| 1824 | % for src in sorted(sources_that_need_openssl): |
| 1825 | % if src not in sources_that_don_t_need_openssl: |
| 1826 | ${src}: $(OPENSSL_DEP) |
| 1827 | % endif |
| 1828 | % endfor |
| 1829 | endif |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1830 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1831 | .PHONY: all strip tools \ |
| 1832 | dep_error openssl_dep_error openssl_dep_message git_update stop \ |
| 1833 | buildtests buildtests_c buildtests_cxx \ |
| 1834 | test test_c test_cxx \ |
| 1835 | install install_c install_cxx \ |
| 1836 | install-headers install-headers_c install-headers_cxx \ |
| 1837 | install-shared install-shared_c install-shared_cxx \ |
| 1838 | install-static install-static_c install-static_cxx \ |
| 1839 | strip strip-shared strip-static \ |
| 1840 | strip_c strip-shared_c strip-static_c \ |
| 1841 | strip_cxx strip-shared_cxx strip-static_cxx \ |
| 1842 | dep_c dep_cxx bins_dep_c bins_dep_cxx \ |
| 1843 | clean |