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) |
Nicolas "Pixel" Noble | e758ed1 | 2015-03-11 22:51:39 +0100 | [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 |
Craig Tiller | 96b4955 | 2015-01-21 16:29:01 -0800 | [diff] [blame] | 294 | LIBS = m z |
Nicolas "Pixel" Noble | e758ed1 | 2015-03-11 22:51:39 +0100 | [diff] [blame] | 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) |
ctiller | c008ae5 | 2015-01-07 15:33:00 -0800 | [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) |
| 312 | LIBS = m z pthread |
| 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 |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 350 | |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 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 |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [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) |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 439 | ZOOKEEPER_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/zookeeper.c $(LDFLAGS) -lzookeeper_mt |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 440 | |
Craig Tiller | 50524cc | 2015-01-29 23:00:00 -0800 | [diff] [blame] | 441 | ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 442 | 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] | 443 | ifeq ($(HAS_SYSTEM_PERFTOOLS),true) |
| 444 | DEFINES += GRPC_HAVE_PERFTOOLS |
| 445 | LIBS += profiler |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 446 | CACHE_MK += HAS_SYSTEM_PERFTOOLS = true, |
Craig Tiller | 297fafa | 2015-01-15 15:46:39 -0800 | [diff] [blame] | 447 | endif |
Craig Tiller | 50524cc | 2015-01-29 23:00:00 -0800 | [diff] [blame] | 448 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 449 | |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 450 | 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] | 451 | ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 452 | 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] | 453 | ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) |
| 454 | HAS_SYSTEM_OPENSSL_NPN = true |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 455 | CACHE_MK += HAS_SYSTEM_OPENSSL_ALPN = true, |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 456 | else |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 457 | 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] | 458 | endif |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 459 | ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 460 | CACHE_MK += HAS_SYSTEM_OPENSSL_NPN = true, |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 461 | endif |
| 462 | HAS_SYSTEM_ZLIB ?= $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 463 | ifeq ($(HAS_SYSTEM_ZLIB),true) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 464 | CACHE_MK += HAS_SYSTEM_ZLIB = true, |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 465 | endif |
| 466 | HAS_SYSTEM_PROTOBUF ?= $(HAS_SYSTEM_PROTOBUF_VERIFY) |
| 467 | ifeq ($(HAS_SYSTEM_PROTOBUF),true) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 468 | CACHE_MK += HAS_SYSTEM_PROTOBUF = true, |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 469 | endif |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 470 | else |
| 471 | # override system libraries if the config requires a custom compiled library |
| 472 | HAS_SYSTEM_OPENSSL_ALPN = false |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 473 | HAS_SYSTEM_OPENSSL_NPN = false |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 474 | HAS_SYSTEM_ZLIB = false |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 475 | HAS_SYSTEM_PROTOBUF = false |
Craig Tiller | c4da6b7 | 2015-01-15 08:01:14 -0800 | [diff] [blame] | 476 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 477 | |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 478 | 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] | 479 | ifeq ($(HAS_PROTOC),true) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 480 | CACHE_MK += HAS_PROTOC = true, |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 481 | HAS_VALID_PROTOC ?= $(shell $(PROTOC_CHECK_VERSION_CMD) 2> /dev/null && echo true || echo false) |
| 482 | ifeq ($(HAS_VALID_PROTOC),true) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 483 | CACHE_MK += HAS_VALID_PROTOC = true, |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 484 | endif |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 485 | else |
| 486 | HAS_VALID_PROTOC = false |
| 487 | endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 488 | |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 489 | # Check for Systemtap (https://sourceware.org/systemtap/), first by making sure <sys/sdt.h> is present |
| 490 | # in the system and secondly by checking for the "dtrace" binary (on Linux, this is part of the Systemtap |
| 491 | # distribution. It's part of the base system on BSD/Solaris machines). |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 492 | ifndef HAS_SYSTEMTAP |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 493 | HAS_SYSTEMTAP_HEADERS = $(shell $(SYSTEMTAP_HEADERS_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 494 | HAS_DTRACE = $(shell $(DTRACE_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 495 | HAS_SYSTEMTAP = false |
| 496 | ifeq ($(HAS_SYSTEMTAP_HEADERS),true) |
| 497 | ifeq ($(HAS_DTRACE),true) |
| 498 | HAS_SYSTEMTAP = true |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 499 | endif |
| 500 | endif |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 501 | endif |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 502 | |
murgatroid99 | 4a015a6 | 2015-07-10 14:54:57 -0700 | [diff] [blame] | 503 | ifeq ($(HAS_SYSTEMTAP),true) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 504 | CACHE_MK += HAS_SYSTEMTAP = true, |
murgatroid99 | 4a015a6 | 2015-07-10 14:54:57 -0700 | [diff] [blame] | 505 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 506 | |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 507 | HAS_ZOOKEEPER = $(shell $(ZOOKEEPER_CHECK_CMD) 2> /dev/null && echo true || echo false) |
| 508 | |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 509 | # Note that for testing purposes, one can do: |
| 510 | # make HAS_EMBEDDED_OPENSSL_ALPN=false |
| 511 | # 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] | 512 | ifeq ($(wildcard third_party/openssl/ssl/ssl.h),) |
| 513 | HAS_EMBEDDED_OPENSSL_ALPN = false |
| 514 | else |
| 515 | HAS_EMBEDDED_OPENSSL_ALPN = true |
| 516 | endif |
| 517 | |
| 518 | ifeq ($(wildcard third_party/zlib/zlib.h),) |
| 519 | HAS_EMBEDDED_ZLIB = false |
| 520 | else |
| 521 | HAS_EMBEDDED_ZLIB = true |
| 522 | endif |
| 523 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 524 | ifeq ($(wildcard third_party/protobuf/src/google/protobuf/descriptor.pb.h),) |
| 525 | HAS_EMBEDDED_PROTOBUF = false |
| 526 | ifneq ($(HAS_VALID_PROTOC),true) |
| 527 | NO_PROTOC = true |
| 528 | endif |
| 529 | else |
| 530 | HAS_EMBEDDED_PROTOBUF = true |
| 531 | endif |
| 532 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 533 | PC_REQUIRES_GRPC = gpr |
| 534 | PC_LIBS_GRPC = |
| 535 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 536 | ifeq ($(HAS_SYSTEM_ZLIB),false) |
| 537 | ifeq ($(HAS_EMBEDDED_ZLIB),true) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 538 | ZLIB_DEP = $(LIBDIR)/$(CONFIG)/zlib/libz.a |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 539 | CPPFLAGS += -Ithird_party/zlib |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 540 | LDFLAGS += -L$(LIBDIR)/$(CONFIG)/zlib |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 541 | else |
| 542 | DEP_MISSING += zlib |
| 543 | endif |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 544 | else |
| 545 | ifeq ($(HAS_PKG_CONFIG),true) |
murgatroid99 | 66d6edb | 2015-07-06 11:37:51 -0700 | [diff] [blame] | 546 | CPPFLAGS += $(shell $(PKG_CONFIG) --cflags zlib) |
| 547 | LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L zlib) |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 548 | PC_REQUIRES_GRPC += zlib |
| 549 | else |
| 550 | PC_LIBS_GRPC += -lz |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 551 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 552 | endif |
| 553 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 554 | OPENSSL_PKG_CONFIG = false |
| 555 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 556 | PC_REQUIRES_SECURE = |
| 557 | PC_LIBS_SECURE = |
| 558 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 559 | ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) |
| 560 | ifeq ($(HAS_PKG_CONFIG),true) |
| 561 | OPENSSL_PKG_CONFIG = true |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 562 | PC_REQUIRES_SECURE = openssl |
murgatroid99 | 66d6edb | 2015-07-06 11:37:51 -0700 | [diff] [blame] | 563 | CPPFLAGS := $(shell $(PKG_CONFIG) --cflags openssl) $(CPPFLAGS) |
| 564 | LDFLAGS_OPENSSL_PKG_CONFIG = $(shell $(PKG_CONFIG) --libs-only-L openssl) |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 565 | ifeq ($(SYSTEM),Linux) |
| 566 | ifneq ($(LDFLAGS_OPENSSL_PKG_CONFIG),) |
murgatroid99 | 66d6edb | 2015-07-06 11:37:51 -0700 | [diff] [blame] | 567 | 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] | 568 | endif |
| 569 | endif |
| 570 | LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS) |
| 571 | else |
| 572 | LIBS_SECURE = $(OPENSSL_LIBS) |
| 573 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
| 574 | LIBS_SECURE += dl |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 575 | PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 576 | endif |
| 577 | endif |
| 578 | else |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 579 | ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true) |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 580 | USE_SYSTEM_OPENSSL = false |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 581 | OPENSSL_DEP = $(LIBDIR)/$(CONFIG)/openssl/libssl.a |
| 582 | 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] | 583 | # need to prefix these to ensure overriding system libraries |
| 584 | CPPFLAGS := -Ithird_party/openssl/include $(CPPFLAGS) |
| 585 | LDFLAGS := -L$(LIBDIR)/$(CONFIG)/openssl $(LDFLAGS) |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 586 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 587 | LIBS_SECURE = dl |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 588 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 589 | else |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 590 | ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) |
| 591 | USE_SYSTEM_OPENSSL = true |
| 592 | CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 |
| 593 | LIBS_SECURE = $(OPENSSL_LIBS) |
| 594 | ifeq ($(OPENSSL_REQUIRES_DL),true) |
| 595 | LIBS_SECURE += dl |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 596 | endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 597 | else |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 598 | NO_SECURE = true |
| 599 | endif |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 600 | endif |
Nicolas "Pixel" Noble | be2d3a3 | 2015-06-30 19:48:47 +0200 | [diff] [blame] | 601 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 602 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 603 | ifeq ($(OPENSSL_PKG_CONFIG),true) |
murgatroid99 | 66d6edb | 2015-07-06 11:37:51 -0700 | [diff] [blame] | 604 | LDLIBS_SECURE += $(shell $(PKG_CONFIG) --libs-only-l openssl) |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 605 | else |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 606 | LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 607 | endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 608 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 609 | # grpc .pc file |
| 610 | PC_NAME = gRPC |
| 611 | PC_DESCRIPTION = high performance general RPC framework |
| 612 | PC_CFLAGS = |
| 613 | PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) $(PC_REQUIRES_SECURE) |
| 614 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) $(PC_LIBS_SECURE) |
murgatroid99 | 4fed212 | 2015-07-06 11:26:30 -0700 | [diff] [blame] | 615 | PC_LIB = -lgrpc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 616 | GRPC_PC_FILE := $(PC_TEMPLATE) |
| 617 | |
| 618 | # gprc_unsecure .pc file |
| 619 | PC_NAME = gRPC unsecure |
| 620 | PC_DESCRIPTION = high performance general RPC framework without SSL |
| 621 | PC_CFLAGS = |
| 622 | PC_REQUIRES_PRIVATE = $(PC_REQUIRES_GRPC) |
| 623 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPC) |
murgatroid99 | 4fed212 | 2015-07-06 11:26:30 -0700 | [diff] [blame] | 624 | PC_LIB = -lgrpc |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 625 | GRPC_UNSECURE_PC_FILE := $(PC_TEMPLATE) |
| 626 | |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 627 | # gprc_zookeeper .pc file |
| 628 | PC_NAME = gRPC zookeeper |
| 629 | PC_DESCRIPTION = gRPC's zookeeper plugin |
| 630 | PC_CFLAGS = |
| 631 | PC_REQUIRES_PRIVATE = |
| 632 | PC_LIBS_PRIVATE = -lzookeeper_mt |
| 633 | GRPC_ZOOKEEPER_PC_FILE := $(PC_TEMPLATE) |
| 634 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 635 | PROTOBUF_PKG_CONFIG = false |
| 636 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 637 | PC_REQUIRES_GRPCXX = |
| 638 | PC_LIBS_GRPCXX = |
| 639 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 640 | ifeq ($(HAS_SYSTEM_PROTOBUF),true) |
| 641 | ifeq ($(HAS_PKG_CONFIG),true) |
| 642 | PROTOBUF_PKG_CONFIG = true |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 643 | PC_REQUIRES_GRPCXX = protobuf |
murgatroid99 | 66d6edb | 2015-07-06 11:37:51 -0700 | [diff] [blame] | 644 | CPPFLAGS := $(shell $(PKG_CONFIG) --cflags protobuf) $(CPPFLAGS) |
| 645 | LDFLAGS_PROTOBUF_PKG_CONFIG = $(shell $(PKG_CONFIG) --libs-only-L protobuf) |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 646 | ifeq ($(SYSTEM),Linux) |
| 647 | ifneq ($(LDFLAGS_PROTOBUF_PKG_CONFIG),) |
murgatroid99 | 66d6edb | 2015-07-06 11:37:51 -0700 | [diff] [blame] | 648 | 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] | 649 | endif |
| 650 | endif |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 651 | else |
| 652 | PC_LIBS_GRPCXX = -lprotobuf |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 653 | endif |
| 654 | else |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 655 | ifeq ($(HAS_EMBEDDED_PROTOBUF),true) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 656 | PROTOBUF_DEP = $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a |
Craig Tiller | 9ec95fa | 2015-02-20 20:36:21 -0800 | [diff] [blame] | 657 | CPPFLAGS := -Ithird_party/protobuf/src $(CPPFLAGS) |
| 658 | LDFLAGS := -L$(LIBDIR)/$(CONFIG)/protobuf $(LDFLAGS) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 659 | PROTOC = $(BINDIR)/$(CONFIG)/protobuf/protoc |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 660 | else |
| 661 | NO_PROTOBUF = true |
| 662 | endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 663 | endif |
| 664 | |
| 665 | LIBS_PROTOBUF = protobuf |
| 666 | LIBS_PROTOC = protoc protobuf |
| 667 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 668 | HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) |
| 669 | |
murgatroid99 | da7a994 | 2015-06-29 14:57:37 -0700 | [diff] [blame] | 670 | ifeq ($(PROTOBUF_PKG_CONFIG),true) |
murgatroid99 | 66d6edb | 2015-07-06 11:37:51 -0700 | [diff] [blame] | 671 | LDLIBS_PROTOBUF += $(shell $(PKG_CONFIG) --libs-only-l protobuf) |
murgatroid99 | 24e2f4a | 2015-06-29 11:12:01 -0700 | [diff] [blame] | 672 | else |
| 673 | LDLIBS_PROTOBUF += $(addprefix -l, $(LIBS_PROTOBUF)) |
| 674 | endif |
| 675 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 676 | # grpc++ .pc file |
| 677 | PC_NAME = gRPC++ |
| 678 | PC_DESCRIPTION = C++ wrapper for gRPC |
| 679 | PC_CFLAGS = |
| 680 | PC_REQUIRES_PRIVATE = grpc $(PC_REQUIRES_GRPCXX) |
| 681 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPCXX) |
murgatroid99 | 4fed212 | 2015-07-06 11:26:30 -0700 | [diff] [blame] | 682 | PC_LIB = -lgrpc++ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 683 | GRPCXX_PC_FILE := $(PC_TEMPLATE) |
| 684 | |
| 685 | # grpc++_unsecure .pc file |
| 686 | PC_NAME = gRPC++ unsecure |
| 687 | PC_DESCRIPTION = C++ wrapper for gRPC without SSL |
| 688 | PC_CFLAGS = |
| 689 | PC_REQUIRES_PRIVATE = grpc_unsecure $(PC_REQUIRES_GRPCXX) |
| 690 | PC_LIBS_PRIVATE = $(PC_LIBS_GRPCXX) |
murgatroid99 | 4fed212 | 2015-07-06 11:26:30 -0700 | [diff] [blame] | 691 | PC_LIB = -lgrpc++ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 692 | GRPCXX_UNSECURE_PC_FILE := $(PC_TEMPLATE) |
| 693 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 694 | ifeq ($(MAKECMDGOALS),clean) |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 695 | NO_DEPS = true |
| 696 | endif |
| 697 | |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 698 | INSTALL_OK = false |
| 699 | ifeq ($(HAS_VALID_PROTOC),true) |
| 700 | ifeq ($(HAS_SYSTEM_PROTOBUF_VERIFY),true) |
| 701 | INSTALL_OK = true |
| 702 | endif |
| 703 | endif |
| 704 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 705 | .SECONDARY = %.pb.h %.pb.cc |
| 706 | |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 707 | PROTOC_PLUGINS =\ |
Craig Tiller | f58b9ef | 2015-01-15 09:09:12 -0800 | [diff] [blame] | 708 | % for tgt in targets: |
| 709 | % if tgt.build == 'protoc': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 710 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Craig Tiller | f58b9ef | 2015-01-15 09:09:12 -0800 | [diff] [blame] | 711 | % endif |
| 712 | % endfor |
| 713 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 714 | ifeq ($(DEP_MISSING),) |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 715 | all: static shared plugins\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 716 | % for tgt in targets: |
| 717 | % if tgt.build == 'all': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 718 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 719 | % endif |
| 720 | % endfor |
| 721 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 722 | dep_error: |
| 723 | @echo "You shouldn't see this message - all of your dependencies are correct." |
| 724 | else |
| 725 | all: dep_error git_update stop |
| 726 | |
| 727 | dep_error: |
| 728 | @echo |
| 729 | @echo "DEPENDENCY ERROR" |
| 730 | @echo |
| 731 | @echo "You are missing system dependencies that are essential to build grpc," |
| 732 | @echo "and the third_party directory doesn't have them:" |
| 733 | @echo |
| 734 | @echo " $(DEP_MISSING)" |
| 735 | @echo |
| 736 | @echo "Installing the development packages for your system will solve" |
| 737 | @echo "this issue. Please consult INSTALL to get more information." |
| 738 | @echo |
| 739 | @echo "If you need information about why these tests failed, run:" |
| 740 | @echo |
| 741 | @echo " make run_dep_checks" |
| 742 | @echo |
| 743 | endif |
| 744 | |
| 745 | git_update: |
| 746 | ifeq ($(IS_GIT_FOLDER),true) |
| 747 | @echo "Additionally, since you are in a git clone, you can download the" |
| 748 | @echo "missing dependencies in third_party by running the following command:" |
| 749 | @echo |
ctiller | 64f2910 | 2014-12-15 10:40:59 -0800 | [diff] [blame] | 750 | @echo " git submodule update --init" |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 751 | @echo |
| 752 | endif |
| 753 | |
| 754 | openssl_dep_error: openssl_dep_message git_update stop |
| 755 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 756 | protobuf_dep_error: protobuf_dep_message git_update stop |
| 757 | |
| 758 | protoc_dep_error: protoc_dep_message git_update stop |
| 759 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 760 | openssl_dep_message: |
| 761 | @echo |
| 762 | @echo "DEPENDENCY ERROR" |
| 763 | @echo |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 764 | @echo "The target you are trying to run requires OpenSSL." |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 765 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 766 | @echo |
| 767 | @echo "Please consult INSTALL to get more information." |
| 768 | @echo |
| 769 | @echo "If you need information about why these tests failed, run:" |
| 770 | @echo |
| 771 | @echo " make run_dep_checks" |
| 772 | @echo |
| 773 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 774 | protobuf_dep_message: |
| 775 | @echo |
| 776 | @echo "DEPENDENCY ERROR" |
| 777 | @echo |
| 778 | @echo "The target you are trying to run requires protobuf 3.0.0+" |
| 779 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 780 | @echo |
| 781 | @echo "Please consult INSTALL to get more information." |
| 782 | @echo |
| 783 | @echo "If you need information about why these tests failed, run:" |
| 784 | @echo |
| 785 | @echo " make run_dep_checks" |
| 786 | @echo |
| 787 | |
| 788 | protoc_dep_message: |
| 789 | @echo |
| 790 | @echo "DEPENDENCY ERROR" |
| 791 | @echo |
| 792 | @echo "The target you are trying to run requires protobuf-compiler 3.0.0+" |
| 793 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 794 | @echo |
| 795 | @echo "Please consult INSTALL to get more information." |
| 796 | @echo |
| 797 | @echo "If you need information about why these tests failed, run:" |
| 798 | @echo |
| 799 | @echo " make run_dep_checks" |
| 800 | @echo |
| 801 | |
David Garcia Quintas | 8954e90 | 2015-04-29 09:46:33 -0700 | [diff] [blame] | 802 | systemtap_dep_error: |
| 803 | @echo |
| 804 | @echo "DEPENDENCY ERROR" |
| 805 | @echo |
| 806 | @echo "Under the '$(CONFIG)' configutation, the target you are trying " |
| 807 | @echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other " |
| 808 | @echo "platforms such as Solaris and *BSD). " |
| 809 | @echo |
| 810 | @echo "Please consult INSTALL to get more information." |
| 811 | @echo |
| 812 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 813 | stop: |
| 814 | @false |
| 815 | |
ctiller | 09cb6d5 | 2014-12-19 17:38:22 -0800 | [diff] [blame] | 816 | % for tgt in targets: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 817 | ${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name} |
ctiller | 09cb6d5 | 2014-12-19 17:38:22 -0800 | [diff] [blame] | 818 | % endfor |
| 819 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 820 | run_dep_checks: |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 821 | $(OPENSSL_ALPN_CHECK_CMD) || true |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 822 | $(OPENSSL_NPN_CHECK_CMD) || true |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 823 | $(ZLIB_CHECK_CMD) || true |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 824 | $(PERFTOOLS_CHECK_CMD) || true |
| 825 | $(PROTOBUF_CHECK_CMD) || true |
David Garcia Quintas | f5fcafd | 2015-04-24 16:12:54 -0700 | [diff] [blame] | 826 | $(PROTOC_CHECK_VERSION_CMD) || true |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 827 | $(ZOOKEEPER_CHECK_CMD) || true |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 828 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 829 | $(LIBDIR)/$(CONFIG)/zlib/libz.a: |
Nicolas "Pixel" Noble | 17f2b59 | 2015-01-16 07:09:10 +0100 | [diff] [blame] | 830 | $(E) "[MAKE] Building zlib" |
Nicolas "Pixel" Noble | 482d761 | 2015-07-16 23:43:30 +0200 | [diff] [blame] | 831 | $(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] | 832 | $(Q)$(MAKE) -C third_party/zlib clean |
| 833 | $(Q)$(MAKE) -C third_party/zlib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 834 | $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/zlib |
| 835 | $(Q)cp third_party/zlib/libz.a $(LIBDIR)/$(CONFIG)/zlib |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 836 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 837 | $(LIBDIR)/$(CONFIG)/openssl/libssl.a: |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 838 | $(E) "[MAKE] Building openssl for $(SYSTEM)" |
| 839 | ifeq ($(SYSTEM),Darwin) |
Nicolas "Pixel" Noble | 482d761 | 2015-07-16 23:43:30 +0200 | [diff] [blame] | 840 | $(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] | 841 | else |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 842 | ifeq ($(SYSTEM),MINGW32) |
| 843 | @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] | 844 | @echo "Please provide a OpenSSL in your mingw32 system." |
Nicolas Noble | f868118 | 2015-03-18 14:25:44 -0700 | [diff] [blame] | 845 | @echo |
| 846 | @echo "Note that you can find a compatible version of the libraries here:" |
| 847 | @echo |
| 848 | @echo "http://slproweb.com/products/Win32OpenSSL.html" |
| 849 | @echo |
| 850 | @echo "If you decide to install that one, take the full version. The light" |
| 851 | @echo "version only contains compiled DLLs, without the development files." |
| 852 | @echo |
| 853 | @echo "When installing, chose to copy the OpenSSL dlls to the OpenSSL binaries" |
| 854 | @echo "directory. This way we'll link to them directly." |
| 855 | @echo |
| 856 | @echo "You can then re-start the build the following way:" |
| 857 | @echo |
| 858 | @echo " CPPFLAGS=-I/c/OpenSSL-Win64/include LDFLAGS=-L/c/OpenSSL-Win64 make" |
| 859 | @false |
| 860 | else |
Nicolas "Pixel" Noble | 482d761 | 2015-07-16 23:43:30 +0200 | [diff] [blame] | 861 | $(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] | 862 | endif |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 863 | endif |
Nicolas "Pixel" Noble | 17f2b59 | 2015-01-16 07:09:10 +0100 | [diff] [blame] | 864 | $(Q)$(MAKE) -C third_party/openssl clean |
Jan Tattermusch | c9c83cf | 2015-06-17 13:42:34 -0700 | [diff] [blame] | 865 | $(Q)(unset CPPFLAGS; $(MAKE) -C third_party/openssl build_crypto build_ssl) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 866 | $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/openssl |
| 867 | $(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] | 868 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 869 | third_party/protobuf/configure: |
| 870 | $(E) "[AUTOGEN] Preparing protobuf" |
| 871 | $(Q)(cd third_party/protobuf ; autoreconf -f -i -Wall,no-obsolete) |
| 872 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 873 | $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 874 | $(E) "[MAKE] Building protobuf" |
Nicolas "Pixel" Noble | 482d761 | 2015-07-16 23:43:30 +0200 | [diff] [blame] | 875 | $(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] | 876 | $(Q)$(MAKE) -C third_party/protobuf clean |
| 877 | $(Q)$(MAKE) -C third_party/protobuf |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 878 | $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/protobuf |
| 879 | $(Q)mkdir -p $(BINDIR)/$(CONFIG)/protobuf |
| 880 | $(Q)cp third_party/protobuf/src/.libs/libprotoc.a $(LIBDIR)/$(CONFIG)/protobuf |
| 881 | $(Q)cp third_party/protobuf/src/.libs/libprotobuf.a $(LIBDIR)/$(CONFIG)/protobuf |
| 882 | $(Q)cp third_party/protobuf/src/protoc $(BINDIR)/$(CONFIG)/protobuf |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 883 | |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 884 | static: static_c static_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 885 | |
Hongwei Wang | b307ae2 | 2015-07-17 17:38:34 -0700 | [diff] [blame] | 886 | static_c: pc_c pc_c_unsecure cache.mk pc_gpr pc_c_zookeeper\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 887 | % for lib in libs: |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 888 | % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None): |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 889 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 890 | % endif |
| 891 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 892 | static_zookeeper_libs |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 893 | |
| 894 | |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 895 | static_cxx: pc_cxx pc_cxx_unsecure pc_gpr cache.mk \ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 896 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 897 | % if lib.build == 'all' and lib.language == 'c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 898 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 899 | % endif |
| 900 | % endfor |
| 901 | |
| 902 | |
| 903 | shared: shared_c shared_cxx |
| 904 | |
Hongwei Wang | b307ae2 | 2015-07-17 17:38:34 -0700 | [diff] [blame] | 905 | shared_c: pc_c pc_c_unsecure pc_gpr cache.mk pc_c_zookeeper\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 906 | % for lib in libs: |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 907 | % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None): |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 908 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 909 | % endif |
| 910 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 911 | shared_zookeeper_libs |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 912 | |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 913 | shared_cxx: pc_cxx pc_cxx_unsecure cache.mk\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 914 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 915 | % if lib.build == 'all' and lib.language == 'c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 916 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 917 | % endif |
| 918 | % endfor |
| 919 | |
| 920 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 921 | shared_csharp: shared_c \ |
| 922 | % for lib in libs: |
| 923 | % if lib.build == 'all' and lib.language == 'csharp': |
| 924 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
| 925 | % endif |
| 926 | % endfor |
| 927 | |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 928 | ifeq ($(HAS_ZOOKEEPER),true) |
| 929 | static_zookeeper_libs:\ |
| 930 | % for lib in libs: |
| 931 | % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []): |
| 932 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 933 | % endif |
| 934 | % endfor |
| 935 | |
| 936 | shared_zookeeper_libs:\ |
| 937 | % for lib in libs: |
| 938 | % if lib.build == 'all' and lib.language == 'c' and 'zookeeper' in lib.get('external_deps', []): |
| 939 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ |
| 940 | % endif |
| 941 | % endfor |
| 942 | |
| 943 | else |
| 944 | |
| 945 | static_zookeeper_libs: |
| 946 | |
| 947 | shared_zookeeper_libs: |
| 948 | |
| 949 | endif |
| 950 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 951 | grpc_csharp_ext: shared_csharp |
| 952 | |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 953 | plugins: $(PROTOC_PLUGINS) |
| 954 | |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 955 | privatelibs: privatelibs_c privatelibs_cxx |
| 956 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 957 | privatelibs_c: \ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 958 | % for lib in libs: |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 959 | % if lib.build == 'private' and lib.language == 'c' and not lib.get('external_deps', None): |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 960 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 961 | % endif |
| 962 | % endfor |
| 963 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 964 | pc_gpr: $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc |
| 965 | |
| 966 | pc_c: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc |
| 967 | |
| 968 | pc_c_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc |
| 969 | |
Hongwei Wang | a3780a8 | 2015-07-17 15:27:18 -0700 | [diff] [blame] | 970 | ifeq ($(HAS_ZOOKEEPER),true) |
| 971 | pc_c_zookeeper: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc |
| 972 | else |
| 973 | pc_c_zookeeper: |
| 974 | endif |
| 975 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 976 | pc_cxx: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc |
| 977 | |
| 978 | pc_cxx_unsecure: $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 979 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 980 | privatelibs_cxx: \ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 981 | % for lib in libs: |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 982 | % if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None): |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 983 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 984 | % endif |
| 985 | % endfor |
| 986 | |
| 987 | |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 988 | ifeq ($(HAS_ZOOKEEPER),true) |
| 989 | privatelibs_zookeeper: \ |
| 990 | % for lib in libs: |
| 991 | % if lib.build == 'private' and lib.language == 'c++' and zookeeper in lib.get('external_deps', []): |
| 992 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\ |
| 993 | % endif |
| 994 | % endfor |
| 995 | |
| 996 | else |
| 997 | privatelibs_zookeeper: |
| 998 | endif |
| 999 | |
| 1000 | |
| 1001 | buildtests: buildtests_c buildtests_cxx buildtests_zookeeper |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 1002 | |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1003 | buildtests_c: privatelibs_c\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1004 | % for tgt in targets: |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1005 | % if tgt.build == 'test' and not tgt.language == 'c++' and not tgt.get('external_deps', None): |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1006 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1007 | % endif |
| 1008 | % endfor |
| 1009 | |
| 1010 | |
Hongwei Wang | 5c9bbfb | 2015-08-04 14:11:42 -0700 | [diff] [blame] | 1011 | buildtests_cxx: buildtests_zookeeper privatelibs_cxx\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1012 | % for tgt in targets: |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1013 | % if tgt.build == 'test' and tgt.language == 'c++' and not tgt.get('external_deps', None): |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1014 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 1015 | % endif |
| 1016 | % endfor |
| 1017 | |
| 1018 | |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1019 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1020 | buildtests_zookeeper: privatelibs_zookeeper\ |
| 1021 | % for tgt in targets: |
| 1022 | % if tgt.build == 'test' and tgt.language == 'c++' and 'zookeeper' in tgt.get('external_deps', []): |
| 1023 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 1024 | % endif |
| 1025 | % endfor |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 1026 | |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1027 | else |
| 1028 | buildtests_zookeeper: |
| 1029 | endif |
| 1030 | |
| 1031 | |
| 1032 | test: test_c test_cxx test_zookeeper |
| 1033 | |
| 1034 | flaky_test: flaky_test_c flaky_test_cxx flaky_test_zookeeper |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 1035 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1036 | test_c: buildtests_c |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 1037 | % for tgt in targets: |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1038 | % if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None): |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 1039 | $(E) "[RUN] Testing ${tgt.name}" |
| 1040 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 1041 | % endif |
| 1042 | % endfor |
| 1043 | |
| 1044 | |
| 1045 | flaky_test_c: buildtests_c |
| 1046 | % for tgt in targets: |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1047 | % if tgt.build == 'test' and tgt.get('run', True) and not tgt.language == 'c++' and tgt.get('flaky', False) and not tgt.get('external_deps', None): |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 1048 | $(E) "[RUN] Testing ${tgt.name}" |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1049 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 1050 | % endif |
| 1051 | % endfor |
| 1052 | |
| 1053 | |
Hongwei Wang | 5c9bbfb | 2015-08-04 14:11:42 -0700 | [diff] [blame] | 1054 | test_cxx: test_zookeeper buildtests_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 1055 | % for tgt in targets: |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1056 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and not tgt.get('external_deps', None): |
Nicolas "Pixel" Noble | 4251d56 | 2015-05-22 19:43:39 +0200 | [diff] [blame] | 1057 | $(E) "[RUN] Testing ${tgt.name}" |
| 1058 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 1059 | % endif |
| 1060 | % endfor |
| 1061 | |
| 1062 | |
| 1063 | flaky_test_cxx: buildtests_cxx |
| 1064 | % for tgt in targets: |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1065 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and not tgt.get('external_deps', None): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1066 | $(E) "[RUN] Testing ${tgt.name}" |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1067 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1068 | % endif |
| 1069 | % endfor |
| 1070 | |
| 1071 | |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1072 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1073 | test_zookeeper: buildtests_zookeeper |
| 1074 | % for tgt in targets: |
| 1075 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and not tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []): |
| 1076 | $(E) "[RUN] Testing ${tgt.name}" |
| 1077 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 1078 | % endif |
| 1079 | % endfor |
| 1080 | |
| 1081 | |
| 1082 | flaky_test_zookeeper: buildtests_zookeeper |
| 1083 | % for tgt in targets: |
| 1084 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.language == 'c++' and tgt.get('flaky', False) and 'zookeeper' in tgt.get('external_deps', []): |
| 1085 | $(E) "[RUN] Testing ${tgt.name}" |
| 1086 | $(Q) $(BINDIR)/$(CONFIG)/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 1087 | % endif |
| 1088 | % endfor |
| 1089 | |
| 1090 | else |
| 1091 | test_zookeeper: |
| 1092 | flaky_test_zookeeper: |
| 1093 | endif |
| 1094 | |
| 1095 | |
Nicolas "Pixel" Noble | 051a28f | 2015-03-17 22:54:54 +0100 | [diff] [blame] | 1096 | test_python: static_c |
| 1097 | $(E) "[RUN] Testing python code" |
| 1098 | $(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG) |
| 1099 | |
| 1100 | |
Craig Tiller | 7552f0f | 2015-06-19 17:46:20 -0700 | [diff] [blame] | 1101 | tools: tools_c tools_cxx |
| 1102 | |
| 1103 | |
| 1104 | tools_c: privatelibs_c\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1105 | % for tgt in targets: |
Craig Tiller | 7552f0f | 2015-06-19 17:46:20 -0700 | [diff] [blame] | 1106 | % if tgt.build == 'tool' and not tgt.language=='c++': |
| 1107 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
| 1108 | % endif |
| 1109 | % endfor |
| 1110 | |
| 1111 | |
| 1112 | tools_cxx: privatelibs_cxx\ |
| 1113 | % for tgt in targets: |
| 1114 | % if tgt.build == 'tool' and tgt.language=='c++': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1115 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1116 | % endif |
| 1117 | % endfor |
| 1118 | |
| 1119 | |
| 1120 | buildbenchmarks: privatelibs\ |
| 1121 | % for tgt in targets: |
| 1122 | % if tgt.build == 'benchmark': |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1123 | $(BINDIR)/$(CONFIG)/${tgt.name}\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1124 | % endif |
| 1125 | % endfor |
| 1126 | |
| 1127 | |
| 1128 | benchmarks: buildbenchmarks |
| 1129 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1130 | strip: strip-static strip-shared |
| 1131 | |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1132 | strip-static: strip-static_c strip-static_cxx |
| 1133 | |
| 1134 | strip-shared: strip-shared_c strip-shared_cxx |
| 1135 | |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1136 | |
| 1137 | # TODO(nnoble): the strip target is stripping in-place, instead |
| 1138 | # of copying files in a temporary folder. |
| 1139 | # This prevents proper debugging after running make install. |
| 1140 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1141 | strip-static_c: static_c |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1142 | ifeq ($(CONFIG),opt) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1143 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1144 | % if lib.language == "c": |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1145 | % if lib.build == "all": |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1146 | % if not lib.get('external_deps', None): |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1147 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1148 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1149 | % endif |
| 1150 | % endif |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1151 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1152 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1153 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1154 | % for lib in libs: |
Nicolas "Pixel" Noble | 4ef9b86 | 2015-08-14 19:35:24 +0200 | [diff] [blame] | 1155 | % if lib.language == "c": |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1156 | % if lib.build == "all": |
| 1157 | % if 'zookeeper' in lib.get('external_deps', []): |
Nicolas "Pixel" Noble | 4ef9b86 | 2015-08-14 19:35:24 +0200 | [diff] [blame] | 1158 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
| 1159 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1160 | % endif |
| 1161 | % endif |
| 1162 | % endif |
| 1163 | % endfor |
| 1164 | endif |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1165 | endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1166 | |
Nicolas "Pixel" Noble | 4ef9b86 | 2015-08-14 19:35:24 +0200 | [diff] [blame] | 1167 | strip-static_cxx: static_cxx |
| 1168 | ifeq ($(CONFIG),opt) |
| 1169 | % for lib in libs: |
| 1170 | % if lib.language == "c++": |
| 1171 | % if lib.build == "all": |
| 1172 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
| 1173 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
| 1174 | % endif |
| 1175 | % endif |
| 1176 | % endfor |
| 1177 | endif |
| 1178 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1179 | strip-shared_c: shared_c |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1180 | ifeq ($(CONFIG),opt) |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1181 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1182 | % if lib.language == "c": |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1183 | % if lib.build == "all": |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1184 | % if not lib.get('external_deps', None): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1185 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1186 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1187 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1188 | % endif |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1189 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1190 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1191 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1192 | % for lib in libs: |
| 1193 | % if lib.language == "c": |
| 1194 | % if lib.build == "all": |
| 1195 | % if 'zookeeper' in lib.get('external_deps', []): |
| 1196 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 1197 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
| 1198 | % endif |
| 1199 | % endif |
| 1200 | % endif |
| 1201 | % endfor |
| 1202 | endif |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1203 | endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1204 | |
| 1205 | strip-shared_cxx: shared_cxx |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1206 | ifeq ($(CONFIG),opt) |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1207 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1208 | % if lib.language == "c++": |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1209 | % if lib.build == "all": |
| 1210 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1211 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1212 | % endif |
| 1213 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1214 | % endfor |
Nicolas "Pixel" Noble | 3a2551c | 2015-01-29 21:33:32 +0100 | [diff] [blame] | 1215 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1216 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1217 | strip-shared_csharp: shared_csharp |
| 1218 | ifeq ($(CONFIG),opt) |
| 1219 | % for lib in libs: |
| 1220 | % if lib.language == "csharp": |
| 1221 | % if lib.build == "all": |
| 1222 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 1223 | $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) |
| 1224 | % endif |
| 1225 | % endif |
| 1226 | % endfor |
| 1227 | endif |
| 1228 | |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 1229 | cache.mk:: |
| 1230 | $(E) "[MAKE] Generating $@" |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 1231 | $(Q) echo "$(CACHE_MK)" | tr , '\n' >$@ |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 1232 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1233 | $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc: |
| 1234 | $(E) "[MAKE] Generating $@" |
| 1235 | $(Q) mkdir -p $(@D) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 1236 | $(Q) echo "$(GPR_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1237 | |
| 1238 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc: |
| 1239 | $(E) "[MAKE] Generating $@" |
| 1240 | $(Q) mkdir -p $(@D) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 1241 | $(Q) echo "$(GRPC_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1242 | |
| 1243 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc: |
| 1244 | $(E) "[MAKE] Generating $@" |
| 1245 | $(Q) mkdir -p $(@D) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 1246 | $(Q) echo "$(GRPC_UNSECURE_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1247 | |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1248 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc: |
| 1249 | $(E) "[MAKE] Generating $@" |
| 1250 | $(Q) mkdir -p $(@D) |
| 1251 | $(Q) echo -e "$(GRPC_ZOOKEEPER_PC_FILE)" >$@ |
| 1252 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1253 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc: |
| 1254 | $(E) "[MAKE] Generating $@" |
| 1255 | $(Q) mkdir -p $(@D) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 1256 | $(Q) echo "$(GRPCXX_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1257 | |
| 1258 | $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc: |
| 1259 | $(E) "[MAKE] Generating $@" |
| 1260 | $(Q) mkdir -p $(@D) |
Nicolas "Pixel" Noble | 367e30f | 2015-07-15 22:36:31 +0200 | [diff] [blame] | 1261 | $(Q) echo "$(GRPCXX_UNSECURE_PC_FILE)" | tr , '\n' >$@ |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1262 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1263 | % for p in protos: |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1264 | ifeq ($(NO_PROTOC),true) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1265 | $(GENDIR)/${p}.pb.cc: protoc_dep_error |
Nicolas "Pixel" Noble | 0caebbf | 2015-04-09 23:08:51 +0200 | [diff] [blame] | 1266 | $(GENDIR)/${p}.grpc.pb.cc: protoc_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1267 | else |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1268 | $(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1269 | $(E) "[PROTOC] Generating protobuf CC file from $<" |
| 1270 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | 0caebbf | 2015-04-09 23:08:51 +0200 | [diff] [blame] | 1271 | $(Q) $(PROTOC) --cpp_out=$(GENDIR) $< |
| 1272 | |
| 1273 | $(GENDIR)/${p}.grpc.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) |
| 1274 | $(E) "[GRPC] Generating gRPC's protobuf service CC file from $<" |
| 1275 | $(Q) mkdir -p `dirname $@` |
| 1276 | $(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] | 1277 | endif |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1278 | |
| 1279 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1280 | |
David Garcia Quintas | bbc0b77 | 2015-04-29 14:10:05 -0700 | [diff] [blame] | 1281 | ifeq ($(CONFIG),stapprof) |
| 1282 | 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] | 1283 | ifeq ($(HAS_SYSTEMTAP),true) |
| 1284 | $(GENDIR)/src/core/profiling/stap_probes.h: src/core/profiling/stap_probes.d |
| 1285 | $(E) "[DTRACE] Compiling $<" |
| 1286 | $(Q) mkdir -p `dirname $@` |
| 1287 | $(Q) $(DTRACE) -C -h -s $< -o $@ |
David Garcia Quintas | 8954e90 | 2015-04-29 09:46:33 -0700 | [diff] [blame] | 1288 | else |
| 1289 | $(GENDIR)/src/core/profiling/stap_probes.h: systemtap_dep_error stop |
| 1290 | endif |
David Garcia Quintas | 611b736 | 2015-04-27 15:49:31 -0700 | [diff] [blame] | 1291 | endif |
| 1292 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1293 | $(OBJDIR)/$(CONFIG)/%.o : %.c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1294 | $(E) "[C] Compiling $<" |
| 1295 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1296 | $(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1297 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1298 | $(OBJDIR)/$(CONFIG)/%.o : $(GENDIR)/%.pb.cc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1299 | $(E) "[CXX] Compiling $<" |
| 1300 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1301 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1302 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1303 | $(OBJDIR)/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1304 | $(E) "[HOSTCXX] Compiling $<" |
| 1305 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1306 | $(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] | 1307 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1308 | $(OBJDIR)/$(CONFIG)/%.o : %.cc |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1309 | $(E) "[CXX] Compiling $<" |
| 1310 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1311 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1312 | |
Nicolas "Pixel" Noble | 161ea23 | 2015-02-22 05:48:53 +0100 | [diff] [blame] | 1313 | install: install_c install_cxx install-plugins install-certs verify-install |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1314 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1315 | install_c: install-headers_c install-static_c install-shared_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1316 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1317 | install_cxx: install-headers_cxx install-static_cxx install-shared_cxx |
| 1318 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1319 | install_csharp: install-shared_csharp install_c |
| 1320 | |
| 1321 | install_grpc_csharp_ext: install_csharp |
| 1322 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1323 | install-headers: install-headers_c install-headers_cxx |
| 1324 | |
| 1325 | install-headers_c: |
| 1326 | $(E) "[INSTALL] Installing public C headers" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1327 | $(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] | 1328 | $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 |
| 1329 | |
| 1330 | install-headers_cxx: |
| 1331 | $(E) "[INSTALL] Installing public C++ headers" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1332 | $(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] | 1333 | $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 |
| 1334 | |
| 1335 | install-static: install-static_c install-static_cxx |
| 1336 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1337 | install-static_c: static_c strip-static_c install-pkg-config_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1338 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1339 | % if lib.language == "c": |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1340 | % if lib.build == "all": |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1341 | % if not lib.get('external_deps', None): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1342 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1343 | $(Q) $(INSTALL) -d $(prefix)/lib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1344 | $(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] | 1345 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1346 | % endif |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1347 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1348 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1349 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1350 | % for lib in libs: |
| 1351 | % if lib.language == "c": |
| 1352 | % if lib.build == "all": |
| 1353 | % if 'zookeeper' in lib.get('external_deps', []): |
| 1354 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
| 1355 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1356 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a |
| 1357 | % endif |
| 1358 | % endif |
| 1359 | % endif |
| 1360 | % endfor |
| 1361 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1362 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1363 | install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1364 | % for lib in libs: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1365 | % if lib.language == "c++": |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1366 | % if lib.build == "all": |
| 1367 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1368 | $(Q) $(INSTALL) -d $(prefix)/lib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1369 | $(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] | 1370 | % endif |
| 1371 | % endif |
| 1372 | % endfor |
| 1373 | |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1374 | <%def name="install_shared(lang_filter)">\ |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1375 | % for lib in libs: |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1376 | % if lib.language == lang_filter: |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1377 | % if lib.build == "all": |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1378 | % if not lib.get('external_deps', None): |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1379 | ifeq ($(SYSTEM),MINGW32) |
| 1380 | $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1381 | $(Q) $(INSTALL) -d $(prefix)/lib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1382 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) |
| 1383 | $(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] | 1384 | else |
| 1385 | $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1386 | $(Q) $(INSTALL) -d $(prefix)/lib |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1387 | $(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] | 1388 | ifneq ($(SYSTEM),Darwin) |
Tim Emiola | 820e3d6 | 2015-04-10 09:11:50 -0700 | [diff] [blame] | 1389 | $(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] | 1390 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so |
| 1391 | endif |
| 1392 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1393 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1394 | % endif |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1395 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1396 | % endfor |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1397 | ifeq ($(HAS_ZOOKEEPER),true) |
| 1398 | % for lib in libs: |
| 1399 | % if lib.language == lang_filter: |
| 1400 | % if lib.build == "all": |
| 1401 | % if 'zookeeper' in lib.get('external_deps', []): |
| 1402 | ifeq ($(SYSTEM),MINGW32) |
| 1403 | $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" |
| 1404 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1405 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) |
| 1406 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a |
| 1407 | else |
| 1408 | $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" |
| 1409 | $(Q) $(INSTALL) -d $(prefix)/lib |
| 1410 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) |
| 1411 | ifneq ($(SYSTEM),Darwin) |
| 1412 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so.${settings.version.major} |
| 1413 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so |
| 1414 | endif |
| 1415 | endif |
| 1416 | % endif |
| 1417 | % endif |
| 1418 | % endif |
| 1419 | % endfor |
| 1420 | endif |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1421 | ifneq ($(SYSTEM),MINGW32) |
| 1422 | ifneq ($(SYSTEM),Darwin) |
Nicolas "Pixel" Noble | cc2b42a | 2015-02-20 00:42:21 +0100 | [diff] [blame] | 1423 | $(Q) ldconfig || true |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1424 | endif |
| 1425 | endif |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1426 | </%def> |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1427 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1428 | 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] | 1429 | ${install_shared("c")} |
| 1430 | |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1431 | 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] | 1432 | ${install_shared("c++")} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1433 | |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1434 | install-shared_csharp: shared_csharp strip-shared_csharp |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1435 | ${install_shared("csharp")} |
| 1436 | |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1437 | install-plugins: $(PROTOC_PLUGINS) |
| 1438 | ifeq ($(SYSTEM),MINGW32) |
| 1439 | $(Q) false |
| 1440 | else |
| 1441 | $(E) "[INSTALL] Installing grpc protoc plugins" |
| 1442 | % for tgt in targets: |
| 1443 | % if tgt.build == 'protoc': |
Nicolas "Pixel" Noble | 932d5d3 | 2015-02-21 02:15:34 +0100 | [diff] [blame] | 1444 | $(Q) $(INSTALL) -d $(prefix)/bin |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1445 | $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name} |
| 1446 | % endif |
| 1447 | % endfor |
| 1448 | endif |
Jan Tattermusch | 2ec0b3e | 2015-02-18 15:03:12 -0800 | [diff] [blame] | 1449 | |
Hongwei Wang | a3780a8 | 2015-07-17 15:27:18 -0700 | [diff] [blame] | 1450 | install-pkg-config_c: pc_gpr pc_c pc_c_unsecure pc_c_zookeeper |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1451 | $(E) "[INSTALL] Installing C pkg-config files" |
| 1452 | $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig |
| 1453 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/gpr.pc $(prefix)/lib/pkgconfig/gpr.pc |
| 1454 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc.pc $(prefix)/lib/pkgconfig/grpc.pc |
| 1455 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_unsecure.pc $(prefix)/lib/pkgconfig/grpc_unsecure.pc |
Hongwei Wang | a3780a8 | 2015-07-17 15:27:18 -0700 | [diff] [blame] | 1456 | ifeq ($(HAS_ZOOKEEPER),true) |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1457 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc_zookeeper.pc $(prefix)/lib/pkgconfig/grpc_zookeeper.pc |
Hongwei Wang | a3780a8 | 2015-07-17 15:27:18 -0700 | [diff] [blame] | 1458 | endif |
murgatroid99 | 8faab23 | 2015-06-30 17:24:21 -0700 | [diff] [blame] | 1459 | |
| 1460 | install-pkg-config_cxx: pc_cxx pc_cxx_unsecure |
| 1461 | $(E) "[INSTALL] Installing C++ pkg-config files" |
| 1462 | $(Q) $(INSTALL) -d $(prefix)/lib/pkgconfig |
| 1463 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++.pc $(prefix)/lib/pkgconfig/grpc++.pc |
| 1464 | $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc $(prefix)/lib/pkgconfig/grpc++_unsecure.pc |
| 1465 | |
Nicolas "Pixel" Noble | 161ea23 | 2015-02-22 05:48:53 +0100 | [diff] [blame] | 1466 | install-certs: etc/roots.pem |
| 1467 | $(E) "[INSTALL] Installing root certificates" |
| 1468 | $(Q) $(INSTALL) -d $(prefix)/share/grpc |
| 1469 | $(Q) $(INSTALL) etc/roots.pem $(prefix)/share/grpc/roots.pem |
| 1470 | |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1471 | verify-install: |
Nicolas "Pixel" Noble | 2c23a72 | 2015-02-24 20:17:45 +0100 | [diff] [blame] | 1472 | ifeq ($(INSTALL_OK),true) |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1473 | @echo "Your system looks ready to go." |
| 1474 | @echo |
| 1475 | else |
murgatroid99 | b618136 | 2015-03-02 14:32:25 -0800 | [diff] [blame] | 1476 | @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] | 1477 | @echo "won't prevent grpc from working, you won't be able to compile" |
| 1478 | @echo "and run any meaningful code with it." |
| 1479 | @echo |
| 1480 | @echo |
| 1481 | @echo "Please download and install protobuf 3.0.0+ from:" |
| 1482 | @echo |
| 1483 | @echo " https://github.com/google/protobuf/releases" |
| 1484 | @echo |
murgatroid99 | b618136 | 2015-03-02 14:32:25 -0800 | [diff] [blame] | 1485 | @echo "Once you've done so, or if you think this message is in error," |
| 1486 | @echo "you can re-run this check by doing:" |
Nicolas "Pixel" Noble | 98ab998 | 2015-02-21 04:22:16 +0100 | [diff] [blame] | 1487 | @echo |
| 1488 | @echo " make verify-install" |
| 1489 | endif |
| 1490 | |
Craig Tiller | 3759e6f | 2015-01-15 08:13:11 -0800 | [diff] [blame] | 1491 | clean: |
Nicolas "Pixel" Noble | 522d712 | 2015-02-19 01:28:02 +0100 | [diff] [blame] | 1492 | $(E) "[CLEAN] Cleaning build directories." |
murgatroid99 | aa52157 | 2015-07-10 14:49:12 -0700 | [diff] [blame] | 1493 | $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) cache.mk |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1494 | |
| 1495 | |
| 1496 | # The various libraries |
| 1497 | |
| 1498 | % for lib in libs: |
| 1499 | ${makelib(lib)} |
| 1500 | % endfor |
| 1501 | |
| 1502 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1503 | # All of the test targets, and protoc plugins |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1504 | |
| 1505 | % for tgt in targets: |
| 1506 | ${maketarget(tgt)} |
| 1507 | % endfor |
| 1508 | |
| 1509 | <%def name="makelib(lib)"> |
| 1510 | LIB${lib.name.upper()}_SRC = \\ |
| 1511 | |
| 1512 | % for src in lib.src: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1513 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1514 | |
| 1515 | % endfor |
| 1516 | |
| 1517 | % if "public_headers" in lib: |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1518 | % if lib.language == "c++": |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1519 | PUBLIC_HEADERS_CXX += \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1520 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1521 | % else: |
| 1522 | PUBLIC_HEADERS_C += \\ |
| 1523 | |
| 1524 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1525 | % for hdr in lib.public_headers: |
| 1526 | ${hdr} \\ |
| 1527 | |
| 1528 | % endfor |
| 1529 | % endif |
| 1530 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1531 | 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] | 1532 | |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 1533 | ## If the library requires OpenSSL, let's add some restrictions. |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1534 | % if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1535 | ifeq ($(NO_SECURE),true) |
| 1536 | |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 1537 | # You can't build secure libraries if you don't have OpenSSL. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1538 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1539 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1540 | |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1541 | % if lib.build == "all": |
| 1542 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1543 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): openssl_dep_error |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1544 | else |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1545 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): openssl_dep_error |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1546 | endif |
| 1547 | % endif |
| 1548 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1549 | else |
| 1550 | |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1551 | % if lib.language == 'c++': |
| 1552 | ifeq ($(NO_PROTOBUF),true) |
| 1553 | |
| 1554 | # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. |
| 1555 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1556 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1557 | |
| 1558 | % if lib.build == "all": |
| 1559 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1560 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1561 | else |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1562 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1563 | endif |
| 1564 | % endif |
| 1565 | |
| 1566 | else |
| 1567 | % endif |
| 1568 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1569 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP)\ |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1570 | ## The else here corresponds to the if secure earlier. |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1571 | % else: |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1572 | % if lib.language == 'c++': |
| 1573 | ifeq ($(NO_PROTOBUF),true) |
| 1574 | |
| 1575 | # You can't build a C++ library if you don't have protobuf - a bit overreached, but still okay. |
| 1576 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1577 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1578 | |
| 1579 | % if lib.build == "all": |
| 1580 | ifeq ($(SYSTEM),MINGW32) |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1581 | $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT): protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1582 | else |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1583 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT): protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1584 | endif |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1585 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1586 | |
| 1587 | else |
| 1588 | |
| 1589 | % endif |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1590 | $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP)\ |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1591 | % endif |
| 1592 | % if lib.language == 'c++': |
| 1593 | $(PROTOBUF_DEP)\ |
| 1594 | % endif |
| 1595 | $(LIB${lib.name.upper()}_OBJS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1596 | $(E) "[AR] Creating $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1597 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1598 | $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
| 1599 | $(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] | 1600 | % if lib.get('baselib', False): |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1601 | % if lib.get('secure', 'check') == 'yes': |
Craig Tiller | 7ab4fee | 2015-02-24 08:15:53 -0800 | [diff] [blame] | 1602 | $(Q) rm -rf tmp-merge-${lib.name} |
| 1603 | $(Q) mkdir tmp-merge-${lib.name} |
| 1604 | $(Q) ( cd tmp-merge-${lib.name} ; $(AR) x ../$(LIBDIR)/$(CONFIG)/lib${lib.name}.a ) |
| 1605 | $(Q) for l in $(OPENSSL_MERGE_LIBS) ; do ( cd tmp-merge-${lib.name} ; <%text>ar x ../$${l}</%text> ) ; done |
| 1606 | $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge-${lib.name}/__.SYMDEF* |
| 1607 | $(Q) ar rcs $(LIBDIR)/$(CONFIG)/lib${lib.name}.a tmp-merge-${lib.name}/* |
| 1608 | $(Q) rm -rf tmp-merge-${lib.name} |
nnoble | 20e2e3f | 2014-12-16 15:37:57 -0800 | [diff] [blame] | 1609 | % endif |
| 1610 | % endif |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 1611 | ifeq ($(SYSTEM),Darwin) |
murgatroid99 | b618136 | 2015-03-02 14:32:25 -0800 | [diff] [blame] | 1612 | $(Q) ranlib $(LIBDIR)/$(CONFIG)/lib${lib.name}.a |
Craig Tiller | b4ee3b5 | 2015-01-21 16:22:50 -0800 | [diff] [blame] | 1613 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1614 | |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1615 | <% |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1616 | |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1617 | if lib.language == 'c++': |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1618 | ld = '$(LDXX)' |
| 1619 | else: |
| 1620 | ld = '$(LD)' |
| 1621 | |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1622 | out_base = '$(LIBDIR)/$(CONFIG)/' + lib.name |
| 1623 | out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1624 | |
| 1625 | common = '$(LIB' + lib.name.upper() + '_OBJS) $(LDLIBS)' |
| 1626 | |
| 1627 | libs = '' |
Nicolas "Pixel" Noble | 85bf09b | 2015-01-15 18:22:40 +0100 | [diff] [blame] | 1628 | lib_deps = ' $(ZLIB_DEP)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1629 | mingw_libs = '' |
Nicolas "Pixel" Noble | 85bf09b | 2015-01-15 18:22:40 +0100 | [diff] [blame] | 1630 | mingw_lib_deps = ' $(ZLIB_DEP)' |
Michael Berlin | bf2e7f0 | 2015-05-01 16:17:01 -0700 | [diff] [blame] | 1631 | if lib.language == 'c++': |
| 1632 | lib_deps += ' $(PROTOBUF_DEP)' |
| 1633 | mingw_lib_deps += ' $(PROTOBUF_DEP)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1634 | for dep in lib.get('deps', []): |
| 1635 | libs = libs + ' -l' + dep |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1636 | lib_deps = lib_deps + ' $(LIBDIR)/$(CONFIG)/lib' + dep + '.$(SHARED_EXT)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1637 | mingw_libs = mingw_libs + ' -l' + dep + '-imp' |
Michael Berlin | 5351392 | 2015-05-01 16:14:15 -0700 | [diff] [blame] | 1638 | mingw_lib_deps = mingw_lib_deps + ' $(LIBDIR)/$(CONFIG)/' + dep + '.$(SHARED_EXT)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1639 | |
Nicolas "Pixel" Noble | a7c162c | 2015-07-24 20:21:51 +0200 | [diff] [blame] | 1640 | security = lib.get('secure', 'check') |
| 1641 | if security == 'yes': |
Nicolas "Pixel" Noble | 945b413 | 2015-06-02 20:13:40 +0200 | [diff] [blame] | 1642 | common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)' |
Nicolas "Pixel" Noble | a7c162c | 2015-07-24 20:21:51 +0200 | [diff] [blame] | 1643 | |
| 1644 | if security in ['yes', 'check']: |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1645 | for src in lib.src: |
Nicolas "Pixel" Noble | a7c162c | 2015-07-24 20:21:51 +0200 | [diff] [blame] | 1646 | if not proto_re.match(src): |
| 1647 | sources_that_need_openssl.add(src) |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1648 | else: |
| 1649 | for src in lib.src: |
| 1650 | sources_that_don_t_need_openssl.add(src) |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1651 | |
Hongwei Wang | a8cc439 | 2015-07-16 17:37:47 -0700 | [diff] [blame] | 1652 | if 'zookeeper' in lib.get('external_deps', []): |
| 1653 | libs = libs + ' -lzookeeper_mt' |
| 1654 | |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1655 | if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1656 | lib_deps = lib_deps + ' $(OPENSSL_DEP)' |
| 1657 | mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)' |
Nicolas "Pixel" Noble | dda049c | 2015-02-21 00:39:32 +0100 | [diff] [blame] | 1658 | |
| 1659 | if lib.language == 'c++': |
| 1660 | common = common + ' $(LDLIBSXX) $(LDLIBS_PROTOBUF)' |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1661 | %> |
| 1662 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1663 | % if lib.build == "all": |
nnoble | 5b7f32a | 2014-12-22 08:12:44 -0800 | [diff] [blame] | 1664 | ifeq ($(SYSTEM),MINGW32) |
| 1665 | ${out_base}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps} |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1666 | $(E) "[LD] Linking $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1667 | $(Q) mkdir -p `dirname $@` |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1668 | $(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] | 1669 | else |
| 1670 | ${out_libbase}.$(SHARED_EXT): $(LIB${lib.name.upper()}_OBJS) ${lib_deps} |
| 1671 | $(E) "[LD] Linking $@" |
| 1672 | $(Q) mkdir -p `dirname $@` |
| 1673 | ifeq ($(SYSTEM),Darwin) |
Masood Malekghassemi | d1be74f | 2015-04-07 16:23:09 -0700 | [diff] [blame] | 1674 | $(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] | 1675 | else |
Craig Tiller | da224d6 | 2015-02-15 11:01:58 -0800 | [diff] [blame] | 1676 | $(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] | 1677 | $(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] | 1678 | $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) ${out_libbase}.so |
| 1679 | endif |
| 1680 | endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1681 | % endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1682 | % if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1683 | ## 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] | 1684 | ## the presence of OpenSSL. |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1685 | |
| 1686 | endif |
| 1687 | % endif |
| 1688 | % if lib.language == 'c++': |
| 1689 | ## If the lib was C++, we have to close the Makefile's if that tested |
| 1690 | ## the presence of protobuf 3.0.0+ |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1691 | |
| 1692 | endif |
| 1693 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1694 | |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1695 | % if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1696 | ifneq ($(NO_SECURE),true) |
| 1697 | % endif |
| 1698 | ifneq ($(NO_DEPS),true) |
Craig Tiller | 8f126a6 | 2015-01-15 08:50:19 -0800 | [diff] [blame] | 1699 | -include $(LIB${lib.name.upper()}_OBJS:.o=.dep) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1700 | endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1701 | % if lib.get('secure', 'check') == 'yes' or lib.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1702 | endif |
| 1703 | % endif |
Craig Tiller | 27715ca | 2015-01-12 16:55:59 -0800 | [diff] [blame] | 1704 | % for src in lib.src: |
Craig Tiller | d896fa5 | 2015-04-24 14:30:09 -0700 | [diff] [blame] | 1705 | % 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] | 1706 | $(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] | 1707 | % endif |
Craig Tiller | 27715ca | 2015-01-12 16:55:59 -0800 | [diff] [blame] | 1708 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1709 | </%def> |
| 1710 | |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1711 | <%def name="maketarget(tgt)"><% has_no_sources = not tgt.src %> |
| 1712 | % if not has_no_sources: |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1713 | ${tgt.name.upper()}_SRC = \\ |
| 1714 | |
| 1715 | % for src in tgt.src: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1716 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1717 | |
| 1718 | % endfor |
| 1719 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1720 | ${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] | 1721 | % endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1722 | % if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1723 | ifeq ($(NO_SECURE),true) |
| 1724 | |
Nicolas "Pixel" Noble | 4cc8c8a | 2015-06-23 02:37:49 +0200 | [diff] [blame] | 1725 | # You can't build secure targets if you don't have OpenSSL. |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1726 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1727 | $(BINDIR)/$(CONFIG)/${tgt.name}: openssl_dep_error |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1728 | |
| 1729 | else |
| 1730 | |
| 1731 | % endif |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1732 | ## |
| 1733 | ## We're not trying to add a dependency on building zlib and openssl here, |
| 1734 | ## as it's already done in the libraries. We're assuming that the build |
| 1735 | ## trickles down, and that a secure target requires a secure version of |
| 1736 | ## a library. |
| 1737 | ## |
| 1738 | ## That simplifies the codegen a bit, but prevents a fully defined Makefile. |
| 1739 | ## I can live with that. |
| 1740 | ## |
Nicolas "Pixel" Noble | 18953e3 | 2015-02-27 02:41:11 +0100 | [diff] [blame] | 1741 | % if tgt.build == 'protoc' or tgt.language == 'c++': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1742 | |
| 1743 | ifeq ($(NO_PROTOBUF),true) |
| 1744 | |
Nicolas "Pixel" Noble | 18953e3 | 2015-02-27 02:41:11 +0100 | [diff] [blame] | 1745 | # 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] | 1746 | |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1747 | $(BINDIR)/$(CONFIG)/${tgt.name}: protobuf_dep_error |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1748 | |
| 1749 | else |
| 1750 | |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1751 | $(BINDIR)/$(CONFIG)/${tgt.name}: \ |
| 1752 | % if not has_no_sources: |
| 1753 | $(PROTOBUF_DEP) $(${tgt.name.upper()}_OBJS)\ |
| 1754 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1755 | % else: |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1756 | $(BINDIR)/$(CONFIG)/${tgt.name}: \ |
| 1757 | % if not has_no_sources: |
| 1758 | $(${tgt.name.upper()}_OBJS)\ |
| 1759 | % endif |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1760 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1761 | % for dep in tgt.deps: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1762 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1763 | % endfor |
| 1764 | |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1765 | % if tgt.language == "c++": |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1766 | ## C++ targets specificies. |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1767 | % if tgt.build == 'protoc': |
| 1768 | $(E) "[HOSTLD] Linking $@" |
| 1769 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1770 | $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) \ |
| 1771 | % if not has_no_sources: |
| 1772 | $(${tgt.name.upper()}_OBJS)\ |
| 1773 | % endif |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1774 | % else: |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1775 | $(E) "[LD] Linking $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1776 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1777 | $(Q) $(LDXX) $(LDFLAGS) \ |
| 1778 | % if not has_no_sources: |
| 1779 | $(${tgt.name.upper()}_OBJS)\ |
| 1780 | % endif |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1781 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1782 | % else: |
Nicolas Noble | 047b727 | 2015-01-16 13:55:05 -0800 | [diff] [blame] | 1783 | ## C-only targets specificities. |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1784 | $(E) "[LD] Linking $@" |
| 1785 | $(Q) mkdir -p `dirname $@` |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1786 | $(Q) $(LD) $(LDFLAGS) \ |
| 1787 | % if not has_no_sources: |
| 1788 | $(${tgt.name.upper()}_OBJS)\ |
| 1789 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1790 | % endif |
| 1791 | % for dep in tgt.deps: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1792 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1793 | % endfor |
Hongwei Wang | 8e04d41 | 2015-07-31 15:12:51 -0700 | [diff] [blame] | 1794 | % if 'zookeeper' in tgt.get('external_deps', []): |
| 1795 | -lzookeeper_mt\ |
| 1796 | % endif |
Craig Tiller | 59140fc | 2015-01-18 10:12:17 -0800 | [diff] [blame] | 1797 | % if tgt.language == "c++": |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1798 | % if tgt.build == 'protoc': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1799 | $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC)\ |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1800 | % else: |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1801 | $(LDLIBSXX) $(LDLIBS_PROTOBUF)\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1802 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1803 | % endif |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 1804 | % if tgt.build == 'protoc': |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1805 | $(HOST_LDLIBS)\ |
| 1806 | % else: |
| 1807 | $(LDLIBS)\ |
| 1808 | % endif |
| 1809 | % if tgt.build == 'protoc': |
| 1810 | $(HOST_LDLIBS_PROTOC)\ |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1811 | % elif tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 1812 | $(LDLIBS_SECURE)\ |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 1813 | % endif |
Yang Gao | b0b518e | 2015-04-13 14:53:25 -0700 | [diff] [blame] | 1814 | % if tgt.language == 'c++' and tgt.build == 'test': |
| 1815 | $(GTEST_LIB)\ |
David Garcia Quintas | aa52d0a | 2015-05-14 19:04:23 -0700 | [diff] [blame] | 1816 | % elif tgt.language == 'c++' and tgt.build == 'benchmark': |
| 1817 | $(GTEST_LIB)\ |
Yang Gao | b0b518e | 2015-04-13 14:53:25 -0700 | [diff] [blame] | 1818 | % endif |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1819 | -o $(BINDIR)/$(CONFIG)/${tgt.name} |
Nicolas "Pixel" Noble | 18953e3 | 2015-02-27 02:41:11 +0100 | [diff] [blame] | 1820 | % if tgt.build == 'protoc' or tgt.language == 'c++': |
Nicolas Noble | 5383062 | 2015-02-12 16:56:38 -0800 | [diff] [blame] | 1821 | |
| 1822 | endif |
| 1823 | % endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1824 | % if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1825 | |
| 1826 | endif |
| 1827 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1828 | |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 1829 | % for src in tgt.src: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1830 | $(OBJDIR)/$(CONFIG)/${os.path.splitext(src)[0]}.o: \ |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 1831 | % for dep in tgt.deps: |
Craig Tiller | 61b910f | 2015-02-15 10:54:07 -0800 | [diff] [blame] | 1832 | $(LIBDIR)/$(CONFIG)/lib${dep}.a\ |
Craig Tiller | f5371ef | 2015-01-12 16:40:18 -0800 | [diff] [blame] | 1833 | % endfor |
| 1834 | |
| 1835 | % endfor |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1836 | % if not has_no_sources: |
Craig Tiller | 8f126a6 | 2015-01-15 08:50:19 -0800 | [diff] [blame] | 1837 | deps_${tgt.name}: $(${tgt.name.upper()}_OBJS:.o=.dep) |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1838 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1839 | |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1840 | % if not has_no_sources: |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1841 | % if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1842 | ifneq ($(NO_SECURE),true) |
| 1843 | % endif |
| 1844 | ifneq ($(NO_DEPS),true) |
Craig Tiller | 8f126a6 | 2015-01-15 08:50:19 -0800 | [diff] [blame] | 1845 | -include $(${tgt.name.upper()}_OBJS:.o=.dep) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1846 | endif |
Nicolas "Pixel" Noble | 061690d | 2015-03-06 22:58:58 +0100 | [diff] [blame] | 1847 | % if tgt.get('secure', 'check') == 'yes' or tgt.get('secure', 'check') == 'check': |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1848 | endif |
| 1849 | % endif |
Nicolas "Pixel" Noble | adaa100 | 2015-04-29 08:56:01 +0200 | [diff] [blame] | 1850 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1851 | </%def> |
| 1852 | |
Nicolas "Pixel" Noble | 010f1e7 | 2015-04-23 02:23:49 +0200 | [diff] [blame] | 1853 | ifneq ($(OPENSSL_DEP),) |
| 1854 | # This is to ensure the embedded OpenSSL is built beforehand, properly |
| 1855 | # installing headers to their final destination on the drive. We need this |
| 1856 | # otherwise parallel compilation will fail if a source is compiled first. |
| 1857 | % for src in sorted(sources_that_need_openssl): |
| 1858 | % if src not in sources_that_don_t_need_openssl: |
| 1859 | ${src}: $(OPENSSL_DEP) |
| 1860 | % endif |
| 1861 | % endfor |
| 1862 | endif |
| 1863 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1864 | .PHONY: all strip tools \ |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 1865 | dep_error openssl_dep_error openssl_dep_message git_update stop \ |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 1866 | buildtests buildtests_c buildtests_cxx \ |
| 1867 | test test_c test_cxx \ |
| 1868 | install install_c install_cxx \ |
| 1869 | install-headers install-headers_c install-headers_cxx \ |
| 1870 | install-shared install-shared_c install-shared_cxx \ |
| 1871 | install-static install-static_c install-static_cxx \ |
| 1872 | strip strip-shared strip-static \ |
| 1873 | strip_c strip-shared_c strip-static_c \ |
| 1874 | strip_cxx strip-shared_cxx strip-static_cxx \ |
Craig Tiller | f0afe50 | 2015-01-15 09:04:49 -0800 | [diff] [blame] | 1875 | dep_c dep_cxx bins_dep_c bins_dep_cxx \ |
Craig Tiller | 12c8209 | 2015-01-15 08:45:56 -0800 | [diff] [blame] | 1876 | clean |