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