Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 1 | # GRPC global makefile |
| 2 | # This currently builds C and C++ code. |
| 3 | <%! |
| 4 | from copy import deepcopy |
| 5 | import re |
| 6 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 7 | proto_re = re.compile('(.*)\.proto') |
| 8 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 9 | def excluded(filename, exclude_res): |
| 10 | for r in exclude_res: |
| 11 | if r.match(filename): |
| 12 | return True |
| 13 | return False |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 14 | |
| 15 | def proto_to_cc(filename): |
| 16 | m = proto_re.match(filename) |
| 17 | if not m: |
| 18 | return filename |
| 19 | return 'gens/' + m.group(1) + '.pb.cc' |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 20 | %> |
| 21 | |
| 22 | <% |
| 23 | altlibs = [] |
| 24 | for lib in libs: |
| 25 | for alt in lib.get('alternates', []): |
| 26 | new = deepcopy(lib) |
| 27 | new.name = alt.name |
| 28 | new.alternates = [] |
| 29 | exclude_res = [re.compile(str) for str in alt.get('exclude_res', [])] |
| 30 | |
| 31 | src = [file for file in new.get('src', []) if not excluded(file, exclude_res)] |
| 32 | src.extend(alt.get('include_src', [])) |
| 33 | new.src = src |
| 34 | |
| 35 | headers = [file for file in new.get('headers', []) if not excluded(file, exclude_res)] |
| 36 | headers.extend(alt.get('include_headers', [])) |
| 37 | new.headers = headers |
| 38 | |
| 39 | public_headers = [file for file in new.get('public_headers', []) if not excluded(file, exclude_res)] |
| 40 | public_headers.extend(alt.get('include_public_headers', [])) |
| 41 | new.public_headers = public_headers |
| 42 | |
| 43 | for prop in alt.properties: |
| 44 | new[prop.name] = prop.value |
| 45 | |
| 46 | altlibs.append(new) |
| 47 | libs.extend(altlibs) |
| 48 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 49 | protos = set() |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 50 | for lib in libs: |
| 51 | for src in lib.src: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 52 | m = proto_re.match(src) |
| 53 | if m: |
| 54 | protos.add(m.group(1)) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 55 | for tgt in targets: |
| 56 | for src in tgt.src: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 57 | m = proto_re.match(src) |
| 58 | if m: |
| 59 | protos.add(m.group(1)) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 60 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 61 | protos = sorted(protos) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 62 | %> |
| 63 | |
| 64 | # General settings. |
| 65 | # You may want to change these depending on your system. |
| 66 | |
| 67 | prefix ?= /usr/local |
| 68 | |
| 69 | PROTOC = protoc |
| 70 | CC = gcc |
| 71 | CXX = g++ |
| 72 | LD = gcc |
| 73 | LDXX = g++ |
| 74 | AR = ar |
| 75 | STRIP = strip --strip-unneeded |
| 76 | INSTALL = install -D |
| 77 | RM = rm -f |
| 78 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 79 | HOST_CC = $(CC) |
| 80 | HOST_CXX = $(CXX) |
| 81 | HOST_LD = $(LD) |
| 82 | HOST_LDXX = $(LDXX) |
| 83 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 84 | ifeq ($(DEBUG),) |
| 85 | CPPFLAGS += -O2 |
| 86 | DEFINES += NDEBUG |
| 87 | else |
| 88 | CPPFLAGS += -O0 |
| 89 | DEFINES += _DEBUG DEBUG |
| 90 | endif |
| 91 | |
| 92 | CFLAGS += -std=c89 -pedantic |
| 93 | CXXFLAGS += -std=c++11 |
| 94 | CPPFLAGS += -g -fPIC -Wall -Werror -Wno-long-long |
| 95 | LDFLAGS += -g -pthread -fPIC |
| 96 | |
| 97 | INCLUDES = . include gens |
| 98 | LIBS = rt m z event event_pthreads pthread |
| 99 | LIBSXX = protobuf |
| 100 | LIBS_SECURE = ssl crypto dl |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 101 | LIBS_PROTOC = protoc protobuf |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 102 | |
| 103 | ifneq ($(wildcard /usr/src/gtest/src/gtest-all.cc),) |
| 104 | GTEST_LIB = /usr/src/gtest/src/gtest-all.cc -I/usr/src/gtest |
| 105 | else |
| 106 | GTEST_LIB = -lgtest |
| 107 | endif |
chenw | a8fd44a | 2014-12-10 15:13:55 -0800 | [diff] [blame] | 108 | GTEST_LIB += -lgflags |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 109 | ifeq ($(V),1) |
| 110 | E = @: |
| 111 | Q = |
| 112 | else |
| 113 | E = @echo |
| 114 | Q = @ |
| 115 | endif |
| 116 | |
| 117 | VERSION = ${settings.version.major}.${settings.version.minor}.${settings.version.micro}.${settings.version.build} |
| 118 | |
| 119 | CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) |
| 120 | CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) |
| 121 | |
| 122 | LDFLAGS += $(ARCH_FLAGS) |
| 123 | LDLIBS += $(addprefix -l, $(LIBS)) |
| 124 | LDLIBSXX += $(addprefix -l, $(LIBSXX)) |
| 125 | LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE)) |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 126 | HOST_LDLIBS_PROTOC += $(addprefix -l, $(LIBS_PROTOC)) |
| 127 | |
| 128 | HOST_CPPFLAGS = $(CPPFLAGS) |
| 129 | HOST_CFLAGS = $(CFLAGS) |
| 130 | HOST_CXXFLAGS = $(CXXFLAGS) |
| 131 | HOST_LDFLAGS = $(LDFLAGS) |
| 132 | HOST_LDLIBS = $(LDLIBS) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 133 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 134 | |
| 135 | # These are automatically computed variables. |
| 136 | # There shouldn't be any need to change anything from now on. |
| 137 | |
| 138 | HOST_SYSTEM = $(shell uname | cut -f 1 -d_) |
| 139 | ifeq ($(SYSTEM),) |
| 140 | SYSTEM = $(HOST_SYSTEM) |
| 141 | endif |
| 142 | |
| 143 | ifeq ($(wildcard .git),) |
| 144 | IS_GIT_FOLDER = false |
| 145 | else |
| 146 | IS_GIT_FOLDER = true |
| 147 | endif |
| 148 | |
| 149 | EVENT2_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/event2.c -levent $(LDFLAGS) |
| 150 | OPENSSL_ALPN_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/openssl-alpn.c -levent $(LDFLAGS) $(LDLIBS_SECURE) |
| 151 | ZLIB_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o /dev/null test/build/event2.c -levent $(LDFLAGS) |
| 152 | |
| 153 | HAS_SYSTEM_EVENT2 = $(shell $(EVENT2_CHECK_CMD) >& /dev/null && echo true || echo false) |
| 154 | HAS_SYSTEM_OPENSSL_ALPN = $(shell $(OPENSSL_ALPN_CHECK_CMD) >& /dev/null && echo true || echo false) |
| 155 | HAS_SYSTEM_ZLIB = $(shell $(ZLIB_CHECK_CMD) >& /dev/null && echo true || echo false) |
| 156 | |
| 157 | ifeq ($(wildcard third_party/libevent/include/event2/event.h),) |
| 158 | HAS_EMBEDDED_EVENT2 = false |
| 159 | else |
| 160 | HAS_EMBEDDED_EVENT2 = true |
| 161 | endif |
| 162 | |
| 163 | ifeq ($(wildcard third_party/openssl/ssl/ssl.h),) |
| 164 | HAS_EMBEDDED_OPENSSL_ALPN = false |
| 165 | else |
| 166 | HAS_EMBEDDED_OPENSSL_ALPN = true |
| 167 | endif |
| 168 | |
| 169 | ifeq ($(wildcard third_party/zlib/zlib.h),) |
| 170 | HAS_EMBEDDED_ZLIB = false |
| 171 | else |
| 172 | HAS_EMBEDDED_ZLIB = true |
| 173 | endif |
| 174 | |
| 175 | ifneq ($(SYSTEM),MINGW32) |
| 176 | ifeq ($(HAS_SYSTEM_EVENT2),false) |
| 177 | DEP_MISSING += libevent |
| 178 | endif |
| 179 | endif |
| 180 | |
| 181 | ifeq ($(HAS_SYSTEM_ZLIB),false) |
| 182 | ifeq ($(HAS_EMBEDDED_ZLIB),true) |
| 183 | ZLIB_DEP = third_party/zlib/libz.a |
| 184 | CPPFLAGS += -Ithird_party/zlib |
| 185 | LDFLAGS += -Lthird_party/zlib |
| 186 | else |
| 187 | DEP_MISSING += zlib |
| 188 | endif |
| 189 | endif |
| 190 | |
| 191 | ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),false) |
| 192 | ifeq ($(HAS_EMBEDDED_OPENSSL_ALPN),true) |
| 193 | OPENSSL_DEP = third_party/openssl/libssl.a |
| 194 | CPPFLAGS += -Ithird_party/openssl/include |
| 195 | LDFLAGS += -Lthird_party/openssl |
| 196 | else |
| 197 | NO_SECURE = true |
| 198 | endif |
| 199 | endif |
| 200 | |
| 201 | ifneq ($(DEP_MISSING),) |
| 202 | NO_DEPS = true |
| 203 | endif |
| 204 | |
| 205 | ifneq ($(MAKECMDGOALS),clean) |
| 206 | NO_DEPS = true |
| 207 | endif |
| 208 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 209 | .SECONDARY = %.pb.h %.pb.cc |
| 210 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 211 | ifeq ($(DEP_MISSING),) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 212 | all: static shared\ |
| 213 | % for tgt in targets: |
| 214 | % if tgt.build == 'all': |
| 215 | bins/${tgt.name}\ |
| 216 | % endif |
| 217 | % endfor |
| 218 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 219 | dep_error: |
| 220 | @echo "You shouldn't see this message - all of your dependencies are correct." |
| 221 | else |
| 222 | all: dep_error git_update stop |
| 223 | |
| 224 | dep_error: |
| 225 | @echo |
| 226 | @echo "DEPENDENCY ERROR" |
| 227 | @echo |
| 228 | @echo "You are missing system dependencies that are essential to build grpc," |
| 229 | @echo "and the third_party directory doesn't have them:" |
| 230 | @echo |
| 231 | @echo " $(DEP_MISSING)" |
| 232 | @echo |
| 233 | @echo "Installing the development packages for your system will solve" |
| 234 | @echo "this issue. Please consult INSTALL to get more information." |
| 235 | @echo |
| 236 | @echo "If you need information about why these tests failed, run:" |
| 237 | @echo |
| 238 | @echo " make run_dep_checks" |
| 239 | @echo |
| 240 | endif |
| 241 | |
| 242 | git_update: |
| 243 | ifeq ($(IS_GIT_FOLDER),true) |
| 244 | @echo "Additionally, since you are in a git clone, you can download the" |
| 245 | @echo "missing dependencies in third_party by running the following command:" |
| 246 | @echo |
ctiller | 64f2910 | 2014-12-15 10:40:59 -0800 | [diff] [blame^] | 247 | @echo " git submodule update --init" |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 248 | @echo |
| 249 | endif |
| 250 | |
| 251 | openssl_dep_error: openssl_dep_message git_update stop |
| 252 | |
| 253 | openssl_dep_message: |
| 254 | @echo |
| 255 | @echo "DEPENDENCY ERROR" |
| 256 | @echo |
| 257 | @echo "The target you are trying to run requires OpenSSL with ALPN support." |
| 258 | @echo "Your system doesn't have it, and neither does the third_party directory." |
| 259 | @echo |
| 260 | @echo "Please consult INSTALL to get more information." |
| 261 | @echo |
| 262 | @echo "If you need information about why these tests failed, run:" |
| 263 | @echo |
| 264 | @echo " make run_dep_checks" |
| 265 | @echo |
| 266 | |
| 267 | stop: |
| 268 | @false |
| 269 | |
| 270 | run_dep_checks: |
| 271 | $(EVENT2_CHECK_CMD) || true |
| 272 | $(OPENSSL_ALPN_CHECK_CMD) || true |
| 273 | $(ZLIB_CHECK_CMD) || true |
| 274 | |
| 275 | third_party/zlib/libz.a: |
| 276 | (cd third_party/zlib ; CFLAGS="-fPIC -fvisibility=hidden" ./configure --static) |
| 277 | $(MAKE) -C third_party/zlib |
| 278 | |
| 279 | third_party/openssl/libssl.a: |
| 280 | (cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden" ./config) |
| 281 | $(MAKE) -C third_party/openssl build_crypto build_ssl |
| 282 | |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 283 | static: static_c static_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 284 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 285 | static_c: dep_c\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 286 | % for lib in libs: |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 287 | % if lib.build == 'all' and not lib.get('c++', False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 288 | libs/lib${lib.name}.a\ |
| 289 | % endif |
| 290 | % endfor |
| 291 | |
| 292 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 293 | static_cxx: dep_cxx\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 294 | % for lib in libs: |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 295 | % if lib.build == 'all' and lib.get('c++', False): |
| 296 | libs/lib${lib.name}.a\ |
| 297 | % endif |
| 298 | % endfor |
| 299 | |
| 300 | |
| 301 | shared: shared_c shared_cxx |
| 302 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 303 | shared_c: dep_c\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 304 | % for lib in libs: |
| 305 | % if lib.build == 'all' and not lib.get('c++', False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 306 | libs/lib${lib.name}.so.$(VERSION)\ |
| 307 | % endif |
| 308 | % endfor |
| 309 | |
| 310 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 311 | shared_cxx: dep_cxx\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 312 | % for lib in libs: |
| 313 | % if lib.build == 'all' and lib.get('c++', False): |
| 314 | libs/lib${lib.name}.so.$(VERSION)\ |
| 315 | % endif |
| 316 | % endfor |
| 317 | |
| 318 | |
| 319 | privatelibs: privatelibs_c privatelibs_cxx |
| 320 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 321 | privatelibs_c: dep_c\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 322 | % for lib in libs: |
| 323 | % if lib.build == 'private': |
| 324 | libs/lib${lib.name}.a\ |
| 325 | % endif |
| 326 | % endfor |
| 327 | |
| 328 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 329 | privatelibs_cxx: dep_cxx\ |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 330 | % for lib in libs: |
| 331 | % if lib.build == 'private': |
| 332 | libs/lib${lib.name}.a\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 333 | % endif |
| 334 | % endfor |
| 335 | |
| 336 | |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 337 | buildtests: buildtests_c buildtests_cxx |
| 338 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 339 | buildtests_c: bin_dep_c privatelibs_c\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 340 | % for tgt in targets: |
| 341 | % if tgt.build == 'test' and not tgt.get('c++', False): |
| 342 | bins/${tgt.name}\ |
| 343 | % endif |
| 344 | % endfor |
| 345 | |
| 346 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 347 | buildtests_cxx: bin_dep_cxx privatelibs_cxx\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 348 | % for tgt in targets: |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 349 | % if tgt.build == 'test' and tgt.get('c++', False): |
| 350 | bins/${tgt.name}\ |
| 351 | % endif |
| 352 | % endfor |
| 353 | |
| 354 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 355 | test: test_c test_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 356 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 357 | test_c: buildtests_c |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 358 | % for tgt in targets: |
| 359 | % if tgt.build == 'test' and tgt.get('run', True) and not tgt.get('c++', False): |
| 360 | $(E) "[RUN] Testing ${tgt.name}" |
| 361 | $(Q) ./bins/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 362 | % endif |
| 363 | % endfor |
| 364 | |
| 365 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 366 | test_cxx: buildtests_cxx |
nnoble | 29e1d29 | 2014-12-01 10:27:40 -0800 | [diff] [blame] | 367 | % for tgt in targets: |
| 368 | % if tgt.build == 'test' and tgt.get('run', True) and tgt.get('c++', False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 369 | $(E) "[RUN] Testing ${tgt.name}" |
| 370 | $(Q) ./bins/${tgt.name} || ( echo test ${tgt.name} failed ; exit 1 ) |
| 371 | % endif |
| 372 | % endfor |
| 373 | |
| 374 | |
| 375 | tools: privatelibs\ |
| 376 | % for tgt in targets: |
| 377 | % if tgt.build == 'tool': |
| 378 | bins/${tgt.name}\ |
| 379 | % endif |
| 380 | % endfor |
| 381 | |
| 382 | |
nnoble | ebebb7e | 2014-12-10 16:31:01 -0800 | [diff] [blame] | 383 | protoc_plugins:\ |
| 384 | % for tgt in targets: |
| 385 | % if tgt.build == 'protoc': |
| 386 | bins/${tgt.name}\ |
| 387 | % endif |
| 388 | % endfor |
| 389 | |
| 390 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 391 | buildbenchmarks: privatelibs\ |
| 392 | % for tgt in targets: |
| 393 | % if tgt.build == 'benchmark': |
| 394 | bins/${tgt.name}\ |
| 395 | % endif |
| 396 | % endfor |
| 397 | |
| 398 | |
| 399 | benchmarks: buildbenchmarks |
| 400 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 401 | strip: strip-static strip-shared |
| 402 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 403 | strip-static_c: static_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 404 | % for lib in libs: |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 405 | % if not lib.get("c++", False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 406 | % if lib.build == "all": |
| 407 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
| 408 | $(Q) $(STRIP) libs/lib${lib.name}.a |
| 409 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 410 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 411 | % endfor |
| 412 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 413 | strip-static_cxx: static_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 414 | % for lib in libs: |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 415 | % if lib.get("c++", False): |
| 416 | % if lib.build == "all": |
| 417 | $(E) "[STRIP] Stripping lib${lib.name}.a" |
| 418 | $(Q) $(STRIP) libs/lib${lib.name}.a |
| 419 | % endif |
| 420 | % endif |
| 421 | % endfor |
| 422 | |
| 423 | strip-shared_c: shared_c |
| 424 | % for lib in libs: |
| 425 | % if not lib.get("c++", False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 426 | % if lib.build == "all": |
| 427 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 428 | $(Q) $(STRIP) libs/lib${lib.name}.so.$(VERSION) |
| 429 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 430 | % endif |
| 431 | % endfor |
| 432 | |
| 433 | strip-shared_cxx: shared_cxx |
| 434 | % for lib in libs: |
| 435 | % if lib.get("c++", False): |
| 436 | % if lib.build == "all": |
| 437 | $(E) "[STRIP] Stripping lib${lib.name}.so" |
| 438 | $(Q) $(STRIP) libs/lib${lib.name}.so.$(VERSION) |
| 439 | % endif |
| 440 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 441 | % endfor |
| 442 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 443 | % for p in protos: |
| 444 | deps/gens/${p}.pb.dep: |
| 445 | $(Q) mkdir -p `dirname $@` |
| 446 | $(Q) touch $@ |
| 447 | |
| 448 | gens/${p}.pb.cc: ${p}.proto protoc_plugins |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 449 | $(E) "[PROTOC] Generating protobuf CC file from $<" |
| 450 | $(Q) mkdir -p `dirname $@` |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 451 | $(Q) $(PROTOC) --cpp_out=gens --grpc_out=gens --plugin=protoc-gen-grpc=bins/cpp_plugin $< |
| 452 | |
| 453 | % endfor |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 454 | |
| 455 | deps/%.dep : %.c |
| 456 | $(E) "[DEP] Generating dependencies for $<" |
| 457 | $(Q) mkdir -p `dirname $@` |
| 458 | $(Q) $(CC) $(CFLAGS) $(CPPFLAGS_NO_ARCH) -MG -M $< > $@ |
| 459 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 460 | deps/%.dep : %.cc |
| 461 | $(E) "[DEP] Generating dependencies for $<" |
| 462 | $(Q) mkdir -p `dirname $@` |
| 463 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS_NO_ARCH) -MG -M $< > $@ |
| 464 | |
| 465 | objs/%.o : %.c |
| 466 | $(E) "[C] Compiling $<" |
| 467 | $(Q) mkdir -p `dirname $@` |
| 468 | $(Q) $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< |
| 469 | |
| 470 | objs/%.o : gens/%.pb.cc |
| 471 | $(E) "[CXX] Compiling $<" |
| 472 | $(Q) mkdir -p `dirname $@` |
| 473 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< |
| 474 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 475 | objs/src/compiler/%.o : src/compiler/%.cc |
| 476 | $(E) "[HOSTCXX] Compiling $<" |
| 477 | $(Q) mkdir -p `dirname $@` |
| 478 | $(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -c -o $@ $< |
| 479 | |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 480 | objs/%.o : %.cc |
| 481 | $(E) "[CXX] Compiling $<" |
| 482 | $(Q) mkdir -p `dirname $@` |
| 483 | $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< |
| 484 | |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 485 | dep: dep_c dep_cxx |
| 486 | |
| 487 | dep_c:\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 488 | % for lib in libs: |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 489 | % if not lib.get('c++', False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 490 | deps_lib${lib.name}\ |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 491 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 492 | % endfor |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 493 | |
| 494 | |
| 495 | bins_dep_c:\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 496 | % for tgt in targets: |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 497 | % if not tgt.get('c++', False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 498 | deps_${tgt.name}\ |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 499 | % endif |
| 500 | % endfor |
| 501 | |
| 502 | |
| 503 | dep_cxx:\ |
| 504 | % for lib in libs: |
| 505 | % if lib.get('c++', False): |
| 506 | deps_lib${lib.name}\ |
| 507 | % endif |
| 508 | % endfor |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 509 | |
| 510 | |
| 511 | bins_dep_cxx:\ |
nnoble | 0c475f0 | 2014-12-05 15:37:39 -0800 | [diff] [blame] | 512 | % for tgt in targets: |
| 513 | % if tgt.get('c++', False): |
| 514 | deps_${tgt.name}\ |
| 515 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 516 | % endfor |
| 517 | |
| 518 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 519 | install: install_c install_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 520 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 521 | install_c: install-headers_c install-static_c install-shared_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 522 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 523 | install_cxx: install-headers_cxx install-static_cxx install-shared_cxx |
| 524 | |
| 525 | install-headers: install-headers_c install-headers_cxx |
| 526 | |
| 527 | install-headers_c: |
| 528 | $(E) "[INSTALL] Installing public C headers" |
| 529 | $(Q) $(foreach h, $(PUBLIC_HEADERS_C), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 |
| 530 | |
| 531 | install-headers_cxx: |
| 532 | $(E) "[INSTALL] Installing public C++ headers" |
| 533 | $(Q) $(foreach h, $(PUBLIC_HEADERS_CXX), $(INSTALL) $(h) $(prefix)/$(h) && ) exit 0 || exit 1 |
| 534 | |
| 535 | install-static: install-static_c install-static_cxx |
| 536 | |
| 537 | install-static_c: static_c strip-static_c |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 538 | % for lib in libs: |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 539 | % if not lib.get("c++", False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 540 | % if lib.build == "all": |
| 541 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
| 542 | $(Q) $(INSTALL) libs/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a |
| 543 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 544 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 545 | % endfor |
| 546 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 547 | install-static_cxx: static_cxx strip-static_cxx |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 548 | % for lib in libs: |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 549 | % if lib.get("c++", False): |
| 550 | % if lib.build == "all": |
| 551 | $(E) "[INSTALL] Installing lib${lib.name}.a" |
| 552 | $(Q) $(INSTALL) libs/lib${lib.name}.a $(prefix)/lib/lib${lib.name}.a |
| 553 | % endif |
| 554 | % endif |
| 555 | % endfor |
| 556 | |
| 557 | install-shared_c: shared_c strip-shared_c |
| 558 | % for lib in libs: |
| 559 | % if not lib.get("c++", False): |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 560 | % if lib.build == "all": |
| 561 | $(E) "[INSTALL] Installing lib${lib.name}.so" |
| 562 | $(Q) $(INSTALL) libs/lib${lib.name}.so.$(VERSION) $(prefix)/lib/lib${lib.name}.so.$(VERSION) |
| 563 | % endif |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 564 | % endif |
| 565 | % endfor |
| 566 | |
| 567 | install-shared_cxx: shared_cxx strip-shared_cxx |
| 568 | % for lib in libs: |
| 569 | % if lib.get("c++", False): |
| 570 | % if lib.build == "all": |
| 571 | $(E) "[INSTALL] Installing lib${lib.name}.so" |
| 572 | $(Q) $(INSTALL) libs/lib${lib.name}.so.$(VERSION) $(prefix)/lib/lib${lib.name}.so.$(VERSION) |
| 573 | % endif |
| 574 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 575 | % endfor |
| 576 | |
| 577 | clean:\ |
| 578 | % for lib in libs: |
| 579 | clean_lib${lib.name}\ |
| 580 | % endfor |
| 581 | % for tgt in targets: |
| 582 | clean_${tgt.name}\ |
| 583 | % endfor |
| 584 | |
| 585 | $(Q) $(RM) -r deps objs libs bins gens |
| 586 | |
| 587 | |
| 588 | # The various libraries |
| 589 | |
| 590 | % for lib in libs: |
| 591 | ${makelib(lib)} |
| 592 | % endfor |
| 593 | |
| 594 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 595 | # All of the test targets, and protoc plugins |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 596 | |
| 597 | % for tgt in targets: |
| 598 | ${maketarget(tgt)} |
| 599 | % endfor |
| 600 | |
| 601 | <%def name="makelib(lib)"> |
| 602 | LIB${lib.name.upper()}_SRC = \\ |
| 603 | |
| 604 | % for src in lib.src: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 605 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 606 | |
| 607 | % endfor |
| 608 | |
| 609 | % if "public_headers" in lib: |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 610 | % if lib.get("c++", False): |
| 611 | PUBLIC_HEADERS_CXX += \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 612 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 613 | % else: |
| 614 | PUBLIC_HEADERS_C += \\ |
| 615 | |
| 616 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 617 | % for hdr in lib.public_headers: |
| 618 | ${hdr} \\ |
| 619 | |
| 620 | % endfor |
| 621 | % endif |
| 622 | |
| 623 | LIB${lib.name.upper()}_OBJS = $(addprefix objs/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC)))) |
| 624 | LIB${lib.name.upper()}_DEPS = $(addprefix deps/, $(addsuffix .dep, $(basename $(LIB${lib.name.upper()}_SRC)))) |
| 625 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 626 | % if lib.get('secure', True): |
| 627 | LIB${lib.name.upper()}_OBJS += $(OPENSSL_DEP) |
| 628 | |
| 629 | ifeq ($(NO_SECURE),true) |
| 630 | |
| 631 | libs/lib${lib.name}.a: openssl_dep_error |
| 632 | |
| 633 | else |
| 634 | |
| 635 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 636 | libs/lib${lib.name}.a: $(LIB${lib.name.upper()}_OBJS) |
| 637 | $(E) "[AR] Creating $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 638 | $(Q) mkdir -p `dirname $@` |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 639 | $(Q) $(AR) rcs libs/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) |
| 640 | |
| 641 | % if lib.build == "all": |
| 642 | libs/lib${lib.name}.so.$(VERSION): $(LIB${lib.name.upper()}_OBJS) |
| 643 | $(E) "[LD] Linking $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 644 | $(Q) mkdir -p `dirname $@` |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 645 | % if lib.get('c++', False): |
| 646 | $(Q) $(LDXX) $(LDFLAGS) -shared -Wl,-soname,lib${lib.name}.so.${settings.version.major} \ |
| 647 | % else: |
| 648 | $(Q) $(LD) $(LDFLAGS) -shared -Wl,-soname,lib${lib.name}.so.${settings.version.major} \ |
| 649 | % endif |
| 650 | -o libs/lib${lib.name}.so.$(VERSION) $(LIB${lib.name.upper()}_OBJS) $(LDLIBS)\ |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 651 | % if lib.get('secure', True): |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 652 | $(LDLIBS_SECURE)\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 653 | % endif |
| 654 | % endif |
| 655 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 656 | % if lib.get('secure', True): |
| 657 | |
| 658 | endif |
| 659 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 660 | |
| 661 | deps_lib${lib.name}: $(LIB${lib.name.upper()}_DEPS) |
| 662 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 663 | % if lib.get('secure', True): |
| 664 | ifneq ($(NO_SECURE),true) |
| 665 | % endif |
| 666 | ifneq ($(NO_DEPS),true) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 667 | -include $(LIB${lib.name.upper()}_DEPS) |
| 668 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 669 | % if lib.get('secure', True): |
| 670 | endif |
| 671 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 672 | |
| 673 | clean_lib${lib.name}: |
| 674 | $(E) "[CLEAN] Cleaning lib${lib.name} files" |
| 675 | $(Q) $(RM) $(LIB${lib.name.upper()}_OBJS) |
| 676 | $(Q) $(RM) $(LIB${lib.name.upper()}_DEPS) |
| 677 | $(Q) $(RM) libs/lib${lib.name}.a |
| 678 | $(Q) $(RM) libs/lib${lib.name}.so.$(VERSION) |
| 679 | </%def> |
| 680 | |
| 681 | <%def name="maketarget(tgt)"> |
| 682 | ${tgt.name.upper()}_SRC = \\ |
| 683 | |
| 684 | % for src in tgt.src: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 685 | ${proto_to_cc(src)} \\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 686 | |
| 687 | % endfor |
| 688 | |
| 689 | ${tgt.name.upper()}_OBJS = $(addprefix objs/, $(addsuffix .o, $(basename $(${tgt.name.upper()}_SRC)))) |
| 690 | ${tgt.name.upper()}_DEPS = $(addprefix deps/, $(addsuffix .dep, $(basename $(${tgt.name.upper()}_SRC)))) |
| 691 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 692 | % if tgt.get('secure', True): |
| 693 | ifeq ($(NO_SECURE),true) |
| 694 | |
| 695 | bins/${tgt.name}: openssl_dep_error |
| 696 | |
| 697 | else |
| 698 | |
| 699 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 700 | bins/${tgt.name}: $(${tgt.name.upper()}_OBJS)\ |
| 701 | % for dep in tgt.deps: |
| 702 | libs/lib${dep}.a\ |
| 703 | % endfor |
| 704 | |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 705 | % if tgt.get("c++", False): |
| 706 | % if tgt.build == 'protoc': |
| 707 | $(E) "[HOSTLD] Linking $@" |
| 708 | $(Q) mkdir -p `dirname $@` |
| 709 | $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(${tgt.name.upper()}_OBJS)\ |
| 710 | % else: |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 711 | $(E) "[LD] Linking $@" |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 712 | $(Q) mkdir -p `dirname $@` |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 713 | $(Q) $(LDXX) $(LDFLAGS) $(${tgt.name.upper()}_OBJS)\ |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 714 | % endif |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 715 | % if tgt.build == 'test': |
| 716 | $(GTEST_LIB)\ |
| 717 | % endif |
| 718 | -Llibs\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 719 | % else: |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 720 | $(E) "[LD] Linking $@" |
| 721 | $(Q) mkdir -p `dirname $@` |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 722 | $(Q) $(LD) $(LDFLAGS) $(${tgt.name.upper()}_OBJS) -Llibs\ |
| 723 | % endif |
| 724 | % for dep in tgt.deps: |
| 725 | -l${dep}\ |
| 726 | % endfor |
| 727 | % if tgt.get("c++", False): |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 728 | % if tgt.build == 'protoc': |
| 729 | $(HOST_LDLIBSXX)\ |
| 730 | % else: |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 731 | $(LDLIBSXX)\ |
| 732 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 733 | % endif |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 734 | % if tgt.build == 'protoc': |
nnoble | 72309c6 | 2014-12-12 11:42:26 -0800 | [diff] [blame] | 735 | $(HOST_LDLIBS)\ |
| 736 | % else: |
| 737 | $(LDLIBS)\ |
| 738 | % endif |
| 739 | % if tgt.build == 'protoc': |
| 740 | $(HOST_LDLIBS_PROTOC)\ |
| 741 | % elif tgt.get('secure', True): |
| 742 | $(LDLIBS_SECURE)\ |
nnoble | c78b340 | 2014-12-11 16:06:57 -0800 | [diff] [blame] | 743 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 744 | -o bins/${tgt.name} |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 745 | % if tgt.get('secure', True): |
| 746 | |
| 747 | endif |
| 748 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 749 | |
| 750 | deps_${tgt.name}: $(${tgt.name.upper()}_DEPS) |
| 751 | |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 752 | % if tgt.get('secure', True): |
| 753 | ifneq ($(NO_SECURE),true) |
| 754 | % endif |
| 755 | ifneq ($(NO_DEPS),true) |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 756 | -include $(${tgt.name.upper()}_DEPS) |
| 757 | endif |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 758 | % if tgt.get('secure', True): |
| 759 | endif |
| 760 | % endif |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 761 | |
| 762 | clean_${tgt.name}: |
| 763 | $(E) "[CLEAN] Cleaning ${tgt.name} files" |
| 764 | $(Q) $(RM) $(${tgt.name.upper()}_OBJS) |
| 765 | $(Q) $(RM) $(${tgt.name.upper()}_DEPS) |
| 766 | $(Q) $(RM) bins/${tgt.name} |
| 767 | </%def> |
| 768 | |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 769 | .PHONY: all strip tools \ |
nnoble | 69ac39f | 2014-12-12 15:43:38 -0800 | [diff] [blame] | 770 | dep_error openssl_dep_error openssl_dep_message git_update stop \ |
nnoble | 85a4926 | 2014-12-08 18:14:03 -0800 | [diff] [blame] | 771 | buildtests buildtests_c buildtests_cxx \ |
| 772 | test test_c test_cxx \ |
| 773 | install install_c install_cxx \ |
| 774 | install-headers install-headers_c install-headers_cxx \ |
| 775 | install-shared install-shared_c install-shared_cxx \ |
| 776 | install-static install-static_c install-static_cxx \ |
| 777 | strip strip-shared strip-static \ |
| 778 | strip_c strip-shared_c strip-static_c \ |
| 779 | strip_cxx strip-shared_cxx strip-static_cxx \ |
| 780 | clean\ |
Nicolas Noble | b7ebd3b | 2014-11-26 16:33:03 -0800 | [diff] [blame] | 781 | % for lib in libs: |
| 782 | deps_lib${lib.name} clean_lib${lib.name}\ |
| 783 | % endfor |
| 784 | % for tgt in targets: |
| 785 | deps_${tgt.name} clean_${tgt.name}\ |
| 786 | % endfor |
| 787 | |