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