Makefile.template 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  1. %YAML 1.2
  2. --- |
  3. # GRPC global makefile
  4. # This currently builds C and C++ code.
  5. # This file has been automatically generated from a template file.
  6. # Please look at the templates directory instead.
  7. # This file can be regenerated from the template by running
  8. # tools/buildgen/generate_projects.sh
  9. # Copyright 2015 gRPC authors.
  10. #
  11. # Licensed under the Apache License, Version 2.0 (the "License");
  12. # you may not use this file except in compliance with the License.
  13. # You may obtain a copy of the License at
  14. #
  15. # http://www.apache.org/licenses/LICENSE-2.0
  16. #
  17. # Unless required by applicable law or agreed to in writing, software
  18. # distributed under the License is distributed on an "AS IS" BASIS,
  19. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  20. # See the License for the specific language governing permissions and
  21. # limitations under the License.
  22. <%!
  23. import re
  24. import os
  25. def is_absl_lib(target_name):
  26. return target_name.startswith("absl/");
  27. sources_that_need_openssl = set()
  28. sources_that_don_t_need_openssl = set()
  29. # warnings we'd like, but that don't exist in all compilers
  30. PREFERRED_WARNINGS=['extra-semi']
  31. CHECK_WARNINGS=PREFERRED_WARNINGS + ['no-shift-negative-value', 'no-unused-but-set-variable', 'no-maybe-uninitialized', 'no-unknown-warning-option']
  32. def warning_var(fmt, warning):
  33. return fmt % warning.replace('-', '_').replace('+', 'X').upper()
  34. def neg_warning(warning):
  35. if warning[0:3] == 'no-':
  36. return warning[3:]
  37. else:
  38. return 'no-' + warning
  39. lang_to_var = {
  40. 'c': 'CORE',
  41. 'c++': 'CPP',
  42. 'csharp': 'CSHARP'
  43. }
  44. %>
  45. <%
  46. # Makefile is only intended for internal needs (building distribution artifacts etc.)
  47. # so we can restrict the number of libraries/targets that are buildable using the Makefile.
  48. # Other targets can be built with cmake or bazel.
  49. # TODO(jtattermusch): Figure out how to avoid the need to list the dependencies explicitly.
  50. # Currently it is necessary because some dependencies are marked as "build: private" in build.yaml
  51. # (which itself is correct, as they are not "public" libraries from our perspective and cmake
  52. # needs to have them marked as such)
  53. filtered_libs = [lib for lib in libs if (lib.build in ['all'] and lib.language != 'c++') or lib.name in ['ares', 'boringssl', 're2', 'upb', 'z']]
  54. filtered_targets = [tgt for tgt in targets if tgt.build in ['all'] and lib.language != 'c++']
  55. %>
  56. comma := ,
  57. # Basic platform detection
  58. HOST_SYSTEM = $(shell uname | cut -f 1 -d_)
  59. SYSTEM ?= $(HOST_SYSTEM)
  60. ifeq ($(SYSTEM),MSYS)
  61. SYSTEM = MINGW32
  62. endif
  63. ifeq ($(SYSTEM),MINGW64)
  64. SYSTEM = MINGW32
  65. endif
  66. # Basic machine detection
  67. HOST_MACHINE = $(shell uname -m)
  68. ifeq ($(HOST_MACHINE),x86_64)
  69. HOST_IS_X86_64 = true
  70. else
  71. HOST_IS_X86_64 = false
  72. endif
  73. MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
  74. ifndef BUILDDIR
  75. BUILDDIR_ABSOLUTE = $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))
  76. else
  77. BUILDDIR_ABSOLUTE = $(abspath $(BUILDDIR))
  78. endif
  79. HAS_GCC = $(shell which gcc > /dev/null 2> /dev/null && echo true || echo false)
  80. HAS_CC = $(shell which cc > /dev/null 2> /dev/null && echo true || echo false)
  81. HAS_CLANG = $(shell which clang > /dev/null 2> /dev/null && echo true || echo false)
  82. ifeq ($(HAS_CC),true)
  83. DEFAULT_CC = cc
  84. DEFAULT_CXX = c++
  85. else
  86. ifeq ($(HAS_GCC),true)
  87. DEFAULT_CC = gcc
  88. DEFAULT_CXX = g++
  89. else
  90. ifeq ($(HAS_CLANG),true)
  91. DEFAULT_CC = clang
  92. DEFAULT_CXX = clang++
  93. else
  94. DEFAULT_CC = no_c_compiler
  95. DEFAULT_CXX = no_c++_compiler
  96. endif
  97. endif
  98. endif
  99. BINDIR = $(BUILDDIR_ABSOLUTE)/bins
  100. OBJDIR = $(BUILDDIR_ABSOLUTE)/objs
  101. LIBDIR = $(BUILDDIR_ABSOLUTE)/libs
  102. GENDIR = $(BUILDDIR_ABSOLUTE)/gens
  103. # Configurations (as defined under "configs" section in build_handwritten.yaml)
  104. % for name, args in configs.items():
  105. VALID_CONFIG_${name} = 1
  106. % if args.get('compile_the_world', False):
  107. REQUIRE_CUSTOM_LIBRARIES_${name} = 1
  108. % endif
  109. % for tool, default in [('CC', 'CC'), ('CXX', 'CXX'), ('LD', 'CC'), ('LDXX', 'CXX')]:
  110. ${tool}_${name} = ${args.get(tool, '$(DEFAULT_%s)' % default)}
  111. % endfor
  112. % for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'DEFINES']:
  113. % if args.get(arg, None) is not None:
  114. ${arg}_${name} = ${args.get(arg)}
  115. % endif
  116. % endfor
  117. % endfor
  118. # General settings.
  119. # You may want to change these depending on your system.
  120. prefix ?= /usr/local
  121. DTRACE ?= dtrace
  122. CONFIG ?= opt
  123. # Doing X ?= Y is the same as:
  124. # ifeq ($(origin X), undefined)
  125. # X = Y
  126. # endif
  127. # but some variables, such as CC, CXX, LD or AR, have defaults.
  128. # So instead of using ?= on them, we need to check their origin.
  129. # See:
  130. # https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
  131. # https://www.gnu.org/software/make/manual/html_node/Flavors.html#index-_003f_003d
  132. # https://www.gnu.org/software/make/manual/html_node/Origin-Function.html
  133. ifeq ($(origin CC), default)
  134. CC = $(CC_$(CONFIG))
  135. endif
  136. ifeq ($(origin CXX), default)
  137. CXX = $(CXX_$(CONFIG))
  138. endif
  139. ifeq ($(origin LD), default)
  140. LD = $(LD_$(CONFIG))
  141. endif
  142. LDXX ?= $(LDXX_$(CONFIG))
  143. ARFLAGS ?= rcs
  144. ifeq ($(SYSTEM),Linux)
  145. ifeq ($(origin AR), default)
  146. AR = ar
  147. endif
  148. STRIP ?= strip --strip-unneeded
  149. else
  150. ifeq ($(SYSTEM),Darwin)
  151. ifeq ($(origin AR), default)
  152. AR = libtool
  153. ARFLAGS = -no_warning_for_no_symbols -o
  154. endif
  155. STRIP ?= strip -x
  156. else
  157. ifeq ($(SYSTEM),MINGW32)
  158. ifeq ($(origin AR), default)
  159. AR = ar
  160. endif
  161. STRIP ?= strip --strip-unneeded
  162. else
  163. ifeq ($(origin AR), default)
  164. AR = ar
  165. endif
  166. STRIP ?= strip
  167. endif
  168. endif
  169. endif
  170. INSTALL ?= install
  171. RM ?= rm -f
  172. PKG_CONFIG ?= pkg-config
  173. ifndef VALID_CONFIG_$(CONFIG)
  174. $(error Invalid CONFIG value '$(CONFIG)')
  175. endif
  176. ifeq ($(SYSTEM),Linux)
  177. TMPOUT = /dev/null
  178. else
  179. TMPOUT = `mktemp /tmp/test-out-XXXXXX`
  180. endif
  181. CHECK_NO_CXX14_COMPAT_WORKS_CMD = $(CC) -std=c++11 -Werror -Wno-c++14-compat -o $(TMPOUT) -c test/build/no-c++14-compat.cc
  182. HAS_WORKING_NO_CXX14_COMPAT = $(shell $(CHECK_NO_CXX14_COMPAT_WORKS_CMD) 2> /dev/null && echo true || echo false)
  183. ifeq ($(HAS_WORKING_NO_CXX14_COMPAT),true)
  184. W_NO_CXX14_COMPAT=-Wno-c++14-compat
  185. endif
  186. %for warning in CHECK_WARNINGS:
  187. ${warning_var('CHECK_%s_WORKS_CMD', warning)} = $(CC) -std=c99 -Werror -W${warning} -o $(TMPOUT) -c test/build/${warning}.c
  188. ${warning_var('HAS_WORKING_%s', warning)} = $(shell $(${warning_var('CHECK_%s_WORKS_CMD', warning)}) 2> /dev/null && echo true || echo false)
  189. ifeq ($(${warning_var('HAS_WORKING_%s', warning)}),true)
  190. ${warning_var('W_%s', warning)}=-W${warning}
  191. ${warning_var('NO_W_%s', warning)}=-W${neg_warning(warning)}
  192. endif
  193. %endfor
  194. # The HOST compiler settings are used to compile the protoc plugins.
  195. # In most cases, you won't have to change anything, but if you are
  196. # cross-compiling, you can override these variables from GNU make's
  197. # command line: make CC=cross-gcc HOST_CC=gcc
  198. HOST_CC ?= $(CC)
  199. HOST_CXX ?= $(CXX)
  200. HOST_LD ?= $(LD)
  201. HOST_LDXX ?= $(LDXX)
  202. CFLAGS += -std=c99 ${' '.join(warning_var('$(W_%s)', warning) for warning in PREFERRED_WARNINGS)}
  203. CXXFLAGS += -std=c++11
  204. ifeq ($(SYSTEM),Darwin)
  205. CXXFLAGS += -stdlib=libc++
  206. LDFLAGS += -framework CoreFoundation
  207. endif
  208. % for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'COREFLAGS', 'LDFLAGS', 'DEFINES']:
  209. % if defaults.get('global', []).get(arg, None) is not None:
  210. ${arg} += ${defaults.get('global').get(arg)}
  211. % endif
  212. % endfor
  213. CPPFLAGS += $(CPPFLAGS_$(CONFIG))
  214. CFLAGS += $(CFLAGS_$(CONFIG))
  215. CXXFLAGS += $(CXXFLAGS_$(CONFIG))
  216. DEFINES += $(DEFINES_$(CONFIG)) INSTALL_PREFIX=\"$(prefix)\"
  217. LDFLAGS += $(LDFLAGS_$(CONFIG))
  218. ifneq ($(SYSTEM),MINGW32)
  219. PIC_CPPFLAGS = -fPIC
  220. CPPFLAGS += -fPIC
  221. LDFLAGS += -fPIC
  222. endif
  223. INCLUDES = . include $(GENDIR)
  224. LDFLAGS += -Llibs/$(CONFIG)
  225. ifeq ($(SYSTEM),Darwin)
  226. ifneq ($(wildcard /usr/local/ssl/include),)
  227. INCLUDES += /usr/local/ssl/include
  228. endif
  229. ifneq ($(wildcard /opt/local/include),)
  230. INCLUDES += /opt/local/include
  231. endif
  232. ifneq ($(wildcard /usr/local/include),)
  233. INCLUDES += /usr/local/include
  234. endif
  235. LIBS = m z
  236. ifneq ($(wildcard /usr/local/ssl/lib),)
  237. LDFLAGS += -L/usr/local/ssl/lib
  238. endif
  239. ifneq ($(wildcard /opt/local/lib),)
  240. LDFLAGS += -L/opt/local/lib
  241. endif
  242. ifneq ($(wildcard /usr/local/lib),)
  243. LDFLAGS += -L/usr/local/lib
  244. endif
  245. endif
  246. ifeq ($(SYSTEM),Linux)
  247. LIBS = dl rt m pthread
  248. LDFLAGS += -pthread
  249. endif
  250. ifeq ($(SYSTEM),MINGW32)
  251. LIBS = m pthread ws2_32 dbghelp
  252. LDFLAGS += -pthread
  253. endif
  254. #
  255. # The steps for cross-compiling are as follows:
  256. # First, clone and make install of grpc using the native compilers for the host.
  257. # Also, install protoc (e.g., from a package like apt-get)
  258. # Then clone a fresh grpc for the actual cross-compiled build
  259. # Set the environment variable GRPC_CROSS_COMPILE to true
  260. # Set CC, CXX, LD, LDXX, AR, and STRIP to the cross-compiling binaries
  261. # Also set PROTOBUF_CONFIG_OPTS to indicate cross-compilation to protobuf (e.g.,
  262. # PROTOBUF_CONFIG_OPTS="--host=arm-linux --with-protoc=/usr/local/bin/protoc" )
  263. # Set HAS_PKG_CONFIG=false
  264. # To build tests, go to third_party/gflags and follow its ccmake instructions
  265. # Make sure that you enable building shared libraries and set your prefix to
  266. # something useful like /usr/local/cross
  267. # You will also need to set GRPC_CROSS_LDOPTS and GRPC_CROSS_AROPTS to hold
  268. # additional required arguments for LD and AR (examples below)
  269. # Then you can do a make from the cross-compiling fresh clone!
  270. #
  271. ifeq ($(GRPC_CROSS_COMPILE),true)
  272. LDFLAGS += $(GRPC_CROSS_LDOPTS) # e.g. -L/usr/local/lib -L/usr/local/cross/lib
  273. ARFLAGS += $(GRPC_CROSS_AROPTS) # e.g., rc --target=elf32-little
  274. USE_BUILT_PROTOC = false
  275. endif
  276. # V=1 can be used to print commands run by make
  277. ifeq ($(V),1)
  278. E = @:
  279. Q =
  280. else
  281. E = @echo
  282. Q = @
  283. endif
  284. CORE_VERSION = ${settings.core_version}
  285. CPP_VERSION = ${settings.cpp_version}
  286. CSHARP_VERSION = ${settings.csharp_version}
  287. CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
  288. CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
  289. LDFLAGS += $(ARCH_FLAGS)
  290. LDLIBS += $(addprefix -l, $(LIBS))
  291. LDLIBSXX += $(addprefix -l, $(LIBSXX))
  292. % for arg in ['CFLAGS', 'CXXFLAGS', 'CPPFLAGS', 'LDFLAGS', 'DEFINES', 'LDLIBS']:
  293. ${arg} += $(EXTRA_${arg})
  294. % endfor
  295. HOST_CPPFLAGS += $(CPPFLAGS)
  296. HOST_CFLAGS += $(CFLAGS)
  297. HOST_CXXFLAGS += $(CXXFLAGS)
  298. HOST_LDFLAGS += $(LDFLAGS)
  299. HOST_LDLIBS += $(LDLIBS)
  300. # These are automatically computed variables.
  301. # There shouldn't be any need to change anything from now on.
  302. -include cache.mk
  303. CACHE_MK =
  304. ifeq ($(SYSTEM),MINGW32)
  305. EXECUTABLE_SUFFIX = .exe
  306. SHARED_EXT_CORE = dll
  307. SHARED_EXT_CPP = dll
  308. SHARED_EXT_CSHARP = dll
  309. SHARED_PREFIX =
  310. SHARED_VERSION_CORE = -${settings.core_version.major}
  311. SHARED_VERSION_CPP = -${settings.cpp_version.major}
  312. SHARED_VERSION_CSHARP = -${settings.csharp_version.major}
  313. else ifeq ($(SYSTEM),Darwin)
  314. EXECUTABLE_SUFFIX =
  315. SHARED_EXT_CORE = dylib
  316. SHARED_EXT_CPP = dylib
  317. SHARED_EXT_CSHARP = dylib
  318. SHARED_PREFIX = lib
  319. SHARED_VERSION_CORE =
  320. SHARED_VERSION_CPP =
  321. SHARED_VERSION_CSHARP =
  322. else
  323. EXECUTABLE_SUFFIX =
  324. SHARED_EXT_CORE = so.$(CORE_VERSION)
  325. SHARED_EXT_CPP = so.$(CPP_VERSION)
  326. SHARED_EXT_CSHARP = so.$(CSHARP_VERSION)
  327. SHARED_PREFIX = lib
  328. SHARED_VERSION_CORE =
  329. SHARED_VERSION_CPP =
  330. SHARED_VERSION_CSHARP =
  331. endif
  332. ifeq ($(wildcard .git),)
  333. IS_GIT_FOLDER = false
  334. else
  335. IS_GIT_FOLDER = true
  336. endif
  337. # Setup zlib dependency
  338. ifeq ($(wildcard third_party/zlib/zlib.h),)
  339. HAS_EMBEDDED_ZLIB = false
  340. else
  341. HAS_EMBEDDED_ZLIB = true
  342. endif
  343. # for zlib, we support building both from submodule
  344. # and from system-installed zlib. In some builds,
  345. # embedding zlib is not desirable.
  346. # By default we use the system zlib (to match legacy behavior)
  347. EMBED_ZLIB ?= false
  348. ifeq ($(EMBED_ZLIB),true)
  349. ZLIB_DEP = $(LIBDIR)/$(CONFIG)/libz.a
  350. ZLIB_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libz.a
  351. ZLIB_MERGE_OBJS = $(LIBZ_OBJS)
  352. CPPFLAGS += -Ithird_party/zlib
  353. else
  354. LIBS += z
  355. endif
  356. # Setup c-ares dependency
  357. ifeq ($(wildcard third_party/cares/cares/ares.h),)
  358. HAS_EMBEDDED_CARES = false
  359. else
  360. HAS_EMBEDDED_CARES = true
  361. endif
  362. ifeq ($(HAS_EMBEDDED_CARES),true)
  363. EMBED_CARES ?= true
  364. else
  365. # only building with c-ares from submodule is supported
  366. DEP_MISSING += cares
  367. EMBED_CARES ?= broken
  368. endif
  369. ifeq ($(EMBED_CARES),true)
  370. CARES_DEP = $(LIBDIR)/$(CONFIG)/libares.a
  371. CARES_MERGE_OBJS = $(LIBARES_OBJS)
  372. CARES_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libares.a
  373. CPPFLAGS := -Ithird_party/cares -Ithird_party/cares/cares $(CPPFLAGS)
  374. endif
  375. # Setup address_sorting dependency
  376. ADDRESS_SORTING_DEP = $(LIBDIR)/$(CONFIG)/libaddress_sorting.a
  377. ADDRESS_SORTING_MERGE_OBJS = $(LIBADDRESS_SORTING_OBJS)
  378. ADDRESS_SORTING_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libaddress_sorting.a
  379. CPPFLAGS := -Ithird_party/address_sorting/include $(CPPFLAGS)
  380. # Setup abseil dependency
  381. GRPC_ABSEIL_DEP = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a
  382. GRPC_ABSEIL_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a
  383. ifeq ($(HOST_IS_X86_64),true)
  384. ABSL_RANDOM_HWAES_FLAGS = -maes -msse4
  385. else
  386. ABSL_RANDOM_HWAES_FLAGS =
  387. endif
  388. # Setup re2 dependency
  389. RE2_DEP = $(LIBDIR)/$(CONFIG)/libre2.a
  390. RE2_MERGE_OBJS = $(LIBRE2_OBJS)
  391. RE2_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libre2.a
  392. # Setup upb dependency
  393. UPB_DEP = $(LIBDIR)/$(CONFIG)/libupb.a
  394. UPB_MERGE_OBJS = $(LIBUPB_OBJS)
  395. UPB_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libupb.a
  396. # Setup boringssl dependency
  397. ifeq ($(wildcard third_party/boringssl-with-bazel/src/include/openssl/ssl.h),)
  398. HAS_EMBEDDED_OPENSSL = false
  399. else
  400. HAS_EMBEDDED_OPENSSL = true
  401. endif
  402. ifeq ($(HAS_EMBEDDED_OPENSSL),true)
  403. EMBED_OPENSSL ?= true
  404. else
  405. # only support building boringssl from submodule
  406. DEP_MISSING += openssl
  407. EMBED_OPENSSL ?= broken
  408. endif
  409. ifeq ($(EMBED_OPENSSL),true)
  410. OPENSSL_DEP += $(LIBDIR)/$(CONFIG)/libboringssl.a
  411. OPENSSL_MERGE_LIBS += $(LIBDIR)/$(CONFIG)/libboringssl.a
  412. OPENSSL_MERGE_OBJS += $(LIBBORINGSSL_OBJS)
  413. # need to prefix these to ensure overriding system libraries
  414. CPPFLAGS := -Ithird_party/boringssl-with-bazel/src/include $(CPPFLAGS)
  415. ifeq ($(DISABLE_ALPN),true)
  416. CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0
  417. LIBS_SECURE = $(OPENSSL_LIBS)
  418. endif # DISABLE_ALPN
  419. endif # EMBED_OPENSSL
  420. LDLIBS_SECURE += $(addprefix -l, $(LIBS_SECURE))
  421. ifeq ($(MAKECMDGOALS),clean)
  422. NO_DEPS = true
  423. endif
  424. .SECONDARY = %.pb.h %.pb.cc
  425. ifeq ($(DEP_MISSING),)
  426. all: static shared\
  427. % for tgt in filtered_targets:
  428. % if tgt.build == 'all':
  429. $(BINDIR)/$(CONFIG)/${tgt.name}\
  430. % endif
  431. % endfor
  432. dep_error:
  433. @echo "You shouldn't see this message - all of your dependencies are correct."
  434. else
  435. all: dep_error git_update stop
  436. dep_error:
  437. @echo
  438. @echo "DEPENDENCY ERROR"
  439. @echo
  440. @echo "You are missing system dependencies that are essential to build grpc,"
  441. @echo "and the third_party directory doesn't have them:"
  442. @echo
  443. @echo " $(DEP_MISSING)"
  444. @echo
  445. @echo "Installing the development packages for your system will solve"
  446. @echo "this issue. Please consult INSTALL to get more information."
  447. @echo
  448. @echo "If you need information about why these tests failed, run:"
  449. @echo
  450. @echo " make run_dep_checks"
  451. @echo
  452. endif
  453. git_update:
  454. ifeq ($(IS_GIT_FOLDER),true)
  455. @echo "Additionally, since you are in a git clone, you can download the"
  456. @echo "missing dependencies in third_party by running the following command:"
  457. @echo
  458. @echo " git submodule update --init"
  459. @echo
  460. endif
  461. openssl_dep_error: openssl_dep_message git_update stop
  462. openssl_dep_message:
  463. @echo
  464. @echo "DEPENDENCY ERROR"
  465. @echo
  466. @echo "The target you are trying to run requires an OpenSSL implementation."
  467. @echo "Your system doesn't have one, and either the third_party directory"
  468. @echo "doesn't have it, or your compiler can't build BoringSSL."
  469. @echo
  470. @echo "Please consult BUILDING.md to get more information."
  471. @echo
  472. @echo "If you need information about why these tests failed, run:"
  473. @echo
  474. @echo " make run_dep_checks"
  475. @echo
  476. systemtap_dep_error:
  477. @echo
  478. @echo "DEPENDENCY ERROR"
  479. @echo
  480. @echo "Under the '$(CONFIG)' configutation, the target you are trying "
  481. @echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other "
  482. @echo "platforms such as Solaris and *BSD). "
  483. @echo
  484. @echo "Please consult BUILDING.md to get more information."
  485. @echo
  486. install_not_supported_message:
  487. @echo
  488. @echo "Installing via 'make' is no longer supported. Use cmake or bazel instead."
  489. @echo
  490. @echo "Please consult BUILDING.md to get more information."
  491. @echo
  492. install_not_supported_error: install_not_supported_message stop
  493. stop:
  494. @false
  495. % for tgt in filtered_targets:
  496. ${tgt.name}: $(BINDIR)/$(CONFIG)/${tgt.name}
  497. % endfor
  498. run_dep_checks:
  499. @echo "run_dep_checks target has been deprecated."
  500. static: static_c static_cxx
  501. static_c: cache.mk \
  502. % for lib in filtered_libs:
  503. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  504. % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None):
  505. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
  506. % endif
  507. % endif
  508. % endfor
  509. static_cxx: cache.mk \
  510. % for lib in filtered_libs:
  511. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  512. % if lib.build == 'all' and lib.language == 'c++':
  513. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
  514. % endif
  515. % endif
  516. % endfor
  517. static_csharp: static_c \
  518. % for lib in filtered_libs:
  519. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  520. % if lib.build == 'all' and lib.language == 'csharp':
  521. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
  522. % endif
  523. % endif
  524. % endfor
  525. shared: shared_c shared_cxx
  526. shared_c: cache.mk\
  527. % for lib in filtered_libs:
  528. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  529. % if lib.build == 'all' and lib.language == 'c' and not lib.get('external_deps', None):
  530. $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)\
  531. % endif
  532. % endif
  533. % endfor
  534. shared_cxx: cache.mk\
  535. % for lib in filtered_libs:
  536. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  537. % if lib.build == 'all' and lib.language == 'c++':
  538. $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)\
  539. % endif
  540. % endif
  541. % endfor
  542. shared_csharp: shared_c \
  543. % for lib in filtered_libs:
  544. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  545. % if lib.build == 'all' and lib.language == 'csharp':
  546. $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)\
  547. % endif
  548. % endif
  549. % endfor
  550. grpc_csharp_ext: shared_csharp
  551. privatelibs: privatelibs_c privatelibs_cxx
  552. privatelibs_c: \
  553. % for lib in filtered_libs:
  554. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  555. % if lib.build == 'private' and lib.language == 'c' and not lib.get('external_deps', None) and not lib.boringssl:
  556. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
  557. % endif
  558. % endif
  559. % endfor
  560. ifeq ($(EMBED_OPENSSL),true)
  561. privatelibs_cxx: \
  562. % for lib in filtered_libs:
  563. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  564. % if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None):
  565. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
  566. % endif
  567. % endif
  568. % endfor
  569. else
  570. privatelibs_cxx: \
  571. % for lib in filtered_libs:
  572. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  573. % if lib.build == 'private' and lib.language == 'c++' and not lib.get('external_deps', None) and not lib.boringssl:
  574. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a\
  575. % endif
  576. % endif
  577. % endfor
  578. endif
  579. strip: strip-static strip-shared
  580. strip-static: strip-static_c strip-static_cxx
  581. strip-shared: strip-shared_c strip-shared_cxx
  582. strip-static_c: static_c
  583. ifeq ($(CONFIG),opt)
  584. % for lib in filtered_libs:
  585. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  586. % if lib.language == "c":
  587. % if lib.build == "all":
  588. % if not lib.get('external_deps', None):
  589. $(E) "[STRIP] Stripping lib${lib.name}.a"
  590. $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
  591. % endif
  592. % endif
  593. % endif
  594. % endif
  595. % endfor
  596. endif
  597. strip-static_cxx: static_cxx
  598. ifeq ($(CONFIG),opt)
  599. % for lib in filtered_libs:
  600. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  601. % if lib.language == "c++":
  602. % if lib.build == "all":
  603. $(E) "[STRIP] Stripping lib${lib.name}.a"
  604. $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
  605. % endif
  606. % endif
  607. % endif
  608. % endfor
  609. endif
  610. strip-shared_c: shared_c
  611. ifeq ($(CONFIG),opt)
  612. % for lib in filtered_libs:
  613. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  614. % if lib.language == "c":
  615. % if lib.build == "all":
  616. % if not lib.get('external_deps', None):
  617. $(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)"
  618. $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CORE).$(SHARED_EXT_CORE)
  619. % endif
  620. % endif
  621. % endif
  622. % endif
  623. % endfor
  624. endif
  625. strip-shared_cxx: shared_cxx
  626. ifeq ($(CONFIG),opt)
  627. % for lib in filtered_libs:
  628. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  629. % if lib.language == "c++":
  630. % if lib.build == "all":
  631. $(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)"
  632. $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CPP).$(SHARED_EXT_CPP)
  633. % endif
  634. % endif
  635. % endif
  636. % endfor
  637. endif
  638. strip-shared_csharp: shared_csharp
  639. ifeq ($(CONFIG),opt)
  640. % for lib in filtered_libs:
  641. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  642. % if lib.language == "csharp":
  643. % if lib.build == "all":
  644. $(E) "[STRIP] Stripping $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)"
  645. $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_CSHARP).$(SHARED_EXT_CSHARP)
  646. % endif
  647. % endif
  648. % endif
  649. % endfor
  650. endif
  651. cache.mk::
  652. $(E) "[MAKE] Generating $@"
  653. $(Q) echo "$(CACHE_MK)" | tr , '\n' >$@
  654. ifeq ($(CONFIG),stapprof)
  655. src/core/profiling/stap_timers.c: $(GENDIR)/src/core/profiling/stap_probes.h
  656. ifeq ($(HAS_SYSTEMTAP),true)
  657. $(GENDIR)/src/core/profiling/stap_probes.h: src/core/profiling/stap_probes.d
  658. $(E) "[DTRACE] Compiling $<"
  659. $(Q) mkdir -p `dirname $@`
  660. $(Q) $(DTRACE) -C -h -s $< -o $@
  661. else
  662. $(GENDIR)/src/core/profiling/stap_probes.h: systemtap_dep_error stop
  663. endif
  664. endif
  665. $(OBJDIR)/$(CONFIG)/%.o : %.c
  666. $(E) "[C] Compiling $<"
  667. $(Q) mkdir -p `dirname $@`
  668. $(Q) $(CC) $(CPPFLAGS) $(CFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
  669. $(OBJDIR)/$(CONFIG)/%.o : $(GENDIR)/%.pb.cc
  670. $(E) "[CXX] Compiling $<"
  671. $(Q) mkdir -p `dirname $@`
  672. $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
  673. $(OBJDIR)/$(CONFIG)/src/compiler/%.o : src/compiler/%.cc
  674. $(E) "[HOSTCXX] Compiling $<"
  675. $(Q) mkdir -p `dirname $@`
  676. $(Q) $(HOST_CXX) $(HOST_CXXFLAGS) $(HOST_CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
  677. $(OBJDIR)/$(CONFIG)/src/core/%.o : src/core/%.cc
  678. $(E) "[CXX] Compiling $<"
  679. $(Q) mkdir -p `dirname $@`
  680. $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(COREFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
  681. $(OBJDIR)/$(CONFIG)/test/core/%.o : test/core/%.cc
  682. $(E) "[CXX] Compiling $<"
  683. $(Q) mkdir -p `dirname $@`
  684. $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(COREFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
  685. $(OBJDIR)/$(CONFIG)/%.o : %.cc
  686. $(E) "[CXX] Compiling $<"
  687. $(Q) mkdir -p `dirname $@`
  688. $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
  689. $(OBJDIR)/$(CONFIG)/%.o : %.cpp
  690. $(E) "[CXX] Compiling $<"
  691. $(Q) mkdir -p `dirname $@`
  692. $(Q) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $<
  693. install: install_not_supported_error
  694. install_c: install_not_supported_error
  695. install_cxx: install_not_supported_error
  696. install_csharp: install_not_supported_error
  697. install-static: install_not_supported_error
  698. install-certs: install_not_supported_error
  699. clean:
  700. $(E) "[CLEAN] Cleaning build directories."
  701. $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) cache.mk
  702. # The various libraries
  703. % for lib in filtered_libs:
  704. % if 'Makefile' in lib.get('build_system', ['Makefile']):
  705. ${makelib(lib)}
  706. % endif
  707. % endfor
  708. # Add private ABSEIL target which contains all sources used by all baselib libraries.
  709. <%
  710. # Collect all abseil source and header files used by gpr, grpc, so on.
  711. used_abseil_rules = set()
  712. for lib in libs:
  713. if lib.get("baselib"):
  714. for dep in lib.transitive_deps:
  715. if is_absl_lib(dep):
  716. used_abseil_rules.add(dep)
  717. used_abseil_srcs = []
  718. used_abseil_hdrs = []
  719. for lib in libs:
  720. if lib.name in used_abseil_rules:
  721. used_abseil_srcs.extend(lib.get("src", []))
  722. used_abseil_hdrs.extend(lib.get("hdr", []))
  723. # Create `grpc_abseil` rule with collected files.
  724. lib_type = type(libs[0])
  725. grpc_abseil_lib = lib_type({
  726. "name": "grpc_abseil",
  727. "build": "private",
  728. "language": "c",
  729. "defaults": "abseil",
  730. "src": sorted(used_abseil_srcs),
  731. "hdr": sorted(used_abseil_hdrs),
  732. })
  733. %>
  734. ${makelib(grpc_abseil_lib)}
  735. <%def name="makelib(lib)">
  736. # start of build recipe for library "${lib.name}" (generated by makelib(lib) template function)
  737. LIB${lib.name.upper()}_SRC = \\
  738. % for src in lib.src:
  739. ${src} \\
  740. % endfor
  741. % if "public_headers" in lib:
  742. % if lib.language == "c++":
  743. PUBLIC_HEADERS_CXX += \\
  744. % else:
  745. PUBLIC_HEADERS_C += \\
  746. % endif
  747. % for hdr in lib.public_headers:
  748. ${hdr} \\
  749. % endfor
  750. % endif
  751. LIB${lib.name.upper()}_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIB${lib.name.upper()}_SRC))))
  752. % if lib.get('defaults', None):
  753. % for name, value in defaults.get(lib.defaults).items():
  754. $(LIB${lib.name.upper()}_OBJS): ${name} += ${value}
  755. % endfor
  756. % endif
  757. ## If the library requires OpenSSL, let's add some restrictions.
  758. % if 'libssl' in lib.get('deps', []):
  759. ifeq ($(NO_SECURE),true)
  760. # You can't build secure libraries if you don't have OpenSSL.
  761. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: openssl_dep_error
  762. % if lib.build == "all":
  763. $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}): openssl_dep_error
  764. % endif
  765. else
  766. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: $(ZLIB_DEP) $(OPENSSL_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(RE2_DEP) $(UPB_DEP) $(GRPC_ABSEIL_DEP) \
  767. ## The else here corresponds to the if secure earlier.
  768. % else:
  769. $(LIBDIR)/$(CONFIG)/lib${lib.name}.a: \
  770. % if lib.name not in ['z', 'ares', 'address_sorting', 're2', 'upb', 'grpc_abseil']:
  771. $(ZLIB_DEP) \
  772. $(CARES_DEP) \
  773. $(ADDRESS_SORTING_DEP) \
  774. $(RE2_DEP) \
  775. $(UPB_DEP) \
  776. $(GRPC_ABSEIL_DEP) \
  777. % endif
  778. % endif
  779. $(LIB${lib.name.upper()}_OBJS) \
  780. % if lib.get('baselib', False):
  781. $(LIBGPR_OBJS) \
  782. $(LIBGRPC_ABSEIL_OBJS) \
  783. $(ZLIB_MERGE_OBJS) \
  784. $(CARES_MERGE_OBJS) \
  785. $(ADDRESS_SORTING_MERGE_OBJS) \
  786. $(RE2_MERGE_OBJS) \
  787. $(UPB_MERGE_OBJS) \
  788. % if 'libssl' in lib.get('deps', []):
  789. $(OPENSSL_MERGE_OBJS) \
  790. % endif
  791. % endif
  792. $(E) "[AR] Creating $@"
  793. $(Q) mkdir -p `dirname $@`
  794. $(Q) rm -f $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
  795. $(Q) $(AR) $(ARFLAGS) $(LIBDIR)/$(CONFIG)/lib${lib.name}.a $(LIB${lib.name.upper()}_OBJS) \
  796. % if lib.get('baselib', False):
  797. $(LIBGPR_OBJS) \
  798. $(LIBGRPC_ABSEIL_OBJS) \
  799. $(ZLIB_MERGE_OBJS) \
  800. $(CARES_MERGE_OBJS) \
  801. $(ADDRESS_SORTING_MERGE_OBJS) \
  802. $(RE2_MERGE_OBJS) \
  803. $(UPB_MERGE_OBJS) \
  804. % if 'libssl' in lib.get('deps', []):
  805. $(OPENSSL_MERGE_OBJS) \
  806. % endif
  807. % endif
  808. ifeq ($(SYSTEM),Darwin)
  809. $(Q) ranlib -no_warning_for_no_symbols $(LIBDIR)/$(CONFIG)/lib${lib.name}.a
  810. endif
  811. <%
  812. ld = '$(LDXX)'
  813. out_mingbase = '$(LIBDIR)/$(CONFIG)/' + lib.name + '$(SHARED_VERSION_' + lang_to_var[lib.language] + ')'
  814. out_libbase = '$(LIBDIR)/$(CONFIG)/lib' + lib.name + '$(SHARED_VERSION_' + lang_to_var[lib.language] + ')'
  815. common = '$(LIB' + lib.name.upper() + '_OBJS)'
  816. link_libs = ''
  817. lib_deps = ' $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(RE2_DEP) $(UPB_DEP) $(GRPC_ABSEIL_DEP)'
  818. mingw_libs = ''
  819. mingw_lib_deps = ' $(ZLIB_DEP) $(CARES_DEP) $(ADDRESS_SORTING_DEP) $(RE2_DEP) $(UPB_DEP) $(GRPC_ABSEIL_DEP)'
  820. for dep in lib.get('deps', []):
  821. if is_absl_lib(dep): continue
  822. if 'libssl' == dep: continue
  823. lib_archive = '$(LIBDIR)/$(CONFIG)/lib' + dep + '.a'
  824. common = common + ' ' + lib_archive
  825. lib_deps = lib_deps + ' ' + lib_archive
  826. mingw_lib_deps = mingw_lib_deps + ' ' + lib_archive
  827. security = 'libssl' in lib.get('deps', [])
  828. if security == True:
  829. common = common + ' $(OPENSSL_MERGE_LIBS) $(LDLIBS_SECURE)'
  830. common = common + ' $(ZLIB_MERGE_LIBS) $(CARES_MERGE_LIBS) $(ADDRESS_SORTING_MERGE_LIBS) $(RE2_MERGE_LIBS) $(UPB_MERGE_LIBS) $(GRPC_ABSEIL_MERGE_LIBS)'
  831. if security in [True, 'check']:
  832. for src in lib.src:
  833. sources_that_need_openssl.add(src)
  834. else:
  835. for src in lib.src:
  836. sources_that_don_t_need_openssl.add(src)
  837. if 'libssl' in lib.get('deps', []):
  838. lib_deps = lib_deps + ' $(OPENSSL_DEP)'
  839. mingw_lib_deps = mingw_lib_deps + ' $(OPENSSL_DEP)'
  840. ldflags = '$(LDFLAGS)'
  841. if lib.get('LDFLAGS', None):
  842. ldflags += ' ' + lib['LDFLAGS']
  843. common = common + ' $(LDLIBS)'
  844. %>
  845. % if lib.build == "all":
  846. ifeq ($(SYSTEM),MINGW32)
  847. ${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}): $(LIB${lib.name.upper()}_OBJS) ${mingw_lib_deps}
  848. $(E) "[LD] Linking $@"
  849. $(Q) mkdir -p `dirname $@`
  850. $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,--output-def=${out_mingbase}.def -Wl,--out-implib=${out_libbase}-dll.a -o ${out_mingbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${mingw_libs}
  851. else
  852. ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}): $(LIB${lib.name.upper()}_OBJS) ${lib_deps}
  853. $(E) "[LD] Linking $@"
  854. $(Q) mkdir -p `dirname $@`
  855. ifeq ($(SYSTEM),Darwin)
  856. $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) -dynamiclib -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs}
  857. else
  858. $(Q) ${ld} ${ldflags} -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,lib${lib.name}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major} -o ${out_libbase}.$(SHARED_EXT_${lang_to_var[lib.language]}) ${common}${link_libs}
  859. $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so.${settings.get(lang_to_var[lib.language].lower() + '_version').major}
  860. $(Q) ln -sf $(SHARED_PREFIX)${lib.name}$(SHARED_VERSION_${lang_to_var[lib.language]}).$(SHARED_EXT_${lang_to_var[lib.language]}) ${out_libbase}.so
  861. endif
  862. endif
  863. % endif
  864. % if 'libssl' in lib.get('deps', []):
  865. ## If the lib was secure, we have to close the Makefile's if that tested
  866. ## the presence of OpenSSL.
  867. endif
  868. % endif
  869. % if 'libssl' in lib.get('deps', []):
  870. ifneq ($(NO_SECURE),true)
  871. % endif
  872. ifneq ($(NO_DEPS),true)
  873. -include $(LIB${lib.name.upper()}_OBJS:.o=.dep)
  874. endif
  875. % if 'libssl' in lib.get('deps', []):
  876. endif
  877. % endif
  878. # end of build recipe for library "${lib.name}"
  879. </%def>
  880. # TODO(jtattermusch): is there a way to get around this hack?
  881. ifneq ($(OPENSSL_DEP),)
  882. # This is to ensure the embedded OpenSSL is built beforehand, properly
  883. # installing headers to their final destination on the drive. We need this
  884. # otherwise parallel compilation will fail if a source is compiled first.
  885. % for src in sorted(sources_that_need_openssl):
  886. % if src not in sources_that_don_t_need_openssl:
  887. ${src}: $(OPENSSL_DEP)
  888. % endif
  889. % endfor
  890. endif
  891. .PHONY: all strip tools \
  892. dep_error openssl_dep_error openssl_dep_message git_update stop \
  893. buildtests buildtests_c buildtests_cxx \
  894. test test_c test_cxx \
  895. install install_c install_cxx install_csharp install-static install-certs \
  896. strip strip-shared strip-static \
  897. strip_c strip-shared_c strip-static_c \
  898. strip_cxx strip-shared_cxx strip-static_cxx \
  899. dep_c dep_cxx bins_dep_c bins_dep_cxx \
  900. clean
  901. .PHONY: printvars
  902. printvars:
  903. @$(foreach V,$(sort $(.VARIABLES)), \
  904. $(if $(filter-out environment% default automatic, \
  905. $(origin $V)),$(warning $V=$($V) ($(value $V)))))