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