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