Makefile.in 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. #
  2. # This Source Code Form is subject to the terms of the Mozilla Public
  3. # License, v. 2.0. If a copy of the MPL was not distributed with this
  4. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  5. CC_WRAPPER =
  6. CXX_WRAPPER =
  7. default::
  8. include $(topsrcdir)/config/makefiles/functions.mk
  9. NSS_LIBS = \
  10. nss3 \
  11. nssutil3 \
  12. smime3 \
  13. ssl3 \
  14. $(NULL)
  15. ifdef MOZ_FOLD_LIBS
  16. NSS_DLLS = $(LIBRARY_NAME)
  17. else
  18. NSS_DLLS = $(NSS_LIBS)
  19. endif
  20. NSS_EXTRA_DLLS = \
  21. nssckbi \
  22. softokn3 \
  23. $(NULL)
  24. ifndef NSS_DISABLE_DBM
  25. NSS_EXTRA_DLLS += nssdbm3
  26. endif
  27. SDK_LIBS = crmf
  28. ifneq (,$(filter WINNT,$(OS_ARCH)))
  29. SDK_LIBS += $(NSS_DLLS)
  30. endif
  31. # Default
  32. HAVE_FREEBL_LIBS = 1
  33. # SunOS SPARC
  34. ifeq ($(OS_ARCH), SunOS)
  35. ifneq (86,$(findstring 86,$(OS_TEST)))
  36. ifdef HAVE_64BIT_BUILD
  37. HAVE_FREEBL_LIBS =
  38. HAVE_FREEBL_LIBS_64 = 1
  39. else
  40. HAVE_FREEBL_LIBS =
  41. HAVE_FREEBL_LIBS_32FPU = 1
  42. HAVE_FREEBL_LIBS_32INT64 = 1
  43. endif
  44. endif
  45. endif
  46. ifeq ($(OS_TARGET),Linux)
  47. HAVE_FREEBL_LIBS =
  48. HAVE_FREEBL_LIBS_PRIV = 1
  49. FREEBL_LOWHASH_FLAG = FREEBL_LOWHASH=1
  50. endif
  51. ifdef HAVE_FREEBL_LIBS
  52. NSS_EXTRA_DLLS += freebl3
  53. endif
  54. ifdef HAVE_FREEBL_LIBS_PRIV
  55. NSS_EXTRA_DLLS += freeblpriv3
  56. endif
  57. ifdef HAVE_FREEBL_LIBS_32INT32
  58. NSS_EXTRA_DLLS += freebl_32int_3
  59. endif
  60. ifdef HAVE_FREEBL_LIBS_32FPU
  61. NSS_EXTRA_DLLS += freebl_32fpu_3
  62. endif
  63. ifdef HAVE_FREEBL_LIBS_32INT64
  64. NSS_EXTRA_DLLS += freebl_32int64_3
  65. endif
  66. ifdef HAVE_FREEBL_LIBS_64
  67. NSS_EXTRA_DLLS += freebl_64int_3
  68. NSS_EXTRA_DLLS += freebl_64fpu_3
  69. endif
  70. # For all variables such as DLLFLAGS, that may contain $(DIST)
  71. DIST := $(ABS_DIST)
  72. # TODO: move this all to configure, but in Python
  73. ifndef MOZ_BUILD_NSPR
  74. NSPR_INCLUDE_DIR = $(firstword $(filter -I%,$(NSPR_CFLAGS)))
  75. ifneq (,$(strip $(NSPR_INCLUDE_DIR)))
  76. NSPR_INCLUDE_DIR := $(subst -I,,$(subst -I$(DIST),-I$(ABS_DIST),$(NSPR_INCLUDE_DIR)))
  77. else
  78. $(error Your NSPR CFLAGS are broken!)
  79. endif
  80. NSPR_LIB_DIR = $(firstword $(filter -L%,$(NSPR_LIBS)))
  81. ifneq (,$(strip $(NSPR_LIB_DIR)))
  82. NSPR_LIB_DIR := $(subst -L,,$(subst -L$(DIST),-L$(ABS_DIST),$(NSPR_LIB_DIR)))
  83. else
  84. $(error Your NSPR LDFLAGS are broken!)
  85. endif
  86. endif
  87. # To get debug symbols from NSS
  88. export MOZ_DEBUG_SYMBOLS
  89. DEFAULT_GMAKE_FLAGS =
  90. DEFAULT_GMAKE_FLAGS += CC='$(CC)'
  91. DEFAULT_GMAKE_FLAGS += MT='$(MT)'
  92. DEFAULT_GMAKE_FLAGS += LD='$(LD)'
  93. DEFAULT_GMAKE_FLAGS += SOURCE_MD_DIR=$(ABS_DIST)
  94. DEFAULT_GMAKE_FLAGS += SOURCE_MDHEADERS_DIR=$(NSPR_INCLUDE_DIR)
  95. DEFAULT_GMAKE_FLAGS += DIST=$(ABS_DIST)
  96. DEFAULT_GMAKE_FLAGS += NSPR_INCLUDE_DIR=$(NSPR_INCLUDE_DIR)
  97. DEFAULT_GMAKE_FLAGS += NSPR_LIB_DIR=$(NSPR_LIB_DIR)
  98. DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1
  99. DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1
  100. DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1
  101. DEFAULT_GMAKE_FLAGS += NSS_ENABLE_TLS_1_3=1
  102. ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1)
  103. DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS='-static-libgcc' NSPR31_LIB_PREFIX=lib
  104. endif
  105. DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=mozsqlite3
  106. DEFAULT_GMAKE_FLAGS += SQLITE_LIB_DIR=$(ABS_DIST)/../db/sqlite3/src
  107. DEFAULT_GMAKE_FLAGS += SQLITE_INCLUDE_DIR=$(ABS_DIST)/include
  108. ifdef NSS_DISABLE_DBM
  109. DEFAULT_GMAKE_FLAGS += NSS_DISABLE_DBM=1
  110. endif
  111. # Hack to force NSS build system to use "normal" object directories
  112. DEFAULT_GMAKE_FLAGS += topsrcdir='$(topsrcdir)'
  113. # topsrcdir can't be expanded here because msys path mangling likes to break
  114. # paths in that case.
  115. DEFAULT_GMAKE_FLAGS += BUILD='$(MOZ_BUILD_ROOT)/security/$$(subst $$(topsrcdir)/security/,,$$(CURDIR))'
  116. DEFAULT_GMAKE_FLAGS += BUILD_TREE='$$(BUILD)' OBJDIR='$$(BUILD)' DEPENDENCIES='$$(BUILD)/.deps' SINGLE_SHLIB_DIR='$$(BUILD)'
  117. DEFAULT_GMAKE_FLAGS += SOURCE_XP_DIR=$(ABS_DIST)
  118. ifndef MOZ_DEBUG
  119. DEFAULT_GMAKE_FLAGS += BUILD_OPT=1 OPT_CODE_SIZE=1
  120. endif
  121. ifdef GNU_CC
  122. DEFAULT_GMAKE_FLAGS += NS_USE_GCC=1
  123. else
  124. DEFAULT_GMAKE_FLAGS += NS_USE_GCC=
  125. endif
  126. ifdef USE_N32
  127. # It is not really necessary to specify USE_PTHREADS=1. USE_PTHREADS
  128. # merely adds _PTH to coreconf's OBJDIR name.
  129. DEFAULT_GMAKE_FLAGS += USE_N32=1 USE_PTHREADS=1
  130. endif
  131. ifdef HAVE_64BIT_BUILD
  132. DEFAULT_GMAKE_FLAGS += USE_64=1
  133. endif
  134. ifeq ($(OS_ARCH),WINNT)
  135. DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
  136. ifdef MOZ_DEBUG
  137. ifndef MOZ_NO_DEBUG_RTL
  138. DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
  139. endif
  140. endif
  141. endif # WINNT
  142. ifeq ($(OS_ARCH),Darwin)
  143. # Make nsinstall use absolute symlinks by default when building NSS
  144. # for Mozilla on Mac OS X. (Bugzilla bug 193164)
  145. ifndef NSDISTMODE
  146. DEFAULT_GMAKE_FLAGS += NSDISTMODE=absolute_symlink
  147. endif
  148. ifdef MACOS_SDK_DIR
  149. DEFAULT_GMAKE_FLAGS += MACOS_SDK_DIR=$(MACOS_SDK_DIR)
  150. endif
  151. endif
  152. # Turn off TLS compression support because it requires system zlib.
  153. # See bug 580679 comment 18.
  154. DEFAULT_GMAKE_FLAGS += NSS_SSL_ENABLE_ZLIB=
  155. # Disable building of the test programs in security/nss/lib/zlib
  156. DEFAULT_GMAKE_FLAGS += PROGRAMS=
  157. # Disable creating .chk files. They will be generated from packager.mk
  158. # When bug 681624 lands, we can replace CHECKLOC= with SKIP_SHLIBSIGN=1
  159. DEFAULT_GMAKE_FLAGS += CHECKLOC=
  160. ifdef CROSS_COMPILE
  161. DEFAULT_GMAKE_FLAGS += \
  162. NATIVE_CC='$(HOST_CC)' \
  163. CC='$(CC)' \
  164. CCC='$(CXX)' \
  165. AS='$(AS)' \
  166. AR='$(AR) $(AR_FLAGS:$@=$$@)' \
  167. RANLIB='$(RANLIB)' \
  168. RC='$(RC) $(RCFLAGS)' \
  169. OS_ARCH='$(OS_ARCH)' \
  170. OS_TEST='$(OS_TEST)' \
  171. CPU_ARCH='$(TARGET_CPU)' \
  172. $(NULL)
  173. # Android has pthreads integrated into -lc, so OS_PTHREAD is set to nothing
  174. ifeq ($(OS_TARGET), Android)
  175. DEFAULT_GMAKE_FLAGS += \
  176. OS_RELEASE='2.6' \
  177. OS_PTHREAD= \
  178. $(NULL)
  179. DEFAULT_GMAKE_FLAGS += ARCHFLAG='$(filter-out -W%,$(CFLAGS)) -DCHECK_FORK_GETPID $(addprefix -DANDROID_VERSION=,$(ANDROID_VERSION)) -include $(topsrcdir)/security/manager/android_stub.h'
  180. endif
  181. endif
  182. ifdef WRAP_LDFLAGS
  183. NSS_EXTRA_LDFLAGS += $(WRAP_LDFLAGS)
  184. endif
  185. # The SHARED_LIBS part is needed unconditionally on Android. It's not
  186. # clear why this is the case, but see bug 1133073 (starting around
  187. # comment #8) for context.
  188. ifneq (,$(or $(MOZ_GLUE_WRAP_LDFLAGS), $(filter Android, $(OS_TARGET))))
  189. NSS_EXTRA_LDFLAGS += $(SHARED_LIBS:$(DEPTH)%=$(MOZ_BUILD_ROOT)%) $(MOZ_GLUE_WRAP_LDFLAGS)
  190. endif
  191. ifneq (,$(NSS_EXTRA_LDFLAGS))
  192. DEFAULT_GMAKE_FLAGS += \
  193. LDFLAGS='$(LDFLAGS) $(NSS_EXTRA_LDFLAGS)' \
  194. DSO_LDOPTS='$(DSO_LDOPTS) $(LDFLAGS) $(NSS_EXTRA_LDFLAGS)' \
  195. $(NULL)
  196. endif
  197. DEFAULT_GMAKE_FLAGS += FREEBL_NO_DEPEND=0 $(FREEBL_LOWHASH_FLAG)
  198. DEFAULT_GMAKE_FLAGS += NSS_ALLOW_SSLKEYLOGFILE=1
  199. ifdef MOZ_NO_WLZDEFS
  200. DEFAULT_GMAKE_FLAGS += ZDEFS_FLAG=
  201. endif
  202. ifdef MOZ_CFLAGS_NSS
  203. NSS_XCFLAGS += $(filter-out -W%,$(CFLAGS))
  204. DEFAULT_GMAKE_FLAGS += DARWIN_DYLIB_VERSIONS='-compatibility_version 1 -current_version 1 $(LDFLAGS)'
  205. endif
  206. ifeq (1_1,$(CLANG_CL)_$(MOZ_ASAN))
  207. XLDFLAGS := $(OS_LDFLAGS)
  208. DEFAULT_GMAKE_FLAGS += XLDFLAGS='$(XLDFLAGS)'
  209. endif
  210. DEFAULT_GMAKE_FLAGS += NSS_NO_PKCS11_BYPASS=1
  211. # Put NSS headers directly under $(DIST)/include
  212. DEFAULT_GMAKE_FLAGS += PUBLIC_EXPORT_DIR='$(ABS_DIST)/include/$$(MODULE)'
  213. DEFAULT_GMAKE_FLAGS += SOURCE_XPHEADERS_DIR='$$(SOURCE_XP_DIR)/include/$$(MODULE)'
  214. DEFAULT_GMAKE_FLAGS += MODULE_INCLUDES='$$(addprefix -I$$(SOURCE_XP_DIR)/include/,$$(REQUIRES))'
  215. # Work around NSS's MAKE_OBJDIR being racy. See bug #836220
  216. DEFAULT_GMAKE_FLAGS += MAKE_OBJDIR='$$(INSTALL) -D $$(OBJDIR)'
  217. # Work around NSS adding IMPORT_LIBRARY to TARGETS with no rule for
  218. # it, creating race conditions. See bug #836220
  219. DEFAULT_GMAKE_FLAGS += TARGETS='$$(LIBRARY) $$(SHARED_LIBRARY) $$(PROGRAM)'
  220. ifdef MOZ_FOLD_LIBS_FLAGS
  221. NSS_XCFLAGS += $(MOZ_FOLD_LIBS_FLAGS)
  222. endif
  223. # Pass on the MSVC target arch from the main build system.
  224. # Note this is case- and switch-character sensitive, while
  225. # the MSVC option is not.
  226. ifeq (WINNT,$(OS_TARGET))
  227. NSS_XCFLAGS += $(filter -arch:%,$(CFLAGS))
  228. endif
  229. # Enable short header experiment. Firefox only.
  230. NSS_XCFLAGS += -DNSS_ENABLE_TLS13_SHORT_HEADERS
  231. # Export accumulated XCFLAGS to modify nss defaults.
  232. DEFAULT_GMAKE_FLAGS += XCFLAGS='$(NSS_XCFLAGS)'
  233. NSS_SRCDIR = $(topsrcdir)
  234. NSS_DIRS =
  235. ifndef MOZ_FOLD_LIBS
  236. NSS_DIRS += nss/lib
  237. else
  238. ifndef NSS_DISABLE_DBM
  239. NSS_DIRS += nss/lib/dbm
  240. endif
  241. endif
  242. NSS_DIRS += \
  243. nss/cmd/lib \
  244. nss/cmd/shlibsign \
  245. $(NULL)
  246. ifdef ENABLE_TESTS
  247. NSS_DIRS += \
  248. nss/cmd/certutil \
  249. nss/cmd/pk12util \
  250. nss/cmd/modutil \
  251. $(NULL)
  252. endif
  253. ifneq (,$(filter %--build-id,$(LDFLAGS)))
  254. DEFAULT_GMAKE_ENV = LDFLAGS=-Wl,--build-id
  255. endif
  256. ifdef MOZ_FOLD_LIBS
  257. # TODO: The following can be replaced by something simpler when bug 844880
  258. # is fixed.
  259. # All static libraries required for nss, smime, ssl and nssutil.
  260. # The strip is needed to remove potential linefeed characters, since they hang
  261. # around in some cases on Windows.
  262. NSS_STATIC_LIBS := $(strip $(shell $(MAKE) --no-print-directory -f $(srcdir)/nss.mk DEPTH='$(DEPTH)' topsrcdir='$(topsrcdir)' srcdir='$(srcdir)' echo-variable-libs))
  263. # Corresponding build directories
  264. NSS_STATIC_DIRS := $(foreach lib,$(NSS_STATIC_LIBS),$(patsubst %/,%,$(dir $(lib))))
  265. NSS_DIRS += $(NSS_STATIC_DIRS)
  266. # TODO: The following can be replaced by something simpler when bug 844884
  267. # is fixed.
  268. # Remaining nss/lib directories
  269. NSS_DIRS += nss/lib/freebl nss/lib/softoken nss/lib/jar nss/lib/crmf nss/lib/ckfw
  270. DEFAULT_GMAKE_FLAGS += NSS_DISABLE_LIBPKIX=1
  271. ifeq (WINNT,$(OS_TARGET))
  272. NSS_DIRS += nss/lib/zlib
  273. endif
  274. endif # MOZ_FOLD_LIBS
  275. # Filter-out $(LIBRARY_NAME) because it's already handled in config/rules.mk.
  276. NSS_DIST_DLL_FILES := $(addprefix $(DIST)/lib/$(DLL_PREFIX),$(addsuffix $(DLL_SUFFIX),$(filter-out $(LIBRARY_NAME),$(NSS_DLLS)) $(NSS_EXTRA_DLLS)))
  277. NSS_DIST_DLL_DEST := $(DIST)/bin
  278. NSS_DIST_DLL_TARGET := target
  279. INSTALL_TARGETS += NSS_DIST_DLL
  280. ifeq ($(OS_ARCH)_$(1), SunOS_softokn3)
  281. # has to use copy mode on Solaris, see #665509
  282. $(DIST)/bin/$(DLL_PREFIX)softokn3$(DLL_SUFFIX): INSTALL := $(NSINSTALL) -t
  283. endif
  284. NSS_SDK_LIB_FILES := \
  285. $(addprefix $(DIST)/lib/$(LIB_PREFIX),$(addsuffix .$(LIB_SUFFIX),$(SDK_LIBS))) \
  286. $(addprefix $(DIST)/bin/$(DLL_PREFIX),$(addsuffix $(DLL_SUFFIX),$(NSS_DLLS))) \
  287. $(NULL)
  288. NSS_SDK_LIB_DEST := $(DIST)/sdk/lib
  289. NSS_SDK_LIB_TARGET := target
  290. INSTALL_TARGETS += NSS_SDK_LIB
  291. ifdef MOZ_FOLD_LIBS
  292. # Add all static libraries for nss, smime, ssl and nssutil
  293. STATIC_LIBS += $(addprefix $(DEPTH)/security/,$(NSS_STATIC_LIBS))
  294. IMPORT_LIB_FILES = $(IMPORT_LIBRARY)
  295. IMPORT_LIB_DEST ?= $(DIST)/lib
  296. IMPORT_LIB_TARGET = target
  297. INSTALL_TARGETS += IMPORT_LIB
  298. endif # MOZ_FOLD_LIBS
  299. include $(topsrcdir)/config/rules.mk
  300. ifeq (1,$(ALLOW_COMPILER_WARNINGS))
  301. DEFAULT_GMAKE_FLAGS += NSS_ENABLE_WERROR=0
  302. endif
  303. # Can't pass this in DEFAULT_GMAKE_FLAGS because that overrides
  304. # definitions in NSS, so just export it into the sub-make's environment.
  305. ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_MEMORY))
  306. DLLFLAGS := -LIBPATH:$(ABS_DIST)/../mozglue/build -DEFAULTLIB:mozglue
  307. export DLLFLAGS
  308. endif
  309. ifdef MOZ_FOLD_LIBS
  310. # Force the linker to include everything from the static libraries.
  311. EXPAND_LIBS_EXEC += --extract
  312. $(SHARED_LIBRARY): $(addprefix $(DEPTH)/security/,$(NSS_STATIC_LIBS))
  313. ifdef IMPORT_LIB_SUFFIX
  314. IMPORT_PREFIX = $(LIB_PREFIX)
  315. IMPORT_SUFFIX = .$(IMPORT_LIB_SUFFIX)
  316. else
  317. IMPORT_PREFIX = $(DLL_PREFIX)
  318. IMPORT_SUFFIX = $(DLL_SUFFIX)
  319. endif
  320. NSPR_IMPORT_LIBS = $(addprefix $(DIST)/lib/$(IMPORT_PREFIX),$(addsuffix $(IMPORT_SUFFIX),nspr4 plc4 plds4))
  321. SQLITE_IMPORT_LIB = $(DIST)/lib/$(IMPORT_PREFIX)mozsqlite3$(IMPORT_SUFFIX)
  322. # TODO: The following can be replaced by something simpler when bug 844884
  323. # is fixed.
  324. # Associate target files with the rules that build them.
  325. $(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX): libs-nss/lib/crmf
  326. $(DIST)/lib/$(DLL_PREFIX)freebl3$(DLL_SUFFIX): libs-nss/lib/freebl
  327. $(DIST)/lib/$(DLL_PREFIX)nssckbi$(DLL_SUFFIX): libs-nss/lib/ckfw
  328. $(DIST)/lib/$(DLL_PREFIX)softokn3$(DLL_SUFFIX): libs-nss/lib/softoken
  329. $(DIST)/lib/$(DLL_PREFIX)nssdbm3$(DLL_SUFFIX): libs-nss/lib/softoken
  330. $(foreach lib,$(NSS_STATIC_LIBS),$(eval $(DEPTH)/security/$(lib): libs-$(patsubst %/,%,$(dir $(lib)))))
  331. # Create fake import libraries for the folded libraries, so that linking
  332. # against them works both for the NSS build system (see dependencies below)
  333. # and for the rest of the mozilla build system.
  334. $(NSPR_IMPORT_LIBS) \
  335. $(SQLITE_IMPORT_LIB) \
  336. $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) \
  337. $(DIST)/lib/$(IMPORT_PREFIX)ssl3$(IMPORT_SUFFIX) \
  338. $(DIST)/lib/$(IMPORT_PREFIX)smime3$(IMPORT_SUFFIX): $(DIST)/lib/$(IMPORT_PREFIX)nss3$(IMPORT_SUFFIX)
  339. ifeq (WINNT,$(OS_TARGET))
  340. cp $< $@
  341. else
  342. ln -sf $< $@
  343. endif
  344. # Interdependencies between nss sub-directories, and dependencies on NSPR/SQLite
  345. libs-nss/lib/ckfw: libs-nss/lib/nss/../base $(NSPR_IMPORT_LIBS)
  346. libs-nss/lib/softoken: $(NSPR_IMPORT_LIBS) $(SQLITE_IMPORT_LIB)
  347. libs-nss/lib/softoken: libs-nss/lib/freebl
  348. ifndef NSS_DISABLE_DBM
  349. libs-nss/lib/softoken: libs-nss/lib/dbm
  350. endif
  351. libs-nss/lib/softoken: $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX)
  352. libs-nss/lib/freebl: $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) $(NSPR_IMPORT_LIBS)
  353. # For each directory where we build static libraries, force the NSS build system
  354. # to only build static libraries.
  355. $(addprefix libs-,$(NSS_STATIC_DIRS)): DEFAULT_GMAKE_FLAGS += SHARED_LIBRARY= IMPORT_LIBRARY=
  356. else
  357. $(STATIC_LIBS) $(NSS_DIST_DLL_FILES) $(NSS_SDK_LIB_FILES): libs-nss/lib
  358. endif # MOZ_FOLD_LIBS
  359. ifeq ($(NSINSTALL_PY),$(NSINSTALL))
  360. DEFAULT_GMAKE_FLAGS += PYTHON='$(PYTHON)'
  361. DEFAULT_GMAKE_FLAGS += NSINSTALL_PY='$(abspath $(topsrcdir)/config/nsinstall.py)'
  362. DEFAULT_GMAKE_FLAGS += NSINSTALL='$$(PYTHON) $$(NSINSTALL_PY)'
  363. else
  364. DEFAULT_GMAKE_FLAGS += NSINSTALL='$(abspath $(NSINSTALL))'
  365. endif
  366. ifeq ($(OS_ARCH),WINNT)
  367. DEFAULT_GMAKE_FLAGS += INSTALL='$$(NSINSTALL) -t'
  368. endif
  369. DEFAULT_GMAKE_FLAGS += $(EXTRA_GMAKE_FLAGS)
  370. $(addprefix libs-,$(NSS_DIRS)): libs-%:
  371. # Work around NSS's export rule being racy when recursing for private_export
  372. # See bug #836220.
  373. $(addprefix export-,$(NSS_DIRS)): EXTRA_GMAKE_FLAGS = PRIVATE_EXPORTS=
  374. $(addprefix export-,$(NSS_DIRS)): export-%: private_export-%
  375. $(addprefix private_export-,$(NSS_DIRS)): EXTRA_GMAKE_FLAGS =
  376. $(addprefix private_export-,$(NSS_DIRS)): private_export-%:
  377. $(foreach p,libs export private_export,$(addprefix $(p)-,$(NSS_DIRS))):
  378. $(DEFAULT_GMAKE_ENV) $(MAKE) -C $(NSS_SRCDIR)/security/$* $(@:-$*=) $(DEFAULT_GMAKE_FLAGS)
  379. export:: $(addprefix export-,$(NSS_DIRS))
  380. $(addprefix clean-,$(NSS_DIRS)): clean-%:
  381. $(MAKE) -C $(NSS_SRCDIR)/security/$* $(DEFAULT_GMAKE_FLAGS) clean
  382. clean clobber clobber_all realclean distclean depend:: $(addprefix clean-,$(NSS_DIRS))
  383. NSS_CMD_TARGETS := $(addprefix libs-,$(filter-out nss/cmd/lib,$(filter nss/cmd/%,$(NSS_DIRS))))
  384. target:: $(NSS_CMD_TARGETS)
  385. ifdef MOZ_FOLD_LIBS
  386. $(NSS_CMD_TARGETS): $(addprefix $(DIST)/lib/$(IMPORT_PREFIX),$(addsuffix $(IMPORT_SUFFIX),$(NSS_LIBS)))
  387. libs-nss/cmd/modutil: libs-nss/lib/jar
  388. ifeq (WINNT,$(OS_TARGET))
  389. libs-nss/cmd/modutil: libs-nss/lib/zlib
  390. endif
  391. $(NSS_CMD_TARGETS): libs-nss/cmd/lib
  392. else
  393. $(NSS_CMD_TARGETS): libs-nss/lib libs-nss/cmd/lib
  394. endif # MOZ_FOLD_LIBS
  395. # Work around NSS build system race condition creating certdata.c in
  396. # security/nss/lib/ckfw/builtins. See bug #836220.
  397. libs-nss/lib$(if $(MOZ_FOLD_LIBS),/ckfw): $(call mkdir_deps,$(DEPTH)/security/nss/lib/ckfw/builtins)