Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1 | # GRPC global makefile |
| 2 | # This currently builds C and C++ code. |
Nicolas "Pixel" Noble | d49893d | 2015-04-21 04:57:45 +0200 | [diff] [blame] | 3 | # This file has been automatically generated from a template file. |
| 4 | # Please look at the templates directory instead. |
murgatroid99 | c241d2c | 2015-06-22 11:19:57 -0700 | [diff] [blame] | 5 | # This file can be regenerated from the template by running |
| 6 | # tools/buildgen/generate_projects.sh |
Craig Tiller | 3b93548 | 2015-02-16 12:15:48 -0800 | [diff] [blame] | 7 | |
Craig Tiller | d7f3335 | 2015-02-20 15:18:45 -0800 | [diff] [blame] | 8 | # Copyright 2015, Google Inc. |
Craig Tiller | 3b93548 | 2015-02-16 12:15:48 -0800 | [diff] [blame] | 9 | # All rights reserved. |
| 10 | # |
| 11 | # Redistribution and use in source and binary forms, with or without |
| 12 | # modification, are permitted provided that the following conditions are |
| 13 | # met: |
| 14 | # |
| 15 | # * Redistributions of source code must retain the above copyright |
| 16 | # notice, this list of conditions and the following disclaimer. |
| 17 | # * Redistributions in binary form must reproduce the above |
| 18 | # copyright notice, this list of conditions and the following disclaimer |
| 19 | # in the documentation and/or other materials provided with the |
| 20 | # distribution. |
| 21 | # * Neither the name of Google Inc. nor the names of its |
| 22 | # contributors may be used to endorse or promote products derived from |
| 23 | # this software without specific prior written permission. |
| 24 | # |
| 25 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 26 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 27 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 28 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 29 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 30 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 31 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 32 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 33 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 34 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 35 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 36 | <%! |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 37 | import re |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 38 | import os |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 39 | |
nnoble | c87b1c5 | 2015-01-05 17:15:18 -0800 | [diff] [blame] | 40 | proto_re = re.compile('(.*)\\.proto') |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 41 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 42 | def proto_to_cc(filename): |
| 43 | m = proto_re.match(filename) |
| 44 | if not m: |
| 45 | return filename |
Nicolas "Pixel" Noble | 0caebbf | 2015-04-09 23:08:51 +0200 | [diff] [blame] | 46 | 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] | 47 | |
| 48 | sources_that_need_openssl = set() |
| 49 | sources_that_don_t_need_openssl = set() |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 50 | %> |
| 51 | |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 52 | |
| 53 | # Basic platform detection |
| 54 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 55 | ifeq ($(SYSTEM),) |
| 56 | SYSTEM = $(HOST_SYSTEM) |
| 57 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 58 | ifeq ($(SYSTEM),MSYS) |
| 59 | SYSTEM = MINGW32 |
| 60 | endif |
Nicolas "Pixel" Noble | 5fc1adf | 2015-05-10 22:20:31 +0200 | [diff] [blame] | 61 | ifeq ($(SYSTEM),MINGW64) |
| 62 | SYSTEM = MINGW32 |
| 63 | endif |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 64 | |
| 65 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 66 | ifndef BUILDDIR |
| 67 | BUILDDIR = . |
| 68 | endif |
| 69 | |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 70 | HAS_GCC = $(shell which gcc > /dev/null 2> /dev/null && echo true || echo false) |
| 71 | HAS_CC = $(shell which cc > /dev/null 2> /dev/null && echo true || echo false) |
| 72 | HAS_CLANG = $(shell which clang > /dev/null 2> /dev/null && echo true || echo false) |
| 73 | |
| 74 | ifeq ($(HAS_CC),true) |
| 75 | DEFAULT_CC = cc |
| 76 | DEFAULT_CXX = c++ |
| 77 | else |
| 78 | ifeq ($(HAS_GCC),true) |
| 79 | DEFAULT_CC = gcc |
| 80 | DEFAULT_CXX = g++ |
| 81 | else |
| 82 | ifeq ($(HAS_CLANG),true) |
| 83 | DEFAULT_CC = clang |
| 84 | DEFAULT_CXX = clang++ |
| 85 | else |
| 86 | DEFAULT_CC = no_c_compiler |
| 87 | DEFAULT_CXX = no_c++_compiler |
| 88 | endif |
| 89 | endif |
| 90 | endif |
| 91 | |
| 92 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 93 | BINDIR = $(BUILDDIR)/bins |
| 94 | OBJDIR = $(BUILDDIR)/objs |
| 95 | LIBDIR = $(BUILDDIR)/libs |
| 96 | GENDIR = $(BUILDDIR)/gens |
| 97 | |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 98 | # Configurations |
| 99 | |
| 100 | VALID_CONFIG_opt = 1 |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 101 | CC_opt = $(DEFAULT_CC) |
| 102 | CXX_opt = $(DEFAULT_CXX) |
| 103 | LD_opt = $(DEFAULT_CC) |
| 104 | LDXX_opt = $(DEFAULT_CXX) |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 105 | CPPFLAGS_opt = -O2 |
| 106 | LDFLAGS_opt = |
| 107 | DEFINES_opt = NDEBUG |
| 108 | |
David Garcia Quintas | 8954e90 | 2015-04-29 09:46:33 -0700 | [diff] [blame] | 109 | VALID_CONFIG_basicprof = 1 |
| 110 | CC_basicprof = $(DEFAULT_CC) |
| 111 | CXX_basicprof = $(DEFAULT_CXX) |
| 112 | LD_basicprof = $(DEFAULT_CC) |
| 113 | LDXX_basicprof = $(DEFAULT_CXX) |
Craig Tiller | 113d169 | 2015-05-01 15:26:15 -0700 | [diff] [blame] | 114 | CPPFLAGS_basicprof = -O2 -DGRPC_BASIC_PROFILER -DGRPC_TIMERS_RDTSC |
David Garcia Quintas | 8954e90 | 2015-04-29 09:46:33 -0700 | [diff] [blame] | 115 | LDFLAGS_basicprof = |
| 116 | DEFINES_basicprof = NDEBUG |
| 117 | |
| 118 | VALID_CONFIG_stapprof = 1 |
| 119 | CC_stapprof = $(DEFAULT_CC) |
| 120 | CXX_stapprof = $(DEFAULT_CXX) |
| 121 | LD_stapprof = $(DEFAULT_CC) |
| 122 | LDXX_stapprof = $(DEFAULT_CXX) |
| 123 | CPPFLAGS_stapprof = -O2 -DGRPC_STAP_PROFILER |
| 124 | LDFLAGS_stapprof = |
| 125 | DEFINES_stapprof = NDEBUG |
Vijay Pai | bc17113 | 2015-04-13 10:58:06 -0700 | [diff] [blame] | 126 | |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 127 | VALID_CONFIG_dbg = 1 |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 128 | CC_dbg = $(DEFAULT_CC) |
| 129 | CXX_dbg = $(DEFAULT_CXX) |
| 130 | LD_dbg = $(DEFAULT_CC) |
| 131 | LDXX_dbg = $(DEFAULT_CXX) |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 132 | CPPFLAGS_dbg = -O0 |
| 133 | LDFLAGS_dbg = |
| 134 | DEFINES_dbg = _DEBUG DEBUG |
| 135 | |
Vijay Pai | dc7110f | 2015-04-02 13:59:05 -0700 | [diff] [blame] | 136 | VALID_CONFIG_mutrace = 1 |
| 137 | CC_mutrace = $(DEFAULT_CC) |
| 138 | CXX_mutrace = $(DEFAULT_CXX) |
| 139 | LD_mutrace = $(DEFAULT_CC) |
| 140 | LDXX_mutrace = $(DEFAULT_CXX) |
| 141 | CPPFLAGS_mutrace = -O0 |
| 142 | LDFLAGS_mutrace = -rdynamic |
| 143 | DEFINES_mutrace = _DEBUG DEBUG |
| 144 | |
Craig Tiller | ec0b8f3 | 2015-01-15 07:30:00 -0800 | [diff] [blame] | 145 | VALID_CONFIG_valgrind = 1 |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 146 | REQUIRE_CUSTOM_LIBRARIES_valgrind = 1 |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 147 | CC_valgrind = $(DEFAULT_CC) |
| 148 | CXX_valgrind = $(DEFAULT_CXX) |
| 149 | LD_valgrind = $(DEFAULT_CC) |
| 150 | LDXX_valgrind = $(DEFAULT_CXX) |
Craig Tiller | ec0b8f3 | 2015-01-15 07:30:00 -0800 | [diff] [blame] | 151 | CPPFLAGS_valgrind = -O0 |
| 152 | OPENSSL_CFLAGS_valgrind = -DPURIFY |
| 153 | LDFLAGS_valgrind = |
Craig Tiller | f6901be | 2015-02-27 09:12:58 -0800 | [diff] [blame] | 154 | DEFINES_valgrind = _DEBUG DEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=20 |
Craig Tiller | ec0b8f3 | 2015-01-15 07:30:00 -0800 | [diff] [blame] | 155 | |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 156 | VALID_CONFIG_tsan = 1 |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 157 | REQUIRE_CUSTOM_LIBRARIES_tsan = 1 |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 158 | CC_tsan = clang |
| 159 | CXX_tsan = clang++ |
| 160 | LD_tsan = clang |
| 161 | LDXX_tsan = clang++ |
Craig Tiller | 5c0f97d | 2015-05-29 08:42:16 -0700 | [diff] [blame] | 162 | CPPFLAGS_tsan = -O0 -fsanitize=thread -fno-omit-frame-pointer |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 163 | LDFLAGS_tsan = -fsanitize=thread |
Craig Tiller | f6901be | 2015-02-27 09:12:58 -0800 | [diff] [blame] | 164 | DEFINES_tsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=10 |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 165 | |
| 166 | VALID_CONFIG_asan = 1 |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 167 | REQUIRE_CUSTOM_LIBRARIES_asan = 1 |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 168 | CC_asan = clang |
| 169 | CXX_asan = clang++ |
| 170 | LD_asan = clang |
| 171 | LDXX_asan = clang++ |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 172 | CPPFLAGS_asan = -O0 -fsanitize=address -fno-omit-frame-pointer |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 173 | LDFLAGS_asan = -fsanitize=address |
Craig Tiller | d6cc19e | 2015-07-01 10:05:00 -0700 | [diff] [blame] | 174 | DEFINES_asan = GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3 |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 175 | |
| 176 | VALID_CONFIG_msan = 1 |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 177 | REQUIRE_CUSTOM_LIBRARIES_msan = 1 |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 178 | CC_msan = clang |
Nicolas "Pixel" Noble | d66cba2 | 2015-02-14 02:59:12 +0100 | [diff] [blame] | 179 | CXX_msan = clang++-libc++ |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 180 | LD_msan = clang |
Nicolas "Pixel" Noble | d66cba2 | 2015-02-14 02:59:12 +0100 | [diff] [blame] | 181 | LDXX_msan = clang++-libc++ |
Craig Tiller | 6902ad2 | 2015-04-16 08:01:49 -0700 | [diff] [blame] | 182 | CPPFLAGS_msan = -O0 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 |
Craig Tiller | ec0b8f3 | 2015-01-15 07:30:00 -0800 | [diff] [blame] | 183 | OPENSSL_CFLAGS_msan = -DPURIFY |
Nicolas "Pixel" Noble | d66cba2 | 2015-02-14 02:59:12 +0100 | [diff] [blame] | 184 | LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 |
Craig Tiller | d6cc19e | 2015-07-01 10:05:00 -0700 | [diff] [blame] | 185 | DEFINES_msan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=4 |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 186 | |
Craig Tiller | 96bd5f6 | 2015-02-13 09:04:13 -0800 | [diff] [blame] | 187 | VALID_CONFIG_ubsan = 1 |
| 188 | REQUIRE_CUSTOM_LIBRARIES_ubsan = 1 |
| 189 | CC_ubsan = clang |
| 190 | CXX_ubsan = clang++ |
| 191 | LD_ubsan = clang |
| 192 | LDXX_ubsan = clang++ |
| 193 | CPPFLAGS_ubsan = -O1 -fsanitize=undefined -fno-omit-frame-pointer |
| 194 | OPENSSL_CFLAGS_ubsan = -DPURIFY |
Craig Tiller | 96bd5f6 | 2015-02-13 09:04:13 -0800 | [diff] [blame] | 195 | LDFLAGS_ubsan = -fsanitize=undefined |
Craig Tiller | d6cc19e | 2015-07-01 10:05:00 -0700 | [diff] [blame] | 196 | DEFINES_ubsan = NDEBUG GRPC_TEST_SLOWDOWN_BUILD_FACTOR=3 |
Craig Tiller | 96bd5f6 | 2015-02-13 09:04:13 -0800 | [diff] [blame] | 197 | |
Craig Tiller | 699ba21 | 2015-01-13 17:02:20 -0800 | [diff] [blame] | 198 | VALID_CONFIG_gcov = 1 |
| 199 | CC_gcov = gcc |
| 200 | CXX_gcov = g++ |
| 201 | LD_gcov = gcc |
| 202 | LDXX_gcov = g++ |
| 203 | CPPFLAGS_gcov = -O0 -fprofile-arcs -ftest-coverage |
| 204 | LDFLAGS_gcov = -fprofile-arcs -ftest-coverage |
Craig Tiller | 2e4a7dc | 2015-04-30 09:22:31 -0700 | [diff] [blame] | 205 | DEFINES_gcov = _DEBUG DEBUG |
Craig Tiller | 699ba21 | 2015-01-13 17:02:20 -0800 | [diff] [blame] | 206 | |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 207 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 208 | # General settings. |
| 209 | # You may want to change these depending on your system. |
| 210 | |
| 211 | prefix ?= /usr/local |
| 212 | |
| 213 | PROTOC = protoc |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 214 | DTRACE = dtrace |
yangg | 102e4fe | 2015-01-06 16:02:50 -0800 | [diff] [blame] | 215 | CONFIG ?= opt |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 216 | CC = $(CC_$(CONFIG)) |
| 217 | CXX = $(CXX_$(CONFIG)) |
| 218 | LD = $(LD_$(CONFIG)) |
| 219 | LDXX = $(LDXX_$(CONFIG)) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 220 | AR = ar |
Nicolas "Pixel" Noble | d7631a4 | 2015-02-27 07:52:39 +0100 | [diff] [blame] | 221 | ifeq ($(SYSTEM),Linux) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 222 | STRIP = strip --strip-unneeded |
Nicolas "Pixel" Noble | d7631a4 | 2015-02-27 07:52:39 +0100 | [diff] [blame] | 223 | else |
| 224 | ifeq ($(SYSTEM),Darwin) |
| 225 | STRIP = strip -x |
| 226 | else |
| 227 | STRIP = strip |
| 228 | endif |
| 229 | endif |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 230 | INSTALL = install |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 231 | RM = rm -f |
| 232 | |
yangg | 102e4fe | 2015-01-06 16:02:50 -0800 | [diff] [blame] | 233 | ifndef VALID_CONFIG_$(CONFIG) |
| 234 | $(error Invalid CONFIG value '$(CONFIG)') |
| 235 | endif |
| 236 | |
Nicolas "Pixel" Noble | e758ed1 | 2015-03-11 22:51:39 +0100 | [diff] [blame] | 237 | ifeq ($(SYSTEM),Linux) |
| 238 | TMPOUT = /dev/null |
| 239 | else |
| 240 | TMPOUT = `mktemp /tmp/test-out-XXXXXX` |
| 241 | endif |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 242 | |
Craig Tiller | cf133f4 | 2015-02-26 14:05:56 -0800 | [diff] [blame] | 243 | # Detect if we can use C++11 |
Nicolas "Pixel" Noble | e758ed1 | 2015-03-11 22:51:39 +0100 | [diff] [blame] | 244 | CXX11_CHECK_CMD = $(CXX) -std=c++11 -o $(TMPOUT) -c test/build/c++11.cc |
Craig Tiller | cf133f4 | 2015-02-26 14:05:56 -0800 | [diff] [blame] | 245 | HAS_CXX11 = $(shell $(CXX11_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 246 | |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 247 | # The HOST compiler settings are used to compile the protoc plugins. |
| 248 | # In most cases, you won't have to change anything, but if you are |
| 249 | # cross-compiling, you can override these variables from GNU make's |
| 250 | # command line: make CC=cross-gcc HOST_CC=gcc |
| 251 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 252 | HOST_CC = $(CC) |
| 253 | HOST_CXX = $(CXX) |
| 254 | HOST_LD = $(LD) |
| 255 | HOST_LDXX = $(LDXX) |
| 256 | |
ctiller | cab52e7 | 2015-01-06 13:10:23 -0800 | [diff] [blame] | 257 | CPPFLAGS += $(CPPFLAGS_$(CONFIG)) |
Nicolas "Pixel" Noble | 7274382 | 2015-02-20 20:59:29 +0100 | [diff] [blame] | 258 | DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\" |
ctiller | 8cfebb9 | 2015-01-06 15:02:12 -0800 | [diff] [blame] | 259 | LDFLAGS += $(LDFLAGS_$(CONFIG)) |
ctiller | cab52e7 | 2015-01-06 13:10:23 -0800 | [diff] [blame] | 260 | |
Craig Tiller | 86fa1c5 | 2015-02-27 09:57:58 -0800 | [diff] [blame] | 261 | ifdef EXTRA_DEFINES |
Craig Tiller | f5065c5 | 2015-02-27 16:17:39 -0800 | [diff] [blame] | 262 | DEFINES += $(EXTRA_DEFINES) |
Craig Tiller | 86fa1c5 | 2015-02-27 09:57:58 -0800 | [diff] [blame] | 263 | endif |
| 264 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 265 | CFLAGS += -std=c89 -pedantic |
Craig Tiller | cf133f4 | 2015-02-26 14:05:56 -0800 | [diff] [blame] | 266 | ifeq ($(HAS_CXX11),true) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 267 | CXXFLAGS += -std=c++11 |
Craig Tiller | cf133f4 | 2015-02-26 14:05:56 -0800 | [diff] [blame] | 268 | else |
| 269 | CXXFLAGS += -std=c++0x |
Craig Tiller | cf133f4 | 2015-02-26 14:05:56 -0800 | [diff] [blame] | 270 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 271 | CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter |
| 272 | LDFLAGS += -g |
| 273 | |
| 274 | ifneq ($(SYSTEM),MINGW32) |
| 275 | PIC_CPPFLAGS = -fPIC |
| 276 | CPPFLAGS += -fPIC |
| 277 | LDFLAGS += -fPIC |
| 278 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 279 | |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 280 | INCLUDES = . include $(GENDIR) |
Nicolas "Pixel" Noble | 3adab74 | 2015-06-02 00:33:06 +0200 | [diff] [blame] | 281 | LDFLAGS += -Llibs/$(CONFIG) |
| 282 | |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 283 | ifeq ($(SYSTEM),Darwin) |
Nicolas "Pixel" Noble | e758ed1 | 2015-03-11 22:51:39 +0100 | [diff] [blame] | 284 | ifneq ($(wildcard /usr/local/ssl/include),) |
| 285 | INCLUDES += /usr/local/ssl/include |
| 286 | endif |
| 287 | ifneq ($(wildcard /opt/local/include),) |
| 288 | INCLUDES += /opt/local/include |
| 289 | endif |
| 290 | ifneq ($(wildcard /usr/local/include),) |
| 291 | INCLUDES += /usr/local/include |
| 292 | endif |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 293 | LIBS = m z |
Nicolas "Pixel" Noble | e758ed1 | 2015-03-11 22:51:39 +0100 | [diff] [blame] | 294 | ifneq ($(wildcard /usr/local/ssl/lib),) |
| 295 | LDFLAGS += -L/usr/local/ssl/lib |
| 296 | endif |
| 297 | ifneq ($(wildcard /opt/local/lib),) |
| 298 | LDFLAGS += -L/opt/local/lib |
| 299 | endif |
| 300 | ifneq ($(wildcard /usr/local/lib),) |
| 301 | LDFLAGS += -L/usr/local/lib |
| 302 | endif |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 303 | endif |
| 304 | |
| 305 | ifeq ($(SYSTEM),Linux) |
ctiller | c008ae5 | 2015-01-07 15:33:00 -0800 | [diff] [blame] | 306 | LIBS = rt m z pthread |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 307 | LDFLAGS += -pthread |
| 308 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 309 | |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 310 | ifeq ($(SYSTEM),MINGW32) |
| 311 | LIBS = m z pthread |
| 312 | LDFLAGS += -pthread |
| 313 | endif |
| 314 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 315 | ifneq ($(wildcard /usr/src/gtest/src/gtest-all.cc),) |
| 316 | GTEST_LIB = /usr/src/gtest/src/gtest-all.cc -I/usr/src/gtest |
| 317 | else |
| 318 | GTEST_LIB = -lgtest |
| 319 | endif |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 320 | GTEST_LIB += -lgflags |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 321 | ifeq ($(V),1) |
| 322 | E = @: |
| 323 | Q = |
| 324 | else |
| 325 | E = @echo |
| 326 | Q = @ |
| 327 | endif |
| 328 | |
| 329 | VERSION = ${settings.version.major}.${settings.version.minor}.${settings.version.micro}.${settings.version.build} |
| 330 | |
| 331 | CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) |
| 332 | CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) |
| 333 | |
| 334 | LDFLAGS += $(ARCH_FLAGS) |
| 335 | LDLIBS += $(addprefix -l, $(LIBS)) |
| 336 | LDLIBSXX += $(addprefix -l, $(LIBSXX)) |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 337 | |
| 338 | HOST_CPPFLAGS = $(CPPFLAGS) |
| 339 | HOST_CFLAGS = $(CFLAGS) |
| 340 | HOST_CXXFLAGS = $(CXXFLAGS) |
| 341 | HOST_LDFLAGS = $(LDFLAGS) |
| 342 | HOST_LDLIBS = $(LDLIBS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 343 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 344 | |
| 345 | # These are automatically computed variables. |
| 346 | # There shouldn't be any need to change anything from now on. |
| 347 | |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 348 | HAS_PKG_CONFIG = $(shell command -v pkg-config >/dev/null 2>&1 && echo true || echo false) |
| 349 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 350 | PC_TEMPLATE = prefix=$(prefix)\n\ |
| 351 | exec_prefix=${'\$${prefix}'}\n\ |
| 352 | includedir=${'\$${prefix}'}/include\n\ |
| 353 | libdir=${'\$${exec_prefix}'}/lib\n\ |
| 354 | \n\ |
| 355 | Name: $(PC_NAME)\n\ |
| 356 | Description: $(PC_DESCRIPTION)\n\ |
| 357 | Version: $(VERSION)\n\ |
| 358 | Cflags: -I${'\$${includedir}'} $(PC_CFLAGS)\n\ |
| 359 | Requires.private: $(PC_REQUIRES_PRIVATE)\n\ |
| 360 | Libs: -L${'\$${libdir}'}\n\ |
| 361 | Libs.private: $(PC_LIBS_PRIVATE) |
| 362 | |
| 363 | # gpr .pc file |
murgatroid99 | dbc0caf | 2015-07-01 12:59:49 -0700 | [diff] [blame] | 364 | PC_NAME = gRPC Portable Runtime |
| 365 | PC_DESCRIPTION = gRPC Portable Runtime |
murgatroid99 | c34a3a6 | 2015-07-01 10:35:33 -0700 | [diff] [blame] | 366 | PC_CFLAGS = -pthread |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 367 | PC_REQUIRES_PRIVATE = |
murgatroid99 | c34a3a6 | 2015-07-01 10:35:33 -0700 | [diff] [blame] | 368 | PC_LIBS_PRIVATE = -lpthread |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 369 | ifeq ($(SYSTEM),Darwin) |
murgatroid99 | c34a3a6 | 2015-07-01 10:35:33 -0700 | [diff] [blame] | 370 | PC_LIBS_PRIVATE += -lrt |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 371 | endif |
| 372 | GPR_PC_FILE := $(PC_TEMPLATE) |
| 373 | |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 374 | ifeq ($(SYSTEM),MINGW32) |
| 375 | SHARED_EXT = dll |
| 376 | endif |
| 377 | ifeq ($(SYSTEM),Darwin) |
| 378 | SHARED_EXT = dylib |
| 379 | endif |
| 380 | ifeq ($(SHARED_EXT),) |
| 381 | SHARED_EXT = so.$(VERSION) |
| 382 | endif |
| 383 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 384 | ifeq ($(wildcard .git),) |
| 385 | IS_GIT_FOLDER = false |
| 386 | else |
| 387 | IS_GIT_FOLDER = true |
| 388 | endif |
| 389 | |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 390 | ifeq ($(SYSTEM),Linux) |
| 391 | OPENSSL_REQUIRES_DL = true |
| 392 | endif |
| 393 | |
| 394 | ifeq ($(SYSTEM),Darwin) |
| 395 | OPENSSL_REQUIRES_DL = true |
| 396 | endif |
| 397 | |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 398 | ifeq ($(HAS_PKG_CONFIG),true) |
| 399 | OPENSSL_ALPN_CHECK_CMD = pkg-config --atleast-version=1.0.2 openssl |
Nicolas "Pixel" Noble | be2d3a3 | 2015-06-30 19:48:47 +0200 | [diff] [blame] | 400 | OPENSSL_NPN_CHECK_CMD = pkg-config --alteast-version=1.0.1 openssl |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 401 | ZLIB_CHECK_CMD = pkg-config --exists zlib |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 402 | PROTOBUF_CHECK_CMD = pkg-config --atleast-version=3.0.0-alpha-3 protobuf |
| 403 | else # HAS_PKG_CONFIG |
| 404 | |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 405 | ifeq ($(SYSTEM),MINGW32) |
| 406 | OPENSSL_LIBS = ssl32 eay32 |
| 407 | else |
| 408 | OPENSSL_LIBS = ssl crypto |
| 409 | endif |
| 410 | |
| 411 | OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 412 | OPENSSL_NPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) |
Nicolas "Pixel" Noble | e758ed1 | 2015-03-11 22:51:39 +0100 | [diff] [blame] | 413 | ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) |
Nicolas "Pixel" Noble | e758ed1 | 2015-03-11 22:51:39 +0100 | [diff] [blame] | 414 | PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) |
Craig Tiller | 297fafa | 2015-01-15 15:46:39 -0800 | [diff] [blame] | 415 | |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 416 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
| 417 | OPENSSL_ALPN_CHECK_CMD += -ldl |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 418 | OPENSSL_NPN_CHECK_CMD += -ldl |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 419 | endif |
| 420 | |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 421 | endif # HAS_PKG_CONFIG |
| 422 | |
murgatroid99 | 6d9e401 | 2015-07-08 10:22:45 -0700 | [diff] [blame^] | 423 | PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perftools.c -lprofiler $(LDFLAGS) |
| 424 | |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 425 | PROTOC_CHECK_CMD = which protoc > /dev/null |
| 426 | PROTOC_CHECK_VERSION_CMD = protoc --version | grep -q libprotoc.3 |
| 427 | DTRACE_CHECK_CMD = which dtrace > /dev/null |
| 428 | SYSTEMTAP_HEADERS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/systemtap.c $(LDFLAGS) |
| 429 | |
Craig Tiller | 50524cc | 2015-01-29 23:00:00 -0800 | [diff] [blame] | 430 | ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) |
Craig Tiller | 297fafa | 2015-01-15 15:46:39 -0800 | [diff] [blame] | 431 | HAS_SYSTEM_PERFTOOLS = $(shell $(PERFTOOLS_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 432 | ifeq ($(HAS_SYSTEM_PERFTOOLS),true) |
| 433 | DEFINES += GRPC_HAVE_PERFTOOLS |
| 434 | LIBS += profiler |
| 435 | endif |
Craig Tiller | 50524cc | 2015-01-29 23:00:00 -0800 | [diff] [blame] | 436 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 437 | |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 438 | HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo true || echo false) |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 439 | ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) |
nnoble | 6082540 | 2014-12-15 14:43:51 -0800 | [diff] [blame] | 440 | HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 441 | ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) |
| 442 | HAS_SYSTEM_OPENSSL_NPN = true |
| 443 | else |
| 444 | HAS_SYSTEM_OPENSSL_NPN = $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 445 | endif |
nnoble | 6082540 | 2014-12-15 14:43:51 -0800 | [diff] [blame] | 446 | HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 447 | HAS_SYSTEM_PROTOBUF = $(HAS_SYSTEM_PROTOBUF_VERIFY) |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 448 | else |
| 449 | # override system libraries if the config requires a custom compiled library |
| 450 | HAS_SYSTEM_OPENSSL_ALPN = false |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 451 | HAS_SYSTEM_OPENSSL_NPN = false |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 452 | HAS_SYSTEM_ZLIB = false |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 453 | HAS_SYSTEM_PROTOBUF = false |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 454 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 455 | |
David Garcia Quintas | f5fcafd | 2015-04-24 16:12:54 -0700 | [diff] [blame] | 456 | HAS_PROTOC = $(shell $(PROTOC_CHECK_CMD) 2> /dev/null && echo true || echo false) |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 457 | ifeq ($(HAS_PROTOC),true) |
David Garcia Quintas | f5fcafd | 2015-04-24 16:12:54 -0700 | [diff] [blame] | 458 | HAS_VALID_PROTOC = $(shell $(PROTOC_CHECK_VERSION_CMD) 2> /dev/null && echo true || echo false) |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 459 | else |
| 460 | HAS_VALID_PROTOC = false |
| 461 | endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 462 | |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 463 | # Check for Systemtap (https://sourceware.org/systemtap/), first by making sure <sys/sdt.h> is present |
| 464 | # in the system and secondly by checking for the "dtrace" binary (on Linux, this is part of the Systemtap |
| 465 | # distribution. It's part of the base system on BSD/Solaris machines). |
| 466 | HAS_SYSTEMTAP_HEADERS = $(shell $(SYSTEMTAP_HEADERS_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 467 | HAS_DTRACE = $(shell $(DTRACE_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 468 | HAS_SYSTEMTAP = false |
| 469 | ifeq ($(HAS_SYSTEMTAP_HEADERS),true) |
| 470 | ifeq ($(HAS_DTRACE),true) |
| 471 | HAS_SYSTEMTAP = true |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 472 | endif |
| 473 | endif |
| 474 | |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 475 | # Note that for testing purposes, one can do: |
| 476 | # make HAS_EMBEDDED_OPENSSL_ALPN=false |
| 477 | # to emulate the fact we do not have OpenSSL in the third_party folder. |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 478 | ifeq ($(wildcard third_party/openssl/ssl/ssl.h),) |
| 479 | HAS_EMBEDDED_OPENSSL_ALPN = false |
| 480 | else |
| 481 | HAS_EMBEDDED_OPENSSL_ALPN = true |
| 482 | endif |
| 483 | |
| 484 | ifeq ($(wildcard third_party/zlib/zlib.h),) |
| 485 | HAS_EMBEDDED_ZLIB = false |
| 486 | else |
| 487 | HAS_EMBEDDED_ZLIB = true |
| 488 | endif |
| 489 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 490 | ifeq ($(wildcard third_party/protobuf/src/google/protobuf/descriptor.pb.h),) |
| 491 | HAS_EMBEDDED_PROTOBUF = false |
| 492 | ifneq ($(HAS_VALID_PROTOC),true) |
| 493 | NO_PROTOC = true |
| 494 | endif |
| 495 | else |
| 496 | HAS_EMBEDDED_PROTOBUF = true |
| 497 | endif |
| 498 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 499 | PC_REQUIRES_GRPC = gpr |
| 500 | PC_LIBS_GRPC = |
| 501 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 502 | ifeq ($(HAS_SYSTEM_ZLIB),false) |
| 503 | ifeq ($(HAS_EMBEDDED_ZLIB),true) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 504 | ZLIB_DEP = $(LIBDIR)/$(CONFIG)/zlib/libz.a |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 505 | CPPFLAGS += -Ithird_party/zlib |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 506 | LDFLAGS += -L$(LIBDIR)/$(CONFIG)/zlib |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 507 | else |
| 508 | DEP_MISSING += zlib |
| 509 | endif |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 510 | else |
| 511 | ifeq ($(HAS_PKG_CONFIG),true) |
| 512 | CPPFLAGS += $(shell pkg-config --cflags zlib) |
| 513 | LDFLAGS += $(shell pkg-config --libs-only-L zlib) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 514 | PC_REQUIRES_GRPC += zlib |
| 515 | else |
| 516 | PC_LIBS_GRPC += -lz |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 517 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 518 | endif |
| 519 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 520 | OPENSSL_PKG_CONFIG = false |
| 521 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 522 | PC_REQUIRES_SECURE = |
| 523 | PC_LIBS_SECURE = |
| 524 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 525 | ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) |
| 526 | ifeq ($(HAS_PKG_CONFIG),true) |
| 527 | OPENSSL_PKG_CONFIG = true |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 528 | PC_REQUIRES_SECURE = openssl |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 529 | CPPFLAGS := $(shell pkg-config --cflags openssl) $(CPPFLAGS) |
| 530 | LDFLAGS_OPENSSL_PKG_CONFIG = $(shell pkg-config --libs-only-L openssl) |
| 531 | ifeq ($(SYSTEM),Linux) |
| 532 | ifneq ($(LDFLAGS_OPENSSL_PKG_CONFIG),) |
| 533 | LDFLAGS_OPENSSL_PKG_CONFIG += $(shell pkg-config --libs-only-L openssl | sed s/L/Wl,-rpath,/) |
| 534 | endif |
| 535 | endif |
| 536 | LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS) |
| 537 | else |
| 538 | LIBS_SECURE = $(OPENSSL_LIBS) |
| 539 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
| 540 | LIBS_SECURE += dl |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 541 | PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 542 | endif |
| 543 | endif |
| 544 | else |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 545 | ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true) |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 546 | USE_SYSTEM_OPENSSL = false |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 547 | OPENSSL_DEP = $(LIBDIR)/$(CONFIG)/openssl/libssl.a |
| 548 | OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/openssl/libssl.a $(LIBDIR)/$(CONFIG)/openssl/libcrypto.a |
Craig Tiller | ec04303 | 2015-02-20 17:24:41 -0800 | [diff] [blame] | 549 | # need to prefix these to ensure overriding system libraries |
| 550 | CPPFLAGS := -Ithird_party/openssl/include $(CPPFLAGS) |
| 551 | LDFLAGS := -L$(LIBDIR)/$(CONFIG)/openssl $(LDFLAGS) |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 552 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 553 | LIBS_SECURE = dl |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 554 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 555 | else |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 556 | ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) |
| 557 | USE_SYSTEM_OPENSSL = true |
| 558 | CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 |
| 559 | LIBS_SECURE = $(OPENSSL_LIBS) |
| 560 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
| 561 | LIBS_SECURE += dl |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 562 | endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 563 | else |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 564 | NO_SECURE = true |
| 565 | endif |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 566 | endif |
Nicolas "Pixel" Noble | be2d3a3 | 2015-06-30 19:48:47 +0200 | [diff] [blame] | 567 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 568 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 569 | ifeq ($(OPENSSL_PKG_CONFIG),true) |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 570 | LDLIBS_SECURE += $(shell pkg-config --libs-only-l openssl) |
| 571 | else |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 572 | LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 573 | endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 574 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 575 | # grpc .pc file |
| 576 | PC_NAME = gRPC |
| 577 | PC_DESCRIPTION = high performance general RPC framework |
| 578 | PC_CFLAGS = |
| 579 | PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) $(PC_REQUIRES_SECURE) |
| 580 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) $(PC_LIBS_SECURE) |
| 581 | GRPC_PC_FILE := $(PC_TEMPLATE) |
| 582 | |
| 583 | # gprc_unsecure .pc file |
| 584 | PC_NAME = gRPC unsecure |
| 585 | PC_DESCRIPTION = high performance general RPC framework without SSL |
| 586 | PC_CFLAGS = |
| 587 | PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) |
| 588 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) |
| 589 | GRPC_UNSECURE_PC_FILE := $(PC_TEMPLATE) |
| 590 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 591 | PROTOBUF_PKG_CONFIG = false |
| 592 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 593 | PC_REQUIRES_GRPCXX = |
| 594 | PC_LIBS_GRPCXX = |
| 595 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 596 | ifeq ($(HAS_SYSTEM_PROTOBUF),true) |
| 597 | ifeq ($(HAS_PKG_CONFIG),true) |
| 598 | PROTOBUF_PKG_CONFIG = true |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 599 | PC_REQUIRES_GRPCXX = protobuf |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 600 | CPPFLAGS := $(shell pkg-config --cflags protobuf) $(CPPFLAGS) |
| 601 | LDFLAGS_PROTOBUF_PKG_CONFIG = $(shell pkg-config --libs-only-L protobuf) |
| 602 | ifeq ($(SYSTEM),Linux) |
| 603 | ifneq ($(LDFLAGS_PROTOBUF_PKG_CONFIG),) |
| 604 | LDFLAGS_PROTOBUF_PKG_CONFIG += $(shell pkg-config --libs-only-L protobuf | sed s/L/Wl,-rpath,/) |
| 605 | endif |
| 606 | endif |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 607 | else |
| 608 | PC_LIBS_GRPCXX = -lprotobuf |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 609 | endif |
| 610 | else |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 611 | ifeq ($(HAS_EMBEDDED_PROTOBUF),true) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 612 | PROTOBUF_DEP = $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a |
Craig Tiller | 9ec95fa | 2015-02-20 20:36:21 -0800 | [diff] [blame] | 613 | CPPFLAGS := -Ithird_party/protobuf/src $(CPPFLAGS) |
| 614 | LDFLAGS := -L$(LIBDIR)/$(CONFIG)/protobuf $(LDFLAGS) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 615 | PROTOC = $(BINDIR)/$(CONFIG)/protobuf/protoc |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 616 | else |
| 617 | NO_PROTOBUF = true |
| 618 | endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 619 | endif |
| 620 | |
| 621 | LIBS_PROTOBUF = protobuf |
| 622 | LIBS_PROTOC = protoc protobuf |
| 623 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 624 | HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) |
| 625 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 626 | ifeq ($(PROTOBUF_PKG_CONFIG),true) |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 627 | LDLIBS_PROTOBUF += $(shell pkg-config --libs-only-l protobuf) |
| 628 | else |
| 629 | LDLIBS_PROTOBUF += $(addprefix -l, $(LIBS_PROTOBUF)) |
| 630 | endif |
| 631 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 632 | # grpc++ .pc file |
| 633 | PC_NAME = gRPC++ |
| 634 | PC_DESCRIPTION = C++ wrapper for gRPC |
| 635 | PC_CFLAGS = |
| 636 | PC_REQUIRES_PRIVATE = grpc $(PC_REQUIRES_GRPCXX) |
| 637 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPCXX) |
| 638 | GRPCXX_PC_FILE := $(PC_TEMPLATE) |
| 639 | |
| 640 | # grpc++_unsecure .pc file |
| 641 | PC_NAME = gRPC++ unsecure |
| 642 | PC_DESCRIPTION = C++ wrapper for gRPC without SSL |
| 643 | PC_CFLAGS = |
| 644 | PC_REQUIRES_PRIVATE = grpc_unsecure $(PC_REQUIRES_GRPCXX) |
| 645 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPCXX) |
| 646 | GRPCXX_UNSECURE_PC_FILE := $(PC_TEMPLATE) |
| 647 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 648 | ifeq ($(MAKECMDGOALS),clean) |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 649 | NO_DEPS = true |
| 650 | endif |
| 651 | |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 652 | INSTALL_OK = false |
| 653 | ifeq ($(HAS_VALID_PROTOC),true) |
| 654 | ifeq ($(HAS_SYSTEM_PROTOBUF_VERIFY),true) |
| 655 | INSTALL_OK = true |
| 656 | endif |
| 657 | endif |
| 658 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 659 | .SECONDARY = %.pb.h %.pb.cc |
| 660 | |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 661 | PROTOC_PLUGINS =\ |
Craig Tiller | f58b9ef | 2015-01-15 09:09:12 -0800 | [diff] [blame] | 662 | % for tgt in targets: |
| 663 | % if tgt.build == 'protoc': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 664 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Craig Tiller | f58b9ef | 2015-01-15 09:09:12 -0800 | [diff] [blame] | 665 | % endif |
| 666 | % endfor |
| 667 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 668 | ifeq ($(DEP_MISSING),) |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 669 | all: static shared plugins\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 670 | % for tgt in targets: |
| 671 | % if tgt.build == 'all': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 672 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 673 | % endif |
| 674 | % endfor |
| 675 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 676 | dep_error: |
| 677 | @echo "You shouldn't see this message - all of your dependencies are correct." |
| 678 | else |
| 679 | all: dep_error git_update stop |
| 680 | |
| 681 | dep_error: |
| 682 | @echo |
| 683 | @echo "DEPENDENCY ERROR" |
| 684 | @echo |
| 685 | @echo "You are missing system dependencies that are essential to build grpc," |
| 686 | @echo "and the third_party directory doesn't have them:" |
| 687 | @echo |
| 688 | @echo " $(DEP_MISSING)" |
| 689 | @echo |
| 690 | @echo "Installing the development packages for your system will solve" |
| 691 | @echo "this issue. Please consult INSTALL to get more information." |
| 692 | @echo |
| 693 | @echo "If you need information about why these tests failed, run:" |
| 694 | @echo |
| 695 | @echo " make run_dep_checks" |
| 696 | @echo |
| 697 | endif |
| 698 | |
| 699 | git_update: |
| 700 | ifeq ($(IS_GIT_FOLDER),true) |
| 701 | @echo "Additionally, since you are in a git clone, you can download the" |
| 702 | @echo "missing dependencies in third_party by running the following command:" |
| 703 | @echo |
ctiller | 64f2910 | 2014-12-15 10:40:59 -0800 | [diff] [blame] | 704 | @echo " git submodule update --init" |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 705 | @echo |
| 706 | endif |
| 707 | |
| 708 | openssl_dep_error: openssl_dep_message git_update stop |
| 709 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 710 | protobuf_dep_error: protobuf_dep_message git_update stop |
| 711 | |
| 712 | protoc_dep_error: protoc_dep_message git_update stop |
| 713 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 714 | openssl_dep_message: |
| 715 | @echo |
| 716 | @echo "DEPENDENCY ERROR" |
| 717 | @echo |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 718 | @echo "The target you are trying to run requires OpenSSL." |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 719 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 720 | @echo |
| 721 | @echo "Please consult INSTALL to get more information." |
| 722 | @echo |
| 723 | @echo "If you need information about why these tests failed, run:" |
| 724 | @echo |
| 725 | @echo " make run_dep_checks" |
| 726 | @echo |
| 727 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 728 | protobuf_dep_message: |
| 729 | @echo |
| 730 | @echo "DEPENDENCY ERROR" |
| 731 | @echo |
| 732 | @echo "The target you are trying to run requires protobuf 3.0.0+" |
| 733 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 734 | @echo |
| 735 | @echo "Please consult INSTALL to get more information." |
| 736 | @echo |
| 737 | @echo "If you need information about why these tests failed, run:" |
| 738 | @echo |
| 739 | @echo " make run_dep_checks" |
| 740 | @echo |
| 741 | |
| 742 | protoc_dep_message: |
| 743 | @echo |
| 744 | @echo "DEPENDENCY ERROR" |
| 745 | @echo |
| 746 | @echo "The target you are trying to run requires protobuf-compiler 3.0.0+" |
| 747 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 748 | @echo |
| 749 | @echo "Please consult INSTALL to get more information." |
| 750 | @echo |
| 751 | @echo "If you need information about why these tests failed, run:" |
| 752 | @echo |
| 753 | @echo " make run_dep_checks" |
| 754 | @echo |
| 755 | |
David Garcia Quintas | 8954e90 | 2015-04-29 09:46:33 -0700 | [diff] [blame] | 756 | systemtap_dep_error: |
| 757 | @echo |
| 758 | @echo "DEPENDENCY ERROR" |
| 759 | @echo |
| 760 | @echo "Under the '$(CONFIG)' configutation, the target you are trying " |
| 761 | @echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other " |
| 762 | @echo "platforms such as Solaris and *BSD). " |
| 763 | @echo |
| 764 | @echo "Please consult INSTALL to get more information." |
| 765 | @echo |
| 766 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 767 | stop: |
| 768 | @false |
| 769 | |
ctiller | 09cb6d5 | 2014-12-19 17:38:22 -0800 | [diff] [blame] | 770 | % for tgt in targets: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 771 | ${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name} |
ctiller | 09cb6d5 | 2014-12-19 17:38:22 -0800 | [diff] [blame] | 772 | % endfor |
| 773 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 774 | run_dep_checks: |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 775 | $(OPENSSL_ALPN_CHECK_CMD) || true |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 776 | $(OPENSSL_NPN_CHECK_CMD) || true |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 777 | $(ZLIB_CHECK_CMD) || true |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 778 | $(PERFTOOLS_CHECK_CMD) || true |
| 779 | $(PROTOBUF_CHECK_CMD) || true |
David Garcia Quintas | f5fcafd | 2015-04-24 16:12:54 -0700 | [diff] [blame] | 780 | $(PROTOC_CHECK_VERSION_CMD) || true |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 781 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 782 | $(LIBDIR)/$(CONFIG)/zlib/libz.a: |
Nicolas "Pixel" Noble | 17f2b59 | 2015-01-16 07:09:10 +0100 | [diff] [blame] | 783 | $(E) "[MAKE] Building zlib" |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 784 | $(Q)(cd third_party/zlib ; CC="$(CC)" CFLAGS="$(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG))" ./configure --static) |
Nicolas "Pixel" Noble | 17f2b59 | 2015-01-16 07:09:10 +0100 | [diff] [blame] | 785 | $(Q)$(MAKE) -C third_party/zlib clean |
| 786 | $(Q)$(MAKE) -C third_party/zlib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 787 | $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/zlib |
| 788 | $(Q)cp third_party/zlib/libz.a $(LIBDIR)/$(CONFIG)/zlib |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 789 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 790 | $(LIBDIR)/$(CONFIG)/openssl/libssl.a: |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 791 | $(E) "[MAKE] Building openssl for $(SYSTEM)" |
| 792 | ifeq ($(SYSTEM),Darwin) |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 793 | $(Q)(cd third_party/openssl ; CC="$(CC) $(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./Configure darwin64-x86_64-cc) |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 794 | else |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 795 | ifeq ($(SYSTEM),MINGW32) |
| 796 | @echo "We currently don't have a good way to compile OpenSSL in-place under msys." |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 797 | @echo "Please provide a OpenSSL in your mingw32 system." |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 798 | @echo |
| 799 | @echo "Note that you can find a compatible version of the libraries here:" |
| 800 | @echo |
| 801 | @echo "http://slproweb.com/products/Win32OpenSSL.html" |
| 802 | @echo |
| 803 | @echo "If you decide to install that one, take the full version. The light" |
| 804 | @echo "version only contains compiled DLLs, without the development files." |
| 805 | @echo |
| 806 | @echo "When installing, chose to copy the OpenSSL dlls to the OpenSSL binaries" |
| 807 | @echo "directory. This way we'll link to them directly." |
| 808 | @echo |
| 809 | @echo "You can then re-start the build the following way:" |
| 810 | @echo |
| 811 | @echo " CPPFLAGS=-I/c/OpenSSL-Win64/include LDFLAGS=-L/c/OpenSSL-Win64 make" |
| 812 | @false |
| 813 | else |
| 814 | $(Q)(cd third_party/openssl ; CC="$(CC) $(PIC_CPPFLAGS) -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./config no-asm $(OPENSSL_CONFIG_$(CONFIG))) |
| 815 | endif |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 816 | endif |
Nicolas "Pixel" Noble | 17f2b59 | 2015-01-16 07:09:10 +0100 | [diff] [blame] | 817 | $(Q)$(MAKE) -C third_party/openssl clean |
Jan Tattermusch | c9c83cf | 2015-06-17 13:42:34 -0700 | [diff] [blame] | 818 | $(Q)(unset CPPFLAGS; $(MAKE) -C third_party/openssl build_crypto build_ssl) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 819 | $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl |
| 820 | $(Q)cp third_party/openssl/libssl.a third_party/openssl/libcrypto.a $(LIBDIR)/$(CONFIG)/openssl |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 821 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 822 | third_party/protobuf/configure: |
| 823 | $(E) "[AUTOGEN] Preparing protobuf" |
| 824 | $(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete) |
| 825 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 826 | $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 827 | $(E) "[MAKE] Building protobuf" |
Nicolas "Pixel" Noble | e0953b7 | 2015-05-21 05:05:17 +0200 | [diff] [blame] | 828 | $(Q)(cd third_party/protobuf ; CC="$(CC)" CXX="$(CXX)" LDFLAGS="$(LDFLAGS_$(CONFIG)) -g" CPPFLAGS="$(PIC_CPPFLAGS) $(CPPFLAGS_$(CONFIG)) -g" ./configure --disable-shared --enable-static) |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 829 | $(Q)$(MAKE) -C third_party/protobuf clean |
| 830 | $(Q)$(MAKE) -C third_party/protobuf |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 831 | $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/protobuf |
| 832 | $(Q)mkdir -p $(BINDIR)/$(CONFIG)/protobuf |
| 833 | $(Q)cp third_party/protobuf/src/.libs/libprotoc.a $(LIBDIR)/$(CONFIG)/protobuf |
| 834 | $(Q)cp third_party/protobuf/src/.libs/libprotobuf.a $(LIBDIR)/$(CONFIG)/protobuf |
| 835 | $(Q)cp third_party/protobuf/src/protoc $(BINDIR)/$(CONFIG)/protobuf |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 836 | |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 837 | static: static_c static_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 838 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 839 | static_c: pc_c pc_c_unsecure \ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 840 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 841 | % if lib.build == 'all' and lib.language == 'c': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 842 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 843 | % endif |
| 844 | % endfor |
| 845 | |
| 846 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 847 | static_cxx: pc_cxx pc_cxx_unsecure pc_gpr\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 848 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 849 | % if lib.build == 'all' and lib.language == 'c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 850 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 851 | % endif |
| 852 | % endfor |
| 853 | |
| 854 | |
| 855 | shared: shared_c shared_cxx |
| 856 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 857 | shared_c: pc_c pc_c_unsecure pc_gpr\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 858 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 859 | % if lib.build == 'all' and lib.language == 'c': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 860 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 861 | % endif |
| 862 | % endfor |
| 863 | |
| 864 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 865 | shared_cxx: pc_cxx pc_cxx_unsecure \ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 866 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 867 | % if lib.build == 'all' and lib.language == 'c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 868 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 869 | % endif |
| 870 | % endfor |
| 871 | |
| 872 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 873 | shared_csharp: shared_c \ |
| 874 | % for lib in libs: |
| 875 | % if lib.build == 'all' and lib.language == 'csharp': |
| 876 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
| 877 | % endif |
| 878 | % endfor |
| 879 | |
| 880 | grpc_csharp_ext: shared_csharp |
| 881 | |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 882 | plugins: $(PROTOC_PLUGINS) |
| 883 | |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 884 | privatelibs: privatelibs_c privatelibs_cxx |
| 885 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 886 | privatelibs_c: \ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 887 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 888 | % if lib.build == 'private' and lib.language == 'c': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 889 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 890 | % endif |
| 891 | % endfor |
| 892 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 893 | pc_gpr: $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc |
| 894 | |
| 895 | pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc |
| 896 | |
| 897 | pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc |
| 898 | |
| 899 | pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc |
| 900 | |
| 901 | pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 902 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 903 | privatelibs_cxx: \ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 904 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 905 | % if lib.build == 'private' and lib.language == 'c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 906 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 907 | % endif |
| 908 | % endfor |
| 909 | |
| 910 | |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 911 | buildtests: buildtests_c buildtests_cxx |
| 912 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 913 | buildtests_c: privatelibs_c\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 914 | % for tgt in targets: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 915 | % if tgt.build == 'test' and not tgt.language == 'c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 916 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 917 | % endif |
| 918 | % endfor |
| 919 | |
| 920 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 921 | buildtests_cxx: privatelibs_cxx\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 922 | % for tgt in targets: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 923 | % if tgt.build == 'test' and tgt.language == 'c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 924 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 925 | % endif |
| 926 | % endfor |
| 927 | |
| 928 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 929 | test: test_c test_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 930 | |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 931 | flaky_test: flaky_test_c flaky_test_cxx |
| 932 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 933 | test_c: buildtests_c |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 934 | % for tgt in targets: |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 935 | % if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and not tgt.get('flaky', False): |
| 936 | $(E) "[RUN] Testing ${tgt.name}" |
| 937 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 938 | % endif |
| 939 | % endfor |
| 940 | |
| 941 | |
| 942 | flaky_test_c: buildtests_c |
| 943 | % for tgt in targets: |
| 944 | % if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and tgt.get('flaky', False): |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 945 | $(E) "[RUN] Testing ${tgt.name}" |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 946 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 947 | % endif |
| 948 | % endfor |
| 949 | |
| 950 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 951 | test_cxx: buildtests_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 952 | % for tgt in targets: |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 953 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False): |
| 954 | $(E) "[RUN] Testing ${tgt.name}" |
| 955 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 956 | % endif |
| 957 | % endfor |
| 958 | |
| 959 | |
| 960 | flaky_test_cxx: buildtests_cxx |
| 961 | % for tgt in targets: |
| 962 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 963 | $(E) "[RUN] Testing ${tgt.name}" |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 964 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 965 | % endif |
| 966 | % endfor |
| 967 | |
| 968 | |
Nicolas "Pixel" Noble | 051a28f | 2015-03-17 22:54:54 +0100 | [diff] [blame] | 969 | test_python: static_c |
| 970 | $(E) "[RUN] Testing python code" |
| 971 | $(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG) |
| 972 | |
| 973 | |
Craig Tiller | 7552f0f | 2015-06-19 17:46:20 -0700 | [diff] [blame] | 974 | tools: tools_c tools_cxx |
| 975 | |
| 976 | |
| 977 | tools_c: privatelibs_c\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 978 | % for tgt in targets: |
Craig Tiller | 7552f0f | 2015-06-19 17:46:20 -0700 | [diff] [blame] | 979 | % if tgt.build == 'tool' and not tgt.language=='c++': |
| 980 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 981 | % endif |
| 982 | % endfor |
| 983 | |
| 984 | |
| 985 | tools_cxx: privatelibs_cxx\ |
| 986 | % for tgt in targets: |
| 987 | % if tgt.build == 'tool' and tgt.language=='c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 988 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 989 | % endif |
| 990 | % endfor |
| 991 | |
| 992 | |
| 993 | buildbenchmarks: privatelibs\ |
| 994 | % for tgt in targets: |
| 995 | % if tgt.build == 'benchmark': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 996 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 997 | % endif |
| 998 | % endfor |
| 999 | |
| 1000 | |
| 1001 | benchmarks: buildbenchmarks |
| 1002 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1003 | strip: strip-static strip-shared |
| 1004 | |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1005 | strip-static: strip-static_c strip-static_cxx |
| 1006 | |
| 1007 | strip-shared: strip-shared_c strip-shared_cxx |
| 1008 | |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1009 | |
| 1010 | # TODO(nnoble): the strip target is stripping in-place, instead |
| 1011 | # of copying files in a temporary folder. |
| 1012 | # This prevents proper debugging after running make install. |
| 1013 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1014 | strip-static_c: static_c |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1015 | ifeq ($(CONFIG),opt) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1016 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1017 | % if lib.language == "c": |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1018 | % if lib.build == "all": |
| 1019 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1020 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1021 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1022 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1023 | % endfor |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1024 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1025 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1026 | strip-static_cxx: static_cxx |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1027 | ifeq ($(CONFIG),opt) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1028 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1029 | % if lib.language == "c++": |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1030 | % if lib.build == "all": |
| 1031 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1032 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1033 | % endif |
| 1034 | % endif |
| 1035 | % endfor |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1036 | endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1037 | |
| 1038 | strip-shared_c: shared_c |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1039 | ifeq ($(CONFIG),opt) |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1040 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1041 | % if lib.language == "c": |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1042 | % if lib.build == "all": |
| 1043 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1044 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1045 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1046 | % endif |
| 1047 | % endfor |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1048 | endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1049 | |
| 1050 | strip-shared_cxx: shared_cxx |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1051 | ifeq ($(CONFIG),opt) |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1052 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1053 | % if lib.language == "c++": |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1054 | % if lib.build == "all": |
| 1055 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1056 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1057 | % endif |
| 1058 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1059 | % endfor |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1060 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1061 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1062 | strip-shared_csharp: shared_csharp |
| 1063 | ifeq ($(CONFIG),opt) |
| 1064 | % for lib in libs: |
| 1065 | % if lib.language == "csharp": |
| 1066 | % if lib.build == "all": |
| 1067 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 1068 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
| 1069 | % endif |
| 1070 | % endif |
| 1071 | % endfor |
| 1072 | endif |
| 1073 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1074 | $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc: |
| 1075 | $(E) "[MAKE] Generating $@" |
| 1076 | $(Q) mkdir -p $(@D) |
| 1077 | $(Q) echo -e "$(GPR_PC_FILE)" >$@ |
| 1078 | |
| 1079 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc: |
| 1080 | $(E) "[MAKE] Generating $@" |
| 1081 | $(Q) mkdir -p $(@D) |
| 1082 | $(Q) echo -e "$(GRPC_PC_FILE)" >$@ |
| 1083 | |
| 1084 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc: |
| 1085 | $(E) "[MAKE] Generating $@" |
| 1086 | $(Q) mkdir -p $(@D) |
| 1087 | $(Q) echo -e "$(GRPC_UNSECURE_PC_FILE)" >$@ |
| 1088 | |
| 1089 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc: |
| 1090 | $(E) "[MAKE] Generating $@" |
| 1091 | $(Q) mkdir -p $(@D) |
| 1092 | $(Q) echo -e "$(GRPCXX_PC_FILE)" >$@ |
| 1093 | |
| 1094 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc: |
| 1095 | $(E) "[MAKE] Generating $@" |
| 1096 | $(Q) mkdir -p $(@D) |
| 1097 | $(Q) echo -e "$(GRPCXX_UNSECURE_PC_FILE)" >$@ |
| 1098 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1099 | % for p in protos: |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1100 | ifeq ($(NO_PROTOC),true) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1101 | $(GENDIR)/${p}.pb.cc: protoc_dep_error |
Nicolas "Pixel" Noble | 0caebbf | 2015-04-09 23:08:51 +0200 | [diff] [blame] | 1102 | $(GENDIR)/${p}.grpc.pb.cc: protoc_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1103 | else |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1104 | $(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1105 | $(E) "[PROTOC] Generating protobuf CC file from $<" |
| 1106 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | 0caebbf | 2015-04-09 23:08:51 +0200 | [diff] [blame] | 1107 | $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< |
| 1108 | |
| 1109 | $(GENDIR)/${p}.grpc.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) |
| 1110 | $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" |
| 1111 | $(Q) mkdir -p `dirname $@` |
| 1112 | $(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1113 | endif |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1114 | |
| 1115 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1116 | |
David Garcia Quintas | bbc0b77 | 2015-04-29 14:10:05 -0700 | [diff] [blame] | 1117 | ifeq ($(CONFIG),stapprof) |
| 1118 | src/core/profiling/stap_timers.c: $(GENDIR)/src/core/profiling/stap_probes.h |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 1119 | ifeq ($(HAS_SYSTEMTAP),true) |
| 1120 | $(GENDIR)/src/core/profiling/stap_probes.h: src/core/profiling/stap_probes.d |
| 1121 | $(E) "[DTRACE] Compiling $<" |
| 1122 | $(Q) mkdir -p `dirname $@` |
| 1123 | $(Q) $(DTRACE) -C -h -s $< -o $@ |
David Garcia Quintas | 8954e90 | 2015-04-29 09:46:33 -0700 | [diff] [blame] | 1124 | else |
| 1125 | $(GENDIR)/src/core/profiling/stap_probes.h: systemtap_dep_error stop |
| 1126 | endif |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 1127 | endif |
| 1128 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1129 | $(OBJDIR)/$(CONFIG)/%.o : %.c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1130 | $(E) "[C] Compiling $<" |
| 1131 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1132 | $(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1133 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1134 | $(OBJDIR)/$(CONFIG)/%.o : $(GENDIR)/%.pb.cc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1135 | $(E) "[CXX] Compiling $<" |
| 1136 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1137 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1138 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1139 | $(OBJDIR)/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1140 | $(E) "[HOSTCXX] Compiling $<" |
| 1141 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1142 | $(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] | 1143 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1144 | $(OBJDIR)/$(CONFIG)/%.o : %.cc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1145 | $(E) "[CXX] Compiling $<" |
| 1146 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1147 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1148 | |
Nicolas "Pixel" Noble | 161ea23 | 2015-02-22 05:48:53 +0100 | [diff] [blame] | 1149 | install: install_c install_cxx install-plugins install-certs verify-install |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1150 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1151 | install_c: install-headers_c install-static_c install-shared_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1152 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1153 | install_cxx: install-headers_cxx install-static_cxx install-shared_cxx |
| 1154 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1155 | install_csharp: install-shared_csharp install_c |
| 1156 | |
| 1157 | install_grpc_csharp_ext: install_csharp |
| 1158 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1159 | install-headers: install-headers_c install-headers_cxx |
| 1160 | |
| 1161 | install-headers_c: |
| 1162 | $(E) "[INSTALL] Installing public C headers" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1163 | $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1164 | $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 |
| 1165 | |
| 1166 | install-headers_cxx: |
| 1167 | $(E) "[INSTALL] Installing public C++ headers" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1168 | $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) -d $(prefix)/$(dir $(h)) && ) exit 0 || exit 1 |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1169 | $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 |
| 1170 | |
| 1171 | install-static: install-static_c install-static_cxx |
| 1172 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1173 | install-static_c: static_c strip-static_c install-pkg-config_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1174 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1175 | % if lib.language == "c": |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1176 | % if lib.build == "all": |
| 1177 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1178 | $(Q) $(INSTALL) -d $(prefix)/lib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1179 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1180 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1181 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1182 | % endfor |
| 1183 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1184 | install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1185 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1186 | % if lib.language == "c++": |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1187 | % if lib.build == "all": |
| 1188 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1189 | $(Q) $(INSTALL) -d $(prefix)/lib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1190 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1191 | % endif |
| 1192 | % endif |
| 1193 | % endfor |
| 1194 | |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1195 | <%def name="install_shared(lang_filter)">\ |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1196 | % for lib in libs: |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1197 | % if lib.language == lang_filter: |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1198 | % if lib.build == "all": |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1199 | ifeq ($(SYSTEM),MINGW32) |
| 1200 | $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1201 | $(Q) $(INSTALL) -d $(prefix)/lib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1202 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) |
| 1203 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1204 | else |
| 1205 | $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1206 | $(Q) $(INSTALL) -d $(prefix)/lib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1207 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) |
Masood Malekghassemi | d1be74f | 2015-04-07 16:23:09 -0700 | [diff] [blame] | 1208 | ifneq ($(SYSTEM),Darwin) |
Tim Emiola | 820e3d6 | 2015-04-10 09:11:50 -0700 | [diff] [blame] | 1209 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major} |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1210 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so |
| 1211 | endif |
| 1212 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1213 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1214 | % endif |
| 1215 | % endfor |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1216 | ifneq ($(SYSTEM),MINGW32) |
| 1217 | ifneq ($(SYSTEM),Darwin) |
Nicolas "Pixel" Noble | cc2b42a | 2015-02-20 00:42:21 +0100 | [diff] [blame] | 1218 | $(Q) ldconfig || true |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1219 | endif |
| 1220 | endif |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1221 | </%def> |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1222 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1223 | install-shared_c: shared_c strip-shared_c install-pkg-config_c |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1224 | ${install_shared("c")} |
| 1225 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1226 | install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c install-pkg-config_cxx |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1227 | ${install_shared("c++")} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1228 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1229 | install-shared_csharp: shared_csharp strip-shared_csharp |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1230 | ${install_shared("csharp")} |
| 1231 | |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1232 | install-plugins: $(PROTOC_PLUGINS) |
| 1233 | ifeq ($(SYSTEM),MINGW32) |
| 1234 | $(Q) false |
| 1235 | else |
| 1236 | $(E) "[INSTALL] Installing grpc protoc plugins" |
| 1237 | % for tgt in targets: |
| 1238 | % if tgt.build == 'protoc': |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1239 | $(Q) $(INSTALL) -d $(prefix)/bin |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1240 | $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name} |
| 1241 | % endif |
| 1242 | % endfor |
| 1243 | endif |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1244 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1245 | install-pkg-config_c: pc_gpr pc_c pc_c_unsecure |
| 1246 | $(E) "[INSTALL] Installing C pkg-config files" |
| 1247 | $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig |
| 1248 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc $(prefix)/lib/pkgconfig/gpr.pc |
| 1249 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc |
| 1250 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc |
| 1251 | |
| 1252 | install-pkg-config_cxx: pc_cxx pc_cxx_unsecure |
| 1253 | $(E) "[INSTALL] Installing C++ pkg-config files" |
| 1254 | $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig |
| 1255 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc $(prefix)/lib/pkgconfig/grpc++.pc |
| 1256 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc $(prefix)/lib/pkgconfig/grpc++_unsecure.pc |
| 1257 | |
Nicolas "Pixel" Noble | 161ea23 | 2015-02-22 05:48:53 +0100 | [diff] [blame] | 1258 | install-certs: etc/roots.pem |
| 1259 | $(E) "[INSTALL] Installing root certificates" |
| 1260 | $(Q) $(INSTALL) -d $(prefix)/share/grpc |
| 1261 | $(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem |
| 1262 | |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1263 | verify-install: |
Nicolas "Pixel" Noble | 2c23a72 | 2015-02-24 20:17:45 +0100 | [diff] [blame] | 1264 | ifeq ($(INSTALL_OK),true) |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1265 | @echo "Your system looks ready to go." |
| 1266 | @echo |
| 1267 | else |
murgatroid99 | b618136 | 2015-03-02 14:32:25 -0800 | [diff] [blame] | 1268 | @echo "We couldn't find protoc 3.0.0+ installed on your system. While this" |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1269 | @echo "won't prevent grpc from working, you won't be able to compile" |
| 1270 | @echo "and run any meaningful code with it." |
| 1271 | @echo |
| 1272 | @echo |
| 1273 | @echo "Please download and install protobuf 3.0.0+ from:" |
| 1274 | @echo |
| 1275 | @echo " https://github.com/google/protobuf/releases" |
| 1276 | @echo |
murgatroid99 | b618136 | 2015-03-02 14:32:25 -0800 | [diff] [blame] | 1277 | @echo "Once you've done so, or if you think this message is in error," |
| 1278 | @echo "you can re-run this check by doing:" |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1279 | @echo |
| 1280 | @echo " make verify-install" |
| 1281 | endif |
| 1282 | |
Craig Tiller | 3759e6f | 2015-01-15 08:13:11 -0800 | [diff] [blame] | 1283 | clean: |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1284 | $(E) "[CLEAN] Cleaning build directories." |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1285 | $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1286 | |
| 1287 | |
| 1288 | # The various libraries |
| 1289 | |
| 1290 | % for lib in libs: |
| 1291 | ${makelib(lib)} |
| 1292 | % endfor |
| 1293 | |
| 1294 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1295 | # All of the test targets, and protoc plugins |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1296 | |
| 1297 | % for tgt in targets: |
| 1298 | ${maketarget(tgt)} |
| 1299 | % endfor |
| 1300 | |
| 1301 | <%def name="makelib(lib)"> |
| 1302 | LIB${lib.name.upper()}_SRC = \\ |
| 1303 | |
| 1304 | % for src in lib.src: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1305 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1306 | |
| 1307 | % endfor |
| 1308 | |
| 1309 | % if "public_headers" in lib: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1310 | % if lib.language == "c++": |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1311 | PUBLIC_HEADERS_CXX += \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1312 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1313 | % else: |
| 1314 | PUBLIC_HEADERS_C += \\ |
| 1315 | |
| 1316 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1317 | % for hdr in lib.public_headers: |
| 1318 | ${hdr} \\ |
| 1319 | |
| 1320 | % endfor |
| 1321 | % endif |
| 1322 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1323 | 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] | 1324 | |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 1325 | ## If the library requires OpenSSL, let's add some restrictions. |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1326 | % if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1327 | ifeq ($(NO_SECURE),true) |
| 1328 | |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 1329 | # You can't build secure libraries if you don't have OpenSSL. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1330 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1331 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1332 | |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1333 | % if lib.build == "all": |
| 1334 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1335 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): openssl_dep_error |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1336 | else |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1337 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): openssl_dep_error |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1338 | endif |
| 1339 | % endif |
| 1340 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1341 | else |
| 1342 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1343 | % if lib.language == 'c++': |
| 1344 | ifeq ($(NO_PROTOBUF),true) |
| 1345 | |
| 1346 | # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. |
| 1347 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1348 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1349 | |
| 1350 | % if lib.build == "all": |
| 1351 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1352 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1353 | else |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1354 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1355 | endif |
| 1356 | % endif |
| 1357 | |
| 1358 | else |
| 1359 | % endif |
| 1360 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1361 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\ |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1362 | ## The else here corresponds to the if secure earlier. |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1363 | % else: |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1364 | % if lib.language == 'c++': |
| 1365 | ifeq ($(NO_PROTOBUF),true) |
| 1366 | |
| 1367 | # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. |
| 1368 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1369 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1370 | |
| 1371 | % if lib.build == "all": |
| 1372 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1373 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1374 | else |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1375 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1376 | endif |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1377 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1378 | |
| 1379 | else |
| 1380 | |
| 1381 | % endif |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1382 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP)\ |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1383 | % endif |
| 1384 | % if lib.language == 'c++': |
| 1385 | $(PROTOBUF_DEP)\ |
| 1386 | % endif |
| 1387 | $(LIB${lib.name.upper()}_OBJS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1388 | $(E) "[AR] Creating $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1389 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1390 | $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
| 1391 | $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1392 | % if lib.get('baselib', False): |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1393 | % if lib.get('secure', 'check') == 'yes': |
Craig Tiller | 7ab4fee | 2015-02-24 08:15:53 -0800 | [diff] [blame] | 1394 | $(Q) rm -rf tmp-merge-${lib.name} |
| 1395 | $(Q) mkdir tmp-merge-${lib.name} |
| 1396 | $(Q) ( cd tmp-merge-${lib.name} ; $(AR) x ../$(LIBDIR)/$(CONFIG)/lib${lib.name}.a ) |
| 1397 | $(Q) for l in $(OPENSSL_MERGE_LIBS) ; do ( cd tmp-merge-${lib.name} ; <%text>ar x ../$${l}</%text> ) ; done |
| 1398 | $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge-${lib.name}/__.SYMDEF* |
| 1399 | $(Q) ar rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge-${lib.name}/* |
| 1400 | $(Q) rm -rf tmp-merge-${lib.name} |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1401 | % endif |
| 1402 | % endif |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 1403 | ifeq ($(SYSTEM),Darwin) |
murgatroid99 | b618136 | 2015-03-02 14:32:25 -0800 | [diff] [blame] | 1404 | $(Q) ranlib $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 1405 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1406 | |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1407 | <% |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1408 | |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1409 | if lib.language == 'c++': |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1410 | ld = '$(LDXX)' |
| 1411 | else: |
| 1412 | ld = '$(LD)' |
| 1413 | |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1414 | out_base = '$(LIBDIR)/$(CONFIG)/' + lib.name |
| 1415 | out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1416 | |
| 1417 | common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)' |
| 1418 | |
| 1419 | libs = '' |
Nicolas "Pixel" Noble | 85bf09b | 2015-01-15 18:22:40 +0100 | [diff] [blame] | 1420 | lib_deps = ' $(ZLIB_DEP)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1421 | mingw_libs = '' |
Nicolas "Pixel" Noble | 85bf09b | 2015-01-15 18:22:40 +0100 | [diff] [blame] | 1422 | mingw_lib_deps = ' $(ZLIB_DEP)' |
Michael Berlin | bf2e7f0 | 2015-05-01 16:17:01 -0700 | [diff] [blame] | 1423 | if lib.language == 'c++': |
| 1424 | lib_deps += ' $(PROTOBUF_DEP)' |
| 1425 | mingw_lib_deps += ' $(PROTOBUF_DEP)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1426 | for dep in lib.get('deps', []): |
| 1427 | libs = libs + ' -l' + dep |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1428 | lib_deps = lib_deps + ' $(LIBDIR)/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1429 | mingw_libs = mingw_libs + ' -l' + dep + '-imp' |
Michael Berlin | 5351392 | 2015-05-01 16:14:15 -0700 | [diff] [blame] | 1430 | mingw_lib_deps = mingw_lib_deps + ' $(LIBDIR)/$(CONFIG)/' + dep + '.$(SHARED_EXT)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1431 | |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1432 | if lib.get('secure', 'check') == 'yes': |
Nicolas "Pixel" Noble | 945b413 | 2015-06-02 20:13:40 +0200 | [diff] [blame] | 1433 | common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)' |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1434 | for src in lib.src: |
| 1435 | sources_that_need_openssl.add(src) |
| 1436 | else: |
| 1437 | for src in lib.src: |
| 1438 | sources_that_don_t_need_openssl.add(src) |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1439 | |
| 1440 | if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1441 | lib_deps = lib_deps + ' $(OPENSSL_DEP)' |
| 1442 | mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)' |
Nicolas "Pixel" Noble | dda049c | 2015-02-21 00:39:32 +0100 | [diff] [blame] | 1443 | |
| 1444 | if lib.language == 'c++': |
| 1445 | common = common + ' $(LDLIBSXX) $(LDLIBS_PROTOBUF)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1446 | %> |
| 1447 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1448 | % if lib.build == "all": |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1449 | ifeq ($(SYSTEM),MINGW32) |
| 1450 | ${out_base}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1451 | $(E) "[LD] Linking $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1452 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1453 | $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=${out_base}.def -Wl,--out-implib=${out_libbase}-imp.a -o ${out_base}.$(SHARED_EXT) ${common}${mingw_libs} |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1454 | else |
| 1455 | ${out_libbase}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${lib_deps} |
| 1456 | $(E) "[LD] Linking $@" |
| 1457 | $(Q) mkdir -p `dirname $@` |
| 1458 | ifeq ($(SYSTEM),Darwin) |
Masood Malekghassemi | d1be74f | 2015-04-07 16:23:09 -0700 | [diff] [blame] | 1459 | $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name lib${lib.name}.$(SHARED_EXT) -dynamiclib -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1460 | else |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1461 | $(Q) ${ld} $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.version.major} -o ${out_libbase}.$(SHARED_EXT) ${common}${libs} |
Nicolas "Pixel" Noble | d8f8b6b | 2015-01-29 21:29:43 +0100 | [diff] [blame] | 1462 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so.${settings.version.major} |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1463 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so |
| 1464 | endif |
| 1465 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1466 | % endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1467 | % if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1468 | ## If the lib was secure, we have to close the Makefile's if that tested |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 1469 | ## the presence of OpenSSL. |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1470 | |
| 1471 | endif |
| 1472 | % endif |
| 1473 | % if lib.language == 'c++': |
| 1474 | ## If the lib was C++, we have to close the Makefile's if that tested |
| 1475 | ## the presence of protobuf 3.0.0+ |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1476 | |
| 1477 | endif |
| 1478 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1479 | |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1480 | % if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1481 | ifneq ($(NO_SECURE),true) |
| 1482 | % endif |
| 1483 | ifneq ($(NO_DEPS),true) |
Craig Tiller | 8f126a6 | 2015-01-15 08:50:19 -0800 | [diff] [blame] | 1484 | -include $(LIB${lib.name.upper()}_OBJS:.o=.dep) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1485 | endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1486 | % if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1487 | endif |
| 1488 | % endif |
Craig Tiller | 27715ca | 2015-01-12 16:55:59 -0800 | [diff] [blame] | 1489 | % for src in lib.src: |
Craig Tiller | d896fa5 | 2015-04-24 14:30:09 -0700 | [diff] [blame] | 1490 | % if not proto_re.match(src) and any(proto_re.match(src2) for src2 in lib.src): |
Craig Tiller | 04f8156 | 2015-04-24 14:34:30 -0700 | [diff] [blame] | 1491 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: ${' '.join(proto_to_cc(src2) for src2 in lib.src if proto_re.match(src2))} |
Craig Tiller | 27715ca | 2015-01-12 16:55:59 -0800 | [diff] [blame] | 1492 | % endif |
Craig Tiller | 27715ca | 2015-01-12 16:55:59 -0800 | [diff] [blame] | 1493 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1494 | </%def> |
| 1495 | |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1496 | <%def name="maketarget(tgt)"><% has_no_sources = not tgt.src %> |
| 1497 | % if not has_no_sources: |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1498 | ${tgt.name.upper()}_SRC = \\ |
| 1499 | |
| 1500 | % for src in tgt.src: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1501 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1502 | |
| 1503 | % endfor |
| 1504 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1505 | ${tgt.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC)))) |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1506 | % endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1507 | % if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1508 | ifeq ($(NO_SECURE),true) |
| 1509 | |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 1510 | # You can't build secure targets if you don't have OpenSSL. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1511 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1512 | $(BINDIR)/$(CONFIG)/${tgt.name}: openssl_dep_error |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1513 | |
| 1514 | else |
| 1515 | |
| 1516 | % endif |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1517 | ## |
| 1518 | ## We're not trying to add a dependency on building zlib and openssl here, |
| 1519 | ## as it's already done in the libraries. We're assuming that the build |
| 1520 | ## trickles down, and that a secure target requires a secure version of |
| 1521 | ## a library. |
| 1522 | ## |
| 1523 | ## That simplifies the codegen a bit, but prevents a fully defined Makefile. |
| 1524 | ## I can live with that. |
| 1525 | ## |
Nicolas "Pixel" Noble | 18953e3 | 2015-02-27 02:41:11 +0100 | [diff] [blame] | 1526 | % if tgt.build == 'protoc' or tgt.language == 'c++': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1527 | |
| 1528 | ifeq ($(NO_PROTOBUF),true) |
| 1529 | |
Nicolas "Pixel" Noble | 18953e3 | 2015-02-27 02:41:11 +0100 | [diff] [blame] | 1530 | # 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] | 1531 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1532 | $(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1533 | |
| 1534 | else |
| 1535 | |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1536 | $(BINDIR)/$(CONFIG)/${tgt.name}: \ |
| 1537 | % if not has_no_sources: |
| 1538 | $(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\ |
| 1539 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1540 | % else: |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1541 | $(BINDIR)/$(CONFIG)/${tgt.name}: \ |
| 1542 | % if not has_no_sources: |
| 1543 | $(${tgt.name.upper()}_OBJS)\ |
| 1544 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1545 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1546 | % for dep in tgt.deps: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1547 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1548 | % endfor |
| 1549 | |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1550 | % if tgt.language == "c++": |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1551 | ## C++ targets specificies. |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1552 | % if tgt.build == 'protoc': |
| 1553 | $(E) "[HOSTLD] Linking $@" |
| 1554 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1555 | $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) \ |
| 1556 | % if not has_no_sources: |
| 1557 | $(${tgt.name.upper()}_OBJS)\ |
| 1558 | % endif |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1559 | % else: |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1560 | $(E) "[LD] Linking $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1561 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1562 | $(Q) $(LDXX) $(LDFLAGS) \ |
| 1563 | % if not has_no_sources: |
| 1564 | $(${tgt.name.upper()}_OBJS)\ |
| 1565 | % endif |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1566 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1567 | % else: |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1568 | ## C-only targets specificities. |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1569 | $(E) "[LD] Linking $@" |
| 1570 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1571 | $(Q) $(LD) $(LDFLAGS) \ |
| 1572 | % if not has_no_sources: |
| 1573 | $(${tgt.name.upper()}_OBJS)\ |
| 1574 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1575 | % endif |
| 1576 | % for dep in tgt.deps: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1577 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1578 | % endfor |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1579 | % if tgt.language == "c++": |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1580 | % if tgt.build == 'protoc': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1581 | $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC)\ |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1582 | % else: |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1583 | $(LDLIBSXX) $(LDLIBS_PROTOBUF)\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1584 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1585 | % endif |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 1586 | % if tgt.build == 'protoc': |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1587 | $(HOST_LDLIBS)\ |
| 1588 | % else: |
| 1589 | $(LDLIBS)\ |
| 1590 | % endif |
| 1591 | % if tgt.build == 'protoc': |
| 1592 | $(HOST_LDLIBS_PROTOC)\ |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1593 | % elif tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1594 | $(LDLIBS_SECURE)\ |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 1595 | % endif |
Yang Gao | b0b518e | 2015-04-13 14:53:25 -0700 | [diff] [blame] | 1596 | % if tgt.language == 'c++' and tgt.build == 'test': |
| 1597 | $(GTEST_LIB)\ |
David Garcia Quintas | aa52d0a | 2015-05-14 19:04:23 -0700 | [diff] [blame] | 1598 | % elif tgt.language == 'c++' and tgt.build == 'benchmark': |
| 1599 | $(GTEST_LIB)\ |
Yang Gao | b0b518e | 2015-04-13 14:53:25 -0700 | [diff] [blame] | 1600 | % endif |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1601 | -o $(BINDIR)/$(CONFIG)/${tgt.name} |
Nicolas "Pixel" Noble | 18953e3 | 2015-02-27 02:41:11 +0100 | [diff] [blame] | 1602 | % if tgt.build == 'protoc' or tgt.language == 'c++': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1603 | |
| 1604 | endif |
| 1605 | % endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1606 | % if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1607 | |
| 1608 | endif |
| 1609 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1610 | |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 1611 | % for src in tgt.src: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1612 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \ |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 1613 | % for dep in tgt.deps: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1614 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 1615 | % endfor |
| 1616 | |
| 1617 | % endfor |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1618 | % if not has_no_sources: |
Craig Tiller | 8f126a6 | 2015-01-15 08:50:19 -0800 | [diff] [blame] | 1619 | deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep) |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1620 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1621 | |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1622 | % if not has_no_sources: |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1623 | % if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1624 | ifneq ($(NO_SECURE),true) |
| 1625 | % endif |
| 1626 | ifneq ($(NO_DEPS),true) |
Craig Tiller | 8f126a6 | 2015-01-15 08:50:19 -0800 | [diff] [blame] | 1627 | -include $(${tgt.name.upper()}_OBJS:.o=.dep) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1628 | endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1629 | % if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1630 | endif |
| 1631 | % endif |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1632 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1633 | </%def> |
| 1634 | |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1635 | ifneq ($(OPENSSL_DEP),) |
| 1636 | # This is to ensure the embedded OpenSSL is built beforehand, properly |
| 1637 | # installing headers to their final destination on the drive. We need this |
| 1638 | # otherwise parallel compilation will fail if a source is compiled first. |
| 1639 | % for src in sorted(sources_that_need_openssl): |
| 1640 | % if src not in sources_that_don_t_need_openssl: |
| 1641 | ${src}: $(OPENSSL_DEP) |
| 1642 | % endif |
| 1643 | % endfor |
| 1644 | endif |
| 1645 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1646 | .PHONY: all strip tools \ |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1647 | dep_error openssl_dep_error openssl_dep_message git_update stop \ |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1648 | buildtests buildtests_c buildtests_cxx \ |
| 1649 | test test_c test_cxx \ |
| 1650 | install install_c install_cxx \ |
| 1651 | install-headers install-headers_c install-headers_cxx \ |
| 1652 | install-shared install-shared_c install-shared_cxx \ |
| 1653 | install-static install-static_c install-static_cxx \ |
| 1654 | strip strip-shared strip-static \ |
| 1655 | strip_c strip-shared_c strip-static_c \ |
| 1656 | strip_cxx strip-shared_cxx strip-static_cxx \ |
Craig Tiller | f0afe50 | 2015-01-15 09:04:49 -0800 | [diff] [blame] | 1657 | dep_c dep_cxx bins_dep_c bins_dep_cxx \ |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1658 | clean |