Makefile.template 32 KB

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