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