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 | |
Craig Tiller | 6169d5f | 2016-03-31 07:46:18 -0700 | [diff] [blame^] | 10 | # Copyright 2015, 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_) |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 60 | SYSTEM ?= $(HOST_SYSTEM) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 61 | ifeq ($(SYSTEM),MSYS) |
| 62 | SYSTEM = MINGW32 |
| 63 | endif |
| 64 | ifeq ($(SYSTEM),MINGW64) |
| 65 | SYSTEM = MINGW32 |
| 66 | endif |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 67 | |
| 68 | |
Nicolas "Pixel" Noble | 6dad9b0 | 2015-09-23 18:32:26 +0200 | [diff] [blame] | 69 | MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 70 | ifndef BUILDDIR |
Nicolas "Pixel" Noble | 42b4c28 | 2015-09-17 23:57:08 +0200 | [diff] [blame] | 71 | BUILDDIR_ABSOLUTE = $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) |
| 72 | else |
| 73 | BUILDDIR_ABSOLUTE = $(abspath $(BUILDDIR)) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 74 | endif |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 75 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 76 | HAS_GCC = $(shell which gcc > /dev/null 2> /dev/null && echo true || echo false) |
| 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) |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 79 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 97 | |
| 98 | |
Nicolas "Pixel" Noble | 42b4c28 | 2015-09-17 23:57:08 +0200 | [diff] [blame] | 99 | BINDIR = $(BUILDDIR_ABSOLUTE)/bins |
| 100 | OBJDIR = $(BUILDDIR_ABSOLUTE)/objs |
| 101 | LIBDIR = $(BUILDDIR_ABSOLUTE)/libs |
| 102 | GENDIR = $(BUILDDIR_ABSOLUTE)/gens |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 103 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 104 | # Configurations |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 105 | |
Craig Tiller | a0f8517 | 2016-01-20 15:56:06 -0800 | [diff] [blame] | 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 |
Craig Tiller | aff3d50 | 2016-01-20 15:59:31 -0800 | [diff] [blame] | 111 | % for tool, default in [('CC', 'CC'), ('CXX', 'CXX'), ('LD', 'CC'), ('LDXX', 'CXX')]: |
Craig Tiller | a0f8517 | 2016-01-20 15:56:06 -0800 | [diff] [blame] | 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 |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 122 | |
Craig Tiller | a0f8517 | 2016-01-20 15:56:06 -0800 | [diff] [blame] | 123 | % endfor |
Craig Tiller | 699ba21 | 2015-01-13 17:02:20 -0800 | [diff] [blame] | 124 | |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 125 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 126 | # General settings. |
| 127 | # You may want to change these depending on your system. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 128 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 129 | prefix ?= /usr/local |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 130 | |
Nicolas "Pixel" Noble | 1a8eb85 | 2016-01-26 22:33:19 +0100 | [diff] [blame] | 131 | PROTOC ?= protoc |
| 132 | DTRACE ?= dtrace |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 133 | CONFIG ?= opt |
Nicolas "Pixel" Noble | fba36bc | 2016-01-27 03:24:03 +0100 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | 1a8eb85 | 2016-01-26 22:33:19 +0100 | [diff] [blame] | 153 | LDXX ?= $(LDXX_$(CONFIG)) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 154 | ifeq ($(SYSTEM),Linux) |
Nicolas "Pixel" Noble | 6e72dae | 2016-02-03 04:23:08 +0100 | [diff] [blame] | 155 | ifeq ($(origin AR), default) |
| 156 | AR = ar rcs |
| 157 | endif |
Nicolas "Pixel" Noble | 1a8eb85 | 2016-01-26 22:33:19 +0100 | [diff] [blame] | 158 | STRIP ?= strip --strip-unneeded |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 159 | else |
| 160 | ifeq ($(SYSTEM),Darwin) |
Nicolas "Pixel" Noble | 6e72dae | 2016-02-03 04:23:08 +0100 | [diff] [blame] | 161 | ifeq ($(origin AR), default) |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 162 | AR = libtool -no_warning_for_no_symbols -o |
Nicolas "Pixel" Noble | 6e72dae | 2016-02-03 04:23:08 +0100 | [diff] [blame] | 163 | endif |
Nicolas "Pixel" Noble | 1a8eb85 | 2016-01-26 22:33:19 +0100 | [diff] [blame] | 164 | STRIP ?= strip -x |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 165 | else |
Nicolas "Pixel" Noble | 6e72dae | 2016-02-03 04:23:08 +0100 | [diff] [blame] | 166 | ifeq ($(origin AR), default) |
| 167 | AR = ar rcs |
| 168 | endif |
Nicolas "Pixel" Noble | 1a8eb85 | 2016-01-26 22:33:19 +0100 | [diff] [blame] | 169 | STRIP ?= strip |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 170 | endif |
| 171 | endif |
Nicolas "Pixel" Noble | 1a8eb85 | 2016-01-26 22:33:19 +0100 | [diff] [blame] | 172 | INSTALL ?= install |
| 173 | RM ?= rm -f |
| 174 | PKG_CONFIG ?= pkg-config |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 175 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 176 | ifndef VALID_CONFIG_$(CONFIG) |
| 177 | $(error Invalid CONFIG value '$(CONFIG)') |
| 178 | endif |
yangg | 102e4fe | 2015-01-06 16:02:50 -0800 | [diff] [blame] | 179 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 180 | ifeq ($(SYSTEM),Linux) |
| 181 | TMPOUT = /dev/null |
| 182 | else |
| 183 | TMPOUT = `mktemp /tmp/test-out-XXXXXX` |
| 184 | endif |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 185 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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) |
Craig Tiller | cf133f4 | 2015-02-26 14:05:56 -0800 | [diff] [blame] | 189 | |
Craig Tiller | 804b855 | 2016-02-23 16:50:24 -0800 | [diff] [blame] | 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 true || echo false) |
| 192 | ifeq ($(HAS_WORKING_SHADOW),true) |
| 193 | W_SHADOW=-Wshadow |
| 194 | endif |
| 195 | |
Craig Tiller | 82f3f0d | 2016-01-25 11:27:42 -0800 | [diff] [blame] | 196 | 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] | 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 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 206 | |
Nicolas "Pixel" Noble | 1a8eb85 | 2016-01-26 22:33:19 +0100 | [diff] [blame] | 207 | HOST_CC ?= $(CC) |
| 208 | HOST_CXX ?= $(CXX) |
| 209 | HOST_LD ?= $(LD) |
| 210 | HOST_LDXX ?= $(LDXX) |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 211 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 212 | ifdef EXTRA_DEFINES |
| 213 | DEFINES += $(EXTRA_DEFINES) |
| 214 | endif |
Craig Tiller | 86fa1c5 | 2015-02-27 09:57:58 -0800 | [diff] [blame] | 215 | |
Craig Tiller | 804b855 | 2016-02-23 16:50:24 -0800 | [diff] [blame] | 216 | CFLAGS += -std=c99 -Wsign-conversion -Wconversion $(W_SHADOW) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 217 | ifeq ($(HAS_CXX11),true) |
| 218 | CXXFLAGS += -std=c++11 |
| 219 | else |
| 220 | CXXFLAGS += -std=c++0x |
| 221 | endif |
Nicolas "Pixel" Noble | 51b1aee | 2016-01-28 01:14:58 +0100 | [diff] [blame] | 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 |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 227 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 228 | CPPFLAGS += $(CPPFLAGS_$(CONFIG)) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 229 | CFLAGS += $(CFLAGS_$(CONFIG)) |
| 230 | CXXFLAGS += $(CXXFLAGS_$(CONFIG)) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 231 | DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\" |
| 232 | LDFLAGS += $(LDFLAGS_$(CONFIG)) |
Nicolas "Pixel" Noble | 482d761 | 2015-07-16 23:43:30 +0200 | [diff] [blame] | 233 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 234 | ifneq ($(SYSTEM),MINGW32) |
| 235 | PIC_CPPFLAGS = -fPIC |
| 236 | CPPFLAGS += -fPIC |
| 237 | LDFLAGS += -fPIC |
| 238 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 239 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 240 | INCLUDES = . include $(GENDIR) |
| 241 | LDFLAGS += -Llibs/$(CONFIG) |
Nicolas "Pixel" Noble | 3adab74 | 2015-06-02 00:33:06 +0200 | [diff] [blame] | 242 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
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 | ifeq ($(SYSTEM),Linux) |
Craig Tiller | 1b1e238 | 2016-02-03 07:33:56 -0800 | [diff] [blame] | 266 | LIBS = dl rt m pthread |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 267 | LDFLAGS += -pthread |
| 268 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 269 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 270 | ifeq ($(SYSTEM),MINGW32) |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 271 | LIBS = m pthread ws2_32 |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 272 | LDFLAGS += -pthread |
| 273 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 274 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 275 | GTEST_LIB = -Ithird_party/googletest/include -Ithird_party/googletest third_party/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 |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 284 | |
Craig Tiller | f008f06 | 2016-02-08 12:48:03 -0800 | [diff] [blame] | 285 | VERSION = ${settings.core_version} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 286 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 287 | CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) |
| 288 | CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) |
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 | LDFLAGS += $(ARCH_FLAGS) |
| 291 | LDLIBS += $(addprefix -l, $(LIBS)) |
| 292 | LDLIBSXX += $(addprefix -l, $(LIBSXX)) |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 293 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 294 | HOST_CPPFLAGS = $(CPPFLAGS) |
| 295 | HOST_CFLAGS = $(CFLAGS) |
| 296 | HOST_CXXFLAGS = $(CXXFLAGS) |
| 297 | HOST_LDFLAGS = $(LDFLAGS) |
| 298 | HOST_LDLIBS = $(LDLIBS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 299 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 300 | # These are automatically computed variables. |
| 301 | # There shouldn't be any need to change anything from now on. |
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 | -include cache.mk |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 304 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 305 | CACHE_MK = |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 306 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 307 | 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] | 308 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 309 | ifeq ($(HAS_PKG_CONFIG), true) |
| 310 | CACHE_MK += HAS_PKG_CONFIG = true, |
| 311 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 312 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 325 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 326 | ifeq ($(SYSTEM),MINGW32) |
| 327 | SHARED_EXT = dll |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 328 | SHARED_PREFIX = |
Craig Tiller | f008f06 | 2016-02-08 12:48:03 -0800 | [diff] [blame] | 329 | SHARED_VERSION = -${settings.core_version.major} |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 330 | else ifeq ($(SYSTEM),Darwin) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 331 | SHARED_EXT = dylib |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 332 | SHARED_PREFIX = lib |
| 333 | SHARED_VERSION = |
| 334 | else |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 335 | SHARED_EXT = so.$(VERSION) |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 336 | SHARED_PREFIX = lib |
| 337 | SHARED_VERSION = |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 338 | endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 339 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 340 | ifeq ($(wildcard .git),) |
| 341 | IS_GIT_FOLDER = false |
| 342 | else |
| 343 | IS_GIT_FOLDER = true |
| 344 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 345 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 352 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 353 | ifeq ($(SYSTEM),MINGW32) |
| 354 | OPENSSL_LIBS = ssl32 eay32 |
| 355 | else |
| 356 | OPENSSL_LIBS = ssl crypto |
| 357 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 358 | |
Nicolas "Pixel" Noble | 4500034 | 2016-01-28 05:04:45 +0100 | [diff] [blame] | 359 | OPENSSL_ALPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) |
| 360 | OPENSSL_NPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) |
Craig Tiller | b79c1e1 | 2016-02-23 10:00:58 -0800 | [diff] [blame] | 361 | BORINGSSL_COMPILE_CHECK_CMD = $(CC) $(CPPFLAGS) ${defaults.boringssl.CPPFLAGS} $(CFLAGS) ${defaults.boringssl.CFLAGS} -o $(TMPOUT) test/build/boringssl.c $(LDFLAGS) |
Nicolas "Pixel" Noble | 4500034 | 2016-01-28 05:04:45 +0100 | [diff] [blame] | 362 | ZLIB_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) |
| 363 | 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] | 364 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 365 | endif # HAS_PKG_CONFIG |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 366 | |
Nicolas "Pixel" Noble | 4500034 | 2016-01-28 05:04:45 +0100 | [diff] [blame] | 367 | 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] | 368 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | 4500034 | 2016-01-28 05:04:45 +0100 | [diff] [blame] | 372 | SYSTEMTAP_HEADERS_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/systemtap.c $(LDFLAGS) |
| 373 | 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] | 374 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 375 | ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) |
| 376 | HAS_SYSTEM_PERFTOOLS ?= $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || 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 |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 383 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 384 | HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 385 | ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) |
| 386 | HAS_SYSTEM_OPENSSL_ALPN ?= $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo 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 && echo 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 |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 411 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 412 | HAS_PROTOC ?= $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 413 | ifeq ($(HAS_PROTOC),true) |
| 414 | CACHE_MK += HAS_PROTOC = true, |
| 415 | HAS_VALID_PROTOC ?= $(shell $(PROTOC_CHECK_VERSION_CMD) 2> /dev/null && echo true || 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 |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 422 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 423 | # Check for Systemtap (https://sourceware.org/systemtap/), first by making sure <sys/sdt.h> is present |
| 424 | # in the system and secondly by checking for the "dtrace" binary (on Linux, this 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 false) |
| 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 |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 436 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 437 | ifeq ($(HAS_SYSTEMTAP),true) |
| 438 | CACHE_MK += HAS_SYSTEMTAP = true, |
| 439 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 440 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 441 | 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] | 442 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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. |
Craig Tiller | b79c1e1 | 2016-02-23 10:00:58 -0800 | [diff] [blame] | 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),) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 449 | HAS_EMBEDDED_OPENSSL_ALPN = false |
| 450 | else |
Craig Tiller | b79c1e1 | 2016-02-23 10:00:58 -0800 | [diff] [blame] | 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) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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/zlib/zlib.h),) |
| 456 | HAS_EMBEDDED_ZLIB = false |
| 457 | else |
| 458 | HAS_EMBEDDED_ZLIB = true |
| 459 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 460 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 469 | |
Nicolas "Pixel" Noble | 0912179 | 2016-01-30 09:01:53 +0100 | [diff] [blame] | 470 | PC_REQUIRES_GRPC = |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 471 | PC_LIBS_GRPC = |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 472 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 473 | ifeq ($(HAS_SYSTEM_ZLIB),false) |
Craig Tiller | 3dca23a | 2016-01-21 11:44:55 -0800 | [diff] [blame] | 474 | ifeq ($(HAS_EMBEDDED_ZLIB), true) |
| 475 | EMBED_ZLIB ?= true |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 476 | else |
| 477 | DEP_MISSING += zlib |
Craig Tiller | 3dca23a | 2016-01-21 11:44:55 -0800 | [diff] [blame] | 478 | EMBED_ZLIB ?= broken |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 479 | endif |
| 480 | else |
Craig Tiller | 3dca23a | 2016-01-21 11:44:55 -0800 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | f51a901 | 2016-02-03 07:39:43 +0100 | [diff] [blame] | 487 | ZLIB_MERGE_OBJS = $(LIBZ_OBJS) |
Craig Tiller | 3dca23a | 2016-01-21 11:44:55 -0800 | [diff] [blame] | 488 | CPPFLAGS += -Ithird_party/zlib |
| 489 | LDFLAGS += -L$(LIBDIR)/$(CONFIG)/zlib |
| 490 | else |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 491 | ifeq ($(HAS_PKG_CONFIG),true) |
| 492 | CPPFLAGS += $(shell $(PKG_CONFIG) --cflags zlib) |
| 493 | LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L zlib) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 494 | LIBS += $(patsubst -l%,%,$(shell $(PKG_CONFIG) --libs-only-l zlib)) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 495 | PC_REQUIRES_GRPC += zlib |
| 496 | else |
| 497 | PC_LIBS_GRPC += -lz |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 498 | LIBS += z |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 499 | endif |
| 500 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 501 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 502 | OPENSSL_PKG_CONFIG = false |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 503 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 504 | PC_REQUIRES_SECURE = |
| 505 | PC_LIBS_SECURE = |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 506 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 507 | ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 508 | EMBED_OPENSSL ?= false |
| 509 | NO_SECURE ?= false |
| 510 | else # HAS_SYSTEM_OPENSSL_ALPN=false |
Craig Tiller | b79c1e1 | 2016-02-23 10:00:58 -0800 | [diff] [blame] | 511 | ifneq ($(HAS_EMBEDDED_OPENSSL_ALPN),false) |
| 512 | EMBED_OPENSSL ?= $(HAS_EMBEDDED_OPENSSL_ALPN) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | f51a901 | 2016-02-03 07:39:43 +0100 | [diff] [blame] | 530 | OPENSSL_MERGE_OBJS += $(LIBBORINGSSL_OBJS) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 531 | # need to prefix these to ensure overriding system libraries |
| 532 | CPPFLAGS := -Ithird_party/boringssl/include $(CPPFLAGS) |
Craig Tiller | b79c1e1 | 2016-02-23 10:00:58 -0800 | [diff] [blame] | 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) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 539 | else # EMBED_OPENSSL=false |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 | sed s/L/Wl,-rpath,/) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 548 | endif # LDFLAGS_OPENSSL_PKG_CONFIG='' |
| 549 | endif # System=Linux |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 550 | LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 551 | else # HAS_PKG_CONFIG=false |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 552 | LIBS_SECURE = $(OPENSSL_LIBS) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 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 |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 558 | PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 559 | endif # EMBED_OPENSSL |
| 560 | endif # NO_SECURE |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 561 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 567 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 568 | # grpc .pc file |
| 569 | PC_NAME = gRPC |
Craig Tiller | da179ce | 2016-02-09 12:01:53 -0800 | [diff] [blame] | 570 | PC_DESCRIPTION = high performance general RPC framework |
| 571 | PC_CFLAGS = |
| 572 | PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) $(PC_REQUIRES_SECURE) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 573 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) $(PC_LIBS_SECURE) |
| 574 | PC_LIB = -lgrpc |
| 575 | GRPC_PC_FILE := $(PC_TEMPLATE) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 576 | |
Craig Tiller | 4a67be4 | 2016-02-09 12:40:32 -0800 | [diff] [blame] | 577 | # grpc_unsecure .pc file |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 578 | PC_NAME = gRPC unsecure |
Craig Tiller | da179ce | 2016-02-09 12:01:53 -0800 | [diff] [blame] | 579 | PC_DESCRIPTION = high performance general RPC framework without SSL |
| 580 | PC_CFLAGS = |
| 581 | PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 582 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) |
| 583 | PC_LIB = -lgrpc |
| 584 | GRPC_UNSECURE_PC_FILE := $(PC_TEMPLATE) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 585 | |
Craig Tiller | 4a67be4 | 2016-02-09 12:40:32 -0800 | [diff] [blame] | 586 | # grpc_zookeeper .pc file |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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) |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 593 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 594 | PROTOBUF_PKG_CONFIG = false |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 595 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 596 | PC_REQUIRES_GRPCXX = |
| 597 | PC_LIBS_GRPCXX = |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 598 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 599 | CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS) |
Craig Tiller | 16f6dac | 2015-08-24 17:00:04 -0700 | [diff] [blame] | 600 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 625 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 626 | LIBS_PROTOBUF = protobuf |
| 627 | LIBS_PROTOC = protoc protobuf |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 628 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 629 | HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 630 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 636 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 645 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 654 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 655 | ifeq ($(MAKECMDGOALS),clean) |
| 656 | NO_DEPS = true |
| 657 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 658 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 665 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 666 | .SECONDARY = %.pb.h %.pb.cc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 667 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 668 | PROTOC_PLUGINS =\ |
| 669 | % for tgt in targets: |
| 670 | % if tgt.build == 'protoc': |
| 671 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 672 | % endif |
| 673 | % endfor |
Craig Tiller | f58b9ef | 2015-01-15 09:09:12 -0800 | [diff] [blame] | 674 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 682 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 683 | dep_error: |
| 684 | @echo "You shouldn't see this message - all of your dependencies are correct." |
| 685 | else |
| 686 | all: dep_error git_update stop |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 687 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 688 | dep_error: |
| 689 | @echo |
| 690 | @echo "DEPENDENCY ERROR" |
| 691 | @echo |
| 692 | @echo "You are missing system dependencies that are essential to build grpc," |
| 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 |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 705 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 command:" |
| 710 | @echo |
| 711 | @echo " git submodule update --init" |
| 712 | @echo |
| 713 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 714 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 715 | openssl_dep_error: openssl_dep_message git_update stop |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 716 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 717 | protobuf_dep_error: protobuf_dep_message git_update stop |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 718 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 719 | protoc_dep_error: protoc_dep_message git_update stop |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 720 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 721 | openssl_dep_message: |
| 722 | @echo |
| 723 | @echo "DEPENDENCY ERROR" |
| 724 | @echo |
Craig Tiller | b79c1e1 | 2016-02-23 10:00:58 -0800 | [diff] [blame] | 725 | @echo "The target you are trying to run requires an OpenSSL implementation." |
| 726 | @echo "Your system doesn't have one, and either the third_party directory" |
| 727 | @echo "doesn't have it, or your compiler can't build BoringSSL." |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 735 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 directory." |
| 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 |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 749 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 directory." |
| 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 |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 763 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
David Garcia Quintas | 8954e90 | 2015-04-29 09:46:33 -0700 | [diff] [blame] | 774 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 775 | stop: |
| 776 | @false |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 777 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 778 | % for tgt in targets: |
| 779 | ${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name} |
| 780 | % endfor |
ctiller | 09cb6d5 | 2014-12-19 17:38:22 -0800 | [diff] [blame] | 781 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 790 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 791 | third_party/protobuf/configure: |
| 792 | $(E) "[AUTOGEN] Preparing protobuf" |
| 793 | $(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 794 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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="$(LDFLAGS_$(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)/protobuf |
| 803 | $(Q)cp third_party/protobuf/src/.libs/libprotobuf.a $(LIBDIR)/$(CONFIG)/protobuf |
| 804 | $(Q)cp third_party/protobuf/src/protoc $(BINDIR)/$(CONFIG)/protobuf |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 805 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 806 | static: static_c static_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 807 | |
Nicolas "Pixel" Noble | 0912179 | 2016-01-30 09:01:53 +0100 | [diff] [blame] | 808 | static_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper\ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 809 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 810 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 814 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 815 | % endfor |
| 816 | static_zookeeper_libs |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 817 | |
| 818 | |
Nicolas "Pixel" Noble | 0912179 | 2016-01-30 09:01:53 +0100 | [diff] [blame] | 819 | static_cxx: pc_cxx pc_cxx_unsecure cache.mk \ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 820 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 821 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 822 | % if lib.build == 'all' and lib.language == 'c++': |
| 823 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 824 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 825 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 826 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 827 | |
| 828 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 829 | shared: shared_c shared_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 830 | |
Nicolas "Pixel" Noble | 0912179 | 2016-01-30 09:01:53 +0100 | [diff] [blame] | 831 | shared_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper\ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 832 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 833 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 834 | % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None): |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 835 | $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)\ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 836 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 837 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 838 | % endfor |
| 839 | shared_zookeeper_libs |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 840 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 841 | shared_cxx: pc_cxx pc_cxx_unsecure cache.mk\ |
| 842 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 843 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 844 | % if lib.build == 'all' and lib.language == 'c++': |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 845 | $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)\ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 846 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 847 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 848 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 849 | |
| 850 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 851 | shared_csharp: shared_c \ |
| 852 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 853 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 854 | % if lib.build == 'all' and lib.language == 'csharp': |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 855 | $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)\ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 856 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 857 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 858 | % endfor |
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 | ifeq ($(HAS_ZOOKEEPER),true) |
| 861 | static_zookeeper_libs:\ |
| 862 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 863 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 864 | % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []): |
| 865 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 866 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 867 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 868 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 869 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 870 | shared_zookeeper_libs:\ |
| 871 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 872 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 873 | % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []): |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 874 | $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)\ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 875 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 876 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 877 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 878 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 879 | else |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 880 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 881 | static_zookeeper_libs: |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 882 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 883 | shared_zookeeper_libs: |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 884 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 885 | endif |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 886 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 887 | grpc_csharp_ext: shared_csharp |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 888 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 889 | plugins: $(PROTOC_PLUGINS) |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 890 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 891 | privatelibs: privatelibs_c privatelibs_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 892 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 893 | privatelibs_c: \ |
| 894 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 895 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 896 | % 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] | 897 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 898 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 899 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 900 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 901 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 902 | pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 903 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 904 | pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 905 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 906 | ifeq ($(HAS_ZOOKEEPER),true) |
| 907 | pc_c_zookeeper: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc |
| 908 | else |
| 909 | pc_c_zookeeper: |
| 910 | endif |
Hongwei Wang | a3780a8 | 2015-07-17 15:27:18 -0700 | [diff] [blame] | 911 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 912 | pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 913 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 914 | pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 915 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 916 | privatelibs_cxx: \ |
| 917 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 918 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 919 | % if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None): |
| 920 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 921 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 922 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 923 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 924 | |
| 925 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 926 | ifeq ($(HAS_ZOOKEEPER),true) |
| 927 | privatelibs_zookeeper: \ |
| 928 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 929 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 933 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 934 | % endfor |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 935 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 936 | else |
| 937 | privatelibs_zookeeper: |
| 938 | endif |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 939 | |
| 940 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 941 | buildtests: buildtests_c buildtests_cxx buildtests_zookeeper |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 942 | |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 943 | buildtests_c: privatelibs_c <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 944 | % for tgt in targets: |
| 945 | % 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] | 946 | $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 947 | % endif |
| 948 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 949 | |
| 950 | |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 951 | buildtests_cxx: buildtests_zookeeper privatelibs_cxx <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 952 | % for tgt in targets: |
| 953 | % 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] | 954 | $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 955 | % endif |
| 956 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 957 | |
| 958 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 959 | ifeq ($(HAS_ZOOKEEPER),true) |
Craig Tiller | 3824b6e | 2015-12-09 11:19:59 -0800 | [diff] [blame] | 960 | buildtests_zookeeper: privatelibs_zookeeper <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 961 | % for tgt in targets: |
| 962 | % 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] | 963 | $(BINDIR)/$(CONFIG)/${tgt.name} <%text>\</%text> |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 964 | % endif |
| 965 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 966 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 967 | else |
| 968 | buildtests_zookeeper: |
| 969 | endif |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 970 | |
| 971 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 972 | test: test_c test_cxx test_zookeeper |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 973 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 974 | flaky_test: flaky_test_c flaky_test_cxx flaky_test_zookeeper |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 975 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 983 | |
| 984 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 992 | |
| 993 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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++' and 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 |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 1001 | |
| 1002 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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++' and 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 |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1010 | |
| 1011 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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++' and 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 |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1020 | |
| 1021 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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++' and 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 |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1029 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1030 | else |
| 1031 | test_zookeeper: |
| 1032 | flaky_test_zookeeper: |
| 1033 | endif |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1034 | |
| 1035 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1036 | test_python: static_c |
| 1037 | $(E) "[RUN] Testing python code" |
| 1038 | $(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG) |
Nicolas "Pixel" Noble | 051a28f | 2015-03-17 22:54:54 +0100 | [diff] [blame] | 1039 | |
| 1040 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1041 | tools: tools_c tools_cxx |
Craig Tiller | 7552f0f | 2015-06-19 17:46:20 -0700 | [diff] [blame] | 1042 | |
| 1043 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Craig Tiller | 7552f0f | 2015-06-19 17:46:20 -0700 | [diff] [blame] | 1050 | |
| 1051 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1058 | |
| 1059 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1060 | buildbenchmarks: privatelibs\ |
| 1061 | % for tgt in targets: |
| 1062 | % if tgt.build == 'benchmark': |
| 1063 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 1064 | % endif |
| 1065 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1066 | |
| 1067 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1068 | benchmarks: buildbenchmarks |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1069 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1070 | strip: strip-static strip-shared |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1071 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1072 | strip-static: strip-static_c strip-static_cxx |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1073 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1074 | strip-shared: strip-shared_c strip-shared_cxx |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1075 | |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1076 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1080 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1081 | strip-static_c: static_c |
| 1082 | ifeq ($(CONFIG),opt) |
| 1083 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1084 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1093 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1094 | % endfor |
| 1095 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1096 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1097 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1106 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1107 | % endfor |
| 1108 | endif |
| 1109 | endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1110 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1111 | strip-static_cxx: static_cxx |
| 1112 | ifeq ($(CONFIG),opt) |
| 1113 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1114 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1121 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1122 | % endfor |
| 1123 | endif |
Nicolas "Pixel" Noble | 4ef9b86 | 2015-08-14 19:35:24 +0200 | [diff] [blame] | 1124 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1125 | strip-shared_c: shared_c |
| 1126 | ifeq ($(CONFIG),opt) |
| 1127 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1128 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1129 | % if lib.language == "c": |
| 1130 | % if lib.build == "all": |
| 1131 | % if not lib.get('external_deps', None): |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1132 | $(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)" |
| 1133 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1134 | % endif |
| 1135 | % endif |
| 1136 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1137 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1138 | % endfor |
| 1139 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1140 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1141 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1142 | % if lib.language == "c": |
| 1143 | % if lib.build == "all": |
| 1144 | % if 'zookeeper' in lib.get('external_deps', []): |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1145 | $(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)" |
| 1146 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1147 | % endif |
| 1148 | % endif |
| 1149 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1150 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1151 | % endfor |
| 1152 | endif |
| 1153 | endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1154 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1155 | strip-shared_cxx: shared_cxx |
| 1156 | ifeq ($(CONFIG),opt) |
| 1157 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1158 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1159 | % if lib.language == "c++": |
| 1160 | % if lib.build == "all": |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1161 | $(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)" |
| 1162 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1163 | % endif |
| 1164 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1165 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1166 | % endfor |
| 1167 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1168 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1169 | strip-shared_csharp: shared_csharp |
| 1170 | ifeq ($(CONFIG),opt) |
| 1171 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1172 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1173 | % if lib.language == "csharp": |
| 1174 | % if lib.build == "all": |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1175 | $(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT)" |
| 1176 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1177 | % endif |
| 1178 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1179 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1180 | % endfor |
| 1181 | endif |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1182 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1183 | cache.mk:: |
| 1184 | $(E) "[MAKE] Generating $@" |
| 1185 | $(Q) echo "$(CACHE_MK)" | tr , '\n' >$@ |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 1186 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1187 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc: |
| 1188 | $(E) "[MAKE] Generating $@" |
| 1189 | $(Q) mkdir -p $(@D) |
| 1190 | $(Q) echo "$(GRPC_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1191 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1196 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1197 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc: |
| 1198 | $(E) "[MAKE] Generating $@" |
| 1199 | $(Q) mkdir -p $(@D) |
| 1200 | $(Q) echo -e "$(GRPC_ZOOKEEPER_PC_FILE)" >$@ |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1201 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1202 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc: |
| 1203 | $(E) "[MAKE] Generating $@" |
| 1204 | $(Q) mkdir -p $(@D) |
| 1205 | $(Q) echo "$(GRPCXX_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1206 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1211 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Craig Tiller | 1b4e330 | 2015-12-17 16:35:00 -0800 | [diff] [blame] | 1217 | $(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] | 1218 | $(E) "[PROTOC] Generating protobuf CC file from $<" |
| 1219 | $(Q) mkdir -p `dirname $@` |
| 1220 | $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< |
Nicolas "Pixel" Noble | 0caebbf | 2015-04-09 23:08:51 +0200 | [diff] [blame] | 1221 | |
Craig Tiller | 1b4e330 | 2015-12-17 16:35:00 -0800 | [diff] [blame] | 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.get(p, []))} |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1227 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1228 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1229 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 1241 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1242 | $(OBJDIR)/$(CONFIG)/%.o : %.c |
| 1243 | $(E) "[C] Compiling $<" |
| 1244 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | 4500034 | 2016-01-28 05:04:45 +0100 | [diff] [blame] | 1245 | $(Q) $(CC) $(CPPFLAGS) $(CFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1246 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1247 | $(OBJDIR)/$(CONFIG)/%.o : $(GENDIR)/%.pb.cc |
| 1248 | $(E) "[CXX] Compiling $<" |
| 1249 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | 4500034 | 2016-01-28 05:04:45 +0100 | [diff] [blame] | 1250 | $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1251 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 $@ $< |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1256 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1257 | $(OBJDIR)/$(CONFIG)/%.o : %.cc |
| 1258 | $(E) "[CXX] Compiling $<" |
| 1259 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | 4500034 | 2016-01-28 05:04:45 +0100 | [diff] [blame] | 1260 | $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1261 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1262 | install: install_c install_cxx install-plugins install-certs verify-install |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1263 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1264 | install_c: install-headers_c install-static_c install-shared_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1265 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1266 | install_cxx: install-headers_cxx install-static_cxx install-shared_cxx |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1267 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1268 | install_csharp: install-shared_csharp install_c |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1269 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1270 | install_grpc_csharp_ext: install_csharp |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1271 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1272 | install-headers: install-headers_c install-headers_cxx |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1273 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1278 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1283 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1284 | install-static: install-static_c install-static_cxx |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1285 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1286 | install-static_c: static_c strip-static_c install-pkg-config_c |
| 1287 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1288 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1298 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1299 | % endfor |
| 1300 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1301 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1302 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1312 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1313 | % endfor |
| 1314 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1315 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1316 | install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx |
| 1317 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1318 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1326 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1327 | % endfor |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1328 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1329 | <%def name="install_shared(lang_filter)">\ |
| 1330 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1331 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1332 | % if lib.language == lang_filter: |
| 1333 | % if lib.build == "all": |
| 1334 | % if not lib.get('external_deps', None): |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 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) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1338 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1339 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1340 | else ifneq ($(SYSTEM),Darwin) |
Craig Tiller | f008f06 | 2016-02-08 12:48:03 -0800 | [diff] [blame] | 1341 | $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.core_version.major} |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1342 | $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1343 | endif |
| 1344 | % endif |
| 1345 | % endif |
| 1346 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1347 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1348 | % endfor |
| 1349 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1350 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1351 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1352 | % if lib.language == lang_filter: |
| 1353 | % if lib.build == "all": |
| 1354 | % if 'zookeeper' in lib.get('external_deps', []): |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 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) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1358 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1359 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1360 | else ifneq ($(SYSTEM),Darwin) |
Craig Tiller | f008f06 | 2016-02-08 12:48:03 -0800 | [diff] [blame] | 1361 | $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.core_version.major} |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1362 | $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1363 | endif |
| 1364 | % endif |
| 1365 | % endif |
| 1366 | % endif |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1367 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1368 | % endfor |
| 1369 | endif |
| 1370 | ifneq ($(SYSTEM),MINGW32) |
| 1371 | ifneq ($(SYSTEM),Darwin) |
| 1372 | $(Q) ldconfig || true |
| 1373 | endif |
| 1374 | endif |
| 1375 | </%def> |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1376 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1377 | install-shared_c: shared_c strip-shared_c install-pkg-config_c |
| 1378 | ${install_shared("c")} |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1379 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1380 | install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx |
| 1381 | ${install_shared("c++")} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1382 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1383 | install-shared_csharp: shared_csharp strip-shared_csharp |
| 1384 | ${install_shared("csharp")} |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1385 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1398 | |
yang-g | 2908d63 | 2016-02-04 09:46:51 -0800 | [diff] [blame] | 1399 | install-pkg-config_c: pc_c pc_c_unsecure pc_c_zookeeper |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1400 | $(E) "[INSTALL] Installing C pkg-config files" |
| 1401 | $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1402 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/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 |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1407 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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/pkgconfig/grpc++.pc |
| 1412 | $(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] | 1413 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas "Pixel" Noble | 161ea23 | 2015-02-22 05:48:53 +0100 | [diff] [blame] | 1418 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 this" |
| 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 |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1438 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1439 | clean: |
| 1440 | $(E) "[CLEAN] Cleaning build directories." |
| 1441 | $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) cache.mk |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1442 | |
| 1443 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1444 | # The various libraries |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1445 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1446 | % for lib in libs: |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1447 | % if 'Makefile' in lib.get('build_system', ['Makefile']): |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1448 | ${makelib(lib)} |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1449 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1450 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1451 | |
| 1452 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1453 | # All of the test targets, and protoc plugins |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1454 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1455 | % for tgt in targets: |
| 1456 | ${maketarget(tgt)} |
| 1457 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1458 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1459 | <%def name="makelib(lib)"> |
| 1460 | LIB${lib.name.upper()}_SRC = \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1461 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1462 | % for src in lib.src: |
| 1463 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1464 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1465 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1466 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1467 | % if "public_headers" in lib: |
| 1468 | % if lib.language == "c++": |
| 1469 | PUBLIC_HEADERS_CXX += \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1470 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1471 | % else: |
| 1472 | PUBLIC_HEADERS_C += \\ |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1473 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1474 | % endif |
| 1475 | % for hdr in lib.public_headers: |
| 1476 | ${hdr} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1477 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1478 | % endfor |
| 1479 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1480 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1481 | 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] | 1482 | |
Nicolas "Pixel" Noble | 51b1aee | 2016-01-28 01:14:58 +0100 | [diff] [blame] | 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 |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1487 | % endif |
| 1488 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1489 | ## If the library requires OpenSSL, let's add some restrictions. |
| 1490 | % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 1491 | ifeq ($(NO_SECURE),true) |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1492 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1493 | # You can't build secure libraries if you don't have OpenSSL. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1494 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1495 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1496 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1497 | % if lib.build == "all": |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1498 | $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT): openssl_dep_error |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1499 | % endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1500 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1501 | else |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1502 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1503 | % if lib.language == 'c++': |
| 1504 | ifeq ($(NO_PROTOBUF),true) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1505 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1506 | # 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] | 1507 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1508 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1509 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1510 | % if lib.build == "all": |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1511 | $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT): protobuf_dep_error |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1512 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1513 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1514 | else |
| 1515 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1516 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1522 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1523 | # 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] | 1524 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1525 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1526 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1527 | % if lib.build == "all": |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1528 | $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT): protobuf_dep_error |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1529 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1530 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1531 | else |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1532 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1533 | % endif |
Nicolas "Pixel" Noble | d649c21 | 2016-01-27 20:27:30 +0100 | [diff] [blame] | 1534 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: \ |
| 1535 | % if lib.name != 'z': |
| 1536 | $(ZLIB_DEP) \ |
| 1537 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1538 | % endif |
| 1539 | % if lib.language == 'c++': |
| 1540 | $(PROTOBUF_DEP)\ |
| 1541 | % endif |
Nicolas "Pixel" Noble | f51a901 | 2016-02-03 07:39:43 +0100 | [diff] [blame] | 1542 | $(LIB${lib.name.upper()}_OBJS) \ |
| 1543 | % if lib.get('baselib', False): |
Craig Tiller | 1298afd | 2016-02-09 12:29:17 -0800 | [diff] [blame] | 1544 | $(LIBGPR_OBJS) \ |
Nicolas "Pixel" Noble | f51a901 | 2016-02-03 07:39:43 +0100 | [diff] [blame] | 1545 | $(ZLIB_MERGE_OBJS) \ |
| 1546 | % if lib.get('secure', 'check') == True: |
| 1547 | $(OPENSSL_MERGE_OBJS) \ |
| 1548 | % endif |
| 1549 | % endif |
| 1550 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1551 | $(E) "[AR] Creating $@" |
| 1552 | $(Q) mkdir -p `dirname $@` |
| 1553 | $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
Nicolas "Pixel" Noble | f51a901 | 2016-02-03 07:39:43 +0100 | [diff] [blame] | 1554 | $(Q) $(AR) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) \ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1555 | % if lib.get('baselib', False): |
Craig Tiller | 1298afd | 2016-02-09 12:29:17 -0800 | [diff] [blame] | 1556 | $(LIBGPR_OBJS) \ |
Nicolas "Pixel" Noble | f51a901 | 2016-02-03 07:39:43 +0100 | [diff] [blame] | 1557 | $(ZLIB_MERGE_OBJS) \ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1558 | % if lib.get('secure', 'check') == True: |
Nicolas "Pixel" Noble | f51a901 | 2016-02-03 07:39:43 +0100 | [diff] [blame] | 1559 | $(OPENSSL_MERGE_OBJS) \ |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1560 | % endif |
| 1561 | % endif |
Nicolas "Pixel" Noble | f51a901 | 2016-02-03 07:39:43 +0100 | [diff] [blame] | 1562 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1563 | ifeq ($(SYSTEM),Darwin) |
Nicolas "Pixel" Noble | e0dbd3f | 2016-02-23 00:21:38 +0100 | [diff] [blame] | 1564 | $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1565 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1566 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1567 | <% |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1568 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1569 | if lib.language == 'c++': |
| 1570 | ld = '$(LDXX)' |
| 1571 | else: |
| 1572 | ld = '$(LD)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1573 | |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1574 | out_mingbase = '$(LIBDIR)/$(CONFIG)/' + lib.name + '$(SHARED_VERSION)' |
| 1575 | out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name + '$(SHARED_VERSION)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1576 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1577 | common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)' |
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 | 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)' |
Jan Tattermusch | 324140c | 2016-01-12 08:54:01 -0800 | [diff] [blame] | 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 + '.$(SHARED_EXT)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1598 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1599 | security = lib.get('secure', 'check') |
| 1600 | if security == True: |
| 1601 | common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)' |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 1602 | common = common + ' $(ZLIB_MERGE_LIBS)' |
Nicolas "Pixel" Noble | a7c162c | 2015-07-24 20:21:51 +0200 | [diff] [blame] | 1603 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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) |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1611 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1612 | if 'zookeeper' in lib.get('external_deps', []): |
| 1613 | libs = libs + ' -lzookeeper_mt' |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1614 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1615 | if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 1616 | lib_deps = lib_deps + ' $(OPENSSL_DEP)' |
| 1617 | mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)' |
Nicolas "Pixel" Noble | dda049c | 2015-02-21 00:39:32 +0100 | [diff] [blame] | 1618 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1619 | if lib.language == 'c++': |
| 1620 | common = common + ' $(LDLIBSXX) $(LDLIBS_PROTOBUF)' |
Craig Tiller | 4bef7ce | 2016-02-02 08:38:43 -0800 | [diff] [blame] | 1621 | |
| 1622 | ldflags = '$(LDFLAGS)' |
| 1623 | if lib.get('LDFLAGS', None): |
| 1624 | ldflags += ' ' + lib['LDFLAGS'] |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1625 | %> |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1626 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1627 | % if lib.build == "all": |
| 1628 | ifeq ($(SYSTEM),MINGW32) |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1629 | ${out_mingbase}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps} |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1630 | $(E) "[LD] Linking $@" |
| 1631 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | 89d8ed1 | 2016-02-03 01:12:14 +0100 | [diff] [blame] | 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} |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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) |
Nicolas "Pixel" Noble | 89d8ed1 | 2016-02-03 01:12:14 +0100 | [diff] [blame] | 1638 | $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) -dynamiclib -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1639 | else |
Craig Tiller | f008f06 | 2016-02-08 12:48:03 -0800 | [diff] [blame] | 1640 | $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.core_version.major} -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} |
| 1641 | $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) ${out_libbase}.so.${settings.core_version.major} |
Nicolas "Pixel" Noble | c4e57e3 | 2016-01-30 21:05:35 +0100 | [diff] [blame] | 1642 | $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION).$(SHARED_EXT) ${out_libbase}.so |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1643 | endif |
| 1644 | endif |
| 1645 | % endif |
| 1646 | % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 1647 | ## If the lib was secure, we have to close the Makefile's if that tested |
| 1648 | ## the presence of OpenSSL. |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1649 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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+ |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1655 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1656 | endif |
| 1657 | % endif |
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 | % if lib.get('secure', 'check') == True or lib.get('secure', 'check') == 'check': |
| 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') == 'check': |
| 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> |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1674 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1675 | <%def name="maketarget(tgt)"><% has_no_sources = not tgt.src %> |
| 1676 | % if not has_no_sources: |
| 1677 | ${tgt.name.upper()}_SRC = \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1678 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1679 | % for src in tgt.src: |
| 1680 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1681 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1682 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1683 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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') == 'check': |
| 1687 | ifeq ($(NO_SECURE),true) |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1688 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1689 | # You can't build secure targets if you don't have OpenSSL. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1690 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1691 | $(BINDIR)/$(CONFIG)/${tgt.name}: openssl_dep_error |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1692 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1693 | else |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1694 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1695 | % endif |
Craig Tiller | 0fe5ee7 | 2015-12-22 12:50:36 -0800 | [diff] [blame] | 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 $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value |
| 1702 | $(${tgt.name.upper()}_OBJS): CXXFLAGS := -Ithird_party/boringssl/include $(CXXFLAGS) |
| 1703 | $(${tgt.name.upper()}_OBJS): CPPFLAGS += -DOPENSSL_NO_ASM -D_GNU_SOURCE |
| 1704 | % else: |
| 1705 | % endif |
| 1706 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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++': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1717 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1718 | ifeq ($(NO_PROTOBUF),true) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1719 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1720 | # 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] | 1721 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1722 | $(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1723 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1724 | else |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1725 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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 |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1739 | |
Craig Tiller | 32173c5 | 2016-03-17 14:12:45 -0700 | [diff] [blame] | 1740 | % if tgt.language == "c++" or tgt.boringssl or tgt.build == 'fuzzer': |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 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') == 'check': |
| 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 |
Craig Tiller | 32173c5 | 2016-03-17 14:12:45 -0700 | [diff] [blame] | 1794 | % if tgt.build == 'fuzzer': |
| 1795 | -lFuzzer\ |
| 1796 | % endif |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1797 | -o $(BINDIR)/$(CONFIG)/${tgt.name} |
| 1798 | % if tgt.build == 'protoc' or tgt.language == 'c++': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1799 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1800 | endif |
| 1801 | % endif |
| 1802 | % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1803 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1804 | endif |
| 1805 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1806 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1807 | % for src in tgt.src: |
| 1808 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \ |
| 1809 | % for dep in tgt.deps: |
| 1810 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
| 1811 | % endfor |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 1812 | |
Craig Tiller | ab23045 | 2016-01-04 08:18:43 -0800 | [diff] [blame] | 1813 | % if tgt.language == 'c89': |
| 1814 | % for src in tgt.src: |
Craig Tiller | ea21ca2 | 2016-01-04 12:34:29 -0800 | [diff] [blame] | 1815 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o : ${src} |
| 1816 | $(E) "[C] Compiling $<" |
| 1817 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | 4500034 | 2016-01-28 05:04:45 +0100 | [diff] [blame] | 1818 | $(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] | 1819 | % endfor |
| 1820 | % endif |
| 1821 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1822 | % endfor |
| 1823 | % if not has_no_sources: |
| 1824 | deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep) |
| 1825 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1826 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1827 | % if not has_no_sources: |
| 1828 | % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check': |
| 1829 | ifneq ($(NO_SECURE),true) |
| 1830 | % endif |
| 1831 | ifneq ($(NO_DEPS),true) |
| 1832 | -include $(${tgt.name.upper()}_OBJS:.o=.dep) |
| 1833 | endif |
| 1834 | % if tgt.get('secure', 'check') == True or tgt.get('secure', 'check') == 'check': |
| 1835 | endif |
| 1836 | % endif |
| 1837 | % endif |
Nicolas "Pixel" Noble | 472bb68 | 2015-11-03 19:09:01 +0100 | [diff] [blame] | 1838 | % for src in tgt.src: |
| 1839 | % if not proto_re.match(src) and any(proto_re.match(src2) for src2 in tgt.src): |
| 1840 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: ${' '.join(proto_to_cc(src2) for src2 in tgt.src if proto_re.match(src2))} |
| 1841 | % endif |
| 1842 | % endfor |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1843 | </%def> |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1844 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1845 | ifneq ($(OPENSSL_DEP),) |
| 1846 | # This is to ensure the embedded OpenSSL is built beforehand, properly |
| 1847 | # installing headers to their final destination on the drive. We need this |
| 1848 | # otherwise parallel compilation will fail if a source is compiled first. |
| 1849 | % for src in sorted(sources_that_need_openssl): |
| 1850 | % if src not in sources_that_don_t_need_openssl: |
| 1851 | ${src}: $(OPENSSL_DEP) |
| 1852 | % endif |
| 1853 | % endfor |
| 1854 | endif |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1855 | |
Craig Tiller | 841c880 | 2015-09-10 13:06:37 -0700 | [diff] [blame] | 1856 | .PHONY: all strip tools \ |
| 1857 | dep_error openssl_dep_error openssl_dep_message git_update stop \ |
| 1858 | buildtests buildtests_c buildtests_cxx \ |
| 1859 | test test_c test_cxx \ |
| 1860 | install install_c install_cxx \ |
| 1861 | install-headers install-headers_c install-headers_cxx \ |
| 1862 | install-shared install-shared_c install-shared_cxx \ |
| 1863 | install-static install-static_c install-static_cxx \ |
| 1864 | strip strip-shared strip-static \ |
| 1865 | strip_c strip-shared_c strip-static_c \ |
| 1866 | strip_cxx strip-shared_cxx strip-static_cxx \ |
| 1867 | dep_c dep_cxx bins_dep_c bins_dep_cxx \ |
| 1868 | clean |
Craig Tiller | b79c1e1 | 2016-02-23 10:00:58 -0800 | [diff] [blame] | 1869 | |
| 1870 | .PHONY: printvars |
| 1871 | printvars: |
| 1872 | @$(foreach V,$(sort $(.VARIABLES)), \ |
| 1873 | $(if $(filter-out environment% default automatic, \ |
| 1874 | $(origin $V)),$(warning $V=$($V) ($(value $V))))) |