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