Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | # |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | CC_WRAPPER = |
michael@0 | 7 | CXX_WRAPPER = |
michael@0 | 8 | |
michael@0 | 9 | default:: |
michael@0 | 10 | |
michael@0 | 11 | include $(topsrcdir)/config/makefiles/functions.mk |
michael@0 | 12 | |
michael@0 | 13 | NSS_LIBS = \ |
michael@0 | 14 | nss3 \ |
michael@0 | 15 | nssutil3 \ |
michael@0 | 16 | smime3 \ |
michael@0 | 17 | ssl3 \ |
michael@0 | 18 | $(NULL) |
michael@0 | 19 | |
michael@0 | 20 | ifdef MOZ_FOLD_LIBS |
michael@0 | 21 | NSS_DLLS = $(LIBRARY_NAME) |
michael@0 | 22 | else |
michael@0 | 23 | NSS_DLLS = $(NSS_LIBS) |
michael@0 | 24 | endif |
michael@0 | 25 | |
michael@0 | 26 | NSS_EXTRA_DLLS = \ |
michael@0 | 27 | nssckbi \ |
michael@0 | 28 | softokn3 \ |
michael@0 | 29 | $(NULL) |
michael@0 | 30 | |
michael@0 | 31 | ifndef NSS_DISABLE_DBM |
michael@0 | 32 | NSS_EXTRA_DLLS += nssdbm3 |
michael@0 | 33 | endif |
michael@0 | 34 | |
michael@0 | 35 | SDK_LIBS = crmf |
michael@0 | 36 | |
michael@0 | 37 | ifneq (,$(filter WINNT,$(OS_ARCH))) |
michael@0 | 38 | SDK_LIBS += $(NSS_DLLS) |
michael@0 | 39 | endif |
michael@0 | 40 | |
michael@0 | 41 | # Default |
michael@0 | 42 | HAVE_FREEBL_LIBS = 1 |
michael@0 | 43 | |
michael@0 | 44 | # 32-bit HP-UX PA-RISC |
michael@0 | 45 | ifeq ($(OS_ARCH), HP-UX) |
michael@0 | 46 | ifneq ($(OS_TEST), ia64) |
michael@0 | 47 | ifndef HAVE_64BIT_OS |
michael@0 | 48 | HAVE_FREEBL_LIBS = |
michael@0 | 49 | HAVE_FREEBL_LIBS_32INT32 = 1 |
michael@0 | 50 | HAVE_FREEBL_LIBS_32FPU = 1 |
michael@0 | 51 | endif |
michael@0 | 52 | endif |
michael@0 | 53 | endif |
michael@0 | 54 | |
michael@0 | 55 | # SunOS SPARC |
michael@0 | 56 | ifeq ($(OS_ARCH), SunOS) |
michael@0 | 57 | ifneq (86,$(findstring 86,$(OS_TEST))) |
michael@0 | 58 | ifdef HAVE_64BIT_OS |
michael@0 | 59 | HAVE_FREEBL_LIBS = |
michael@0 | 60 | HAVE_FREEBL_LIBS_64 = 1 |
michael@0 | 61 | else |
michael@0 | 62 | HAVE_FREEBL_LIBS = |
michael@0 | 63 | HAVE_FREEBL_LIBS_32FPU = 1 |
michael@0 | 64 | HAVE_FREEBL_LIBS_32INT64 = 1 |
michael@0 | 65 | endif |
michael@0 | 66 | endif |
michael@0 | 67 | endif |
michael@0 | 68 | |
michael@0 | 69 | ifdef HAVE_FREEBL_LIBS |
michael@0 | 70 | NSS_EXTRA_DLLS += freebl3 |
michael@0 | 71 | endif |
michael@0 | 72 | ifdef HAVE_FREEBL_LIBS_32INT32 |
michael@0 | 73 | NSS_EXTRA_DLLS += freebl_32int_3 |
michael@0 | 74 | endif |
michael@0 | 75 | ifdef HAVE_FREEBL_LIBS_32FPU |
michael@0 | 76 | NSS_EXTRA_DLLS += freebl_32fpu_3 |
michael@0 | 77 | endif |
michael@0 | 78 | ifdef HAVE_FREEBL_LIBS_32INT64 |
michael@0 | 79 | NSS_EXTRA_DLLS += freebl_32int64_3 |
michael@0 | 80 | endif |
michael@0 | 81 | ifdef HAVE_FREEBL_LIBS_64 |
michael@0 | 82 | NSS_EXTRA_DLLS += freebl_64int_3 |
michael@0 | 83 | NSS_EXTRA_DLLS += freebl_64fpu_3 |
michael@0 | 84 | endif |
michael@0 | 85 | |
michael@0 | 86 | ABS_DIST := $(abspath $(DIST)) |
michael@0 | 87 | ifeq ($(HOST_OS_ARCH),WINNT) |
michael@0 | 88 | ifdef CYGDRIVE_MOUNT |
michael@0 | 89 | ABS_DIST := $(shell cygpath -w $(ABS_DIST) | sed -e 's|\\|/|g') |
michael@0 | 90 | endif |
michael@0 | 91 | ifneq (,$(filter mingw%,$(host_os))) |
michael@0 | 92 | ABS_DIST := $(shell cd $(DIST) && pwd -W) |
michael@0 | 93 | endif |
michael@0 | 94 | endif |
michael@0 | 95 | # For all variables such as DLLFLAGS, that may contain $(DIST) |
michael@0 | 96 | DIST := $(ABS_DIST) |
michael@0 | 97 | NSPR_INCLUDE_DIR = $(firstword $(filter -I%,$(NSPR_CFLAGS))) |
michael@0 | 98 | ifneq (,$(strip $(NSPR_INCLUDE_DIR))) |
michael@0 | 99 | NSPR_INCLUDE_DIR := $(subst -I,,$(subst -I$(DIST),-I$(ABS_DIST),$(NSPR_INCLUDE_DIR))) |
michael@0 | 100 | else |
michael@0 | 101 | NSPR_INCLUDE_DIR = $(ABS_DIST)/include/nspr |
michael@0 | 102 | endif |
michael@0 | 103 | NSPR_LIB_DIR = $(firstword $(filter -L%,$(NSPR_LIBS))) |
michael@0 | 104 | ifneq (,$(strip $(NSPR_LIB_DIR))) |
michael@0 | 105 | NSPR_LIB_DIR := $(subst -L,,$(subst -L$(DIST),-L$(ABS_DIST),$(NSPR_LIB_DIR))) |
michael@0 | 106 | else |
michael@0 | 107 | NSPR_LIB_DIR = $(ABS_DIST)/lib |
michael@0 | 108 | endif |
michael@0 | 109 | # Can't pass this in DEFAULT_GMAKE_FLAGS because that overrides |
michael@0 | 110 | # definitions in NSS, so just export it into the sub-make's environment. |
michael@0 | 111 | ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_MEMORY)) |
michael@0 | 112 | export DLLFLAGS |
michael@0 | 113 | endif |
michael@0 | 114 | |
michael@0 | 115 | # To get debug symbols from NSS |
michael@0 | 116 | export MOZ_DEBUG_SYMBOLS |
michael@0 | 117 | |
michael@0 | 118 | DEFAULT_GMAKE_FLAGS = |
michael@0 | 119 | DEFAULT_GMAKE_FLAGS += CC='$(CC)' |
michael@0 | 120 | DEFAULT_GMAKE_FLAGS += SOURCE_MD_DIR=$(ABS_DIST) |
michael@0 | 121 | DEFAULT_GMAKE_FLAGS += SOURCE_MDHEADERS_DIR=$(NSPR_INCLUDE_DIR) |
michael@0 | 122 | DEFAULT_GMAKE_FLAGS += DIST=$(ABS_DIST) |
michael@0 | 123 | DEFAULT_GMAKE_FLAGS += NSPR_INCLUDE_DIR=$(NSPR_INCLUDE_DIR) |
michael@0 | 124 | DEFAULT_GMAKE_FLAGS += NSPR_LIB_DIR=$(NSPR_LIB_DIR) |
michael@0 | 125 | DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1 |
michael@0 | 126 | DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1 |
michael@0 | 127 | DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1 |
michael@0 | 128 | ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1) |
michael@0 | 129 | DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS='-static-libgcc' |
michael@0 | 130 | endif |
michael@0 | 131 | ifndef MOZ_NATIVE_SQLITE |
michael@0 | 132 | ifdef MOZ_FOLD_LIBS |
michael@0 | 133 | DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=nss3 |
michael@0 | 134 | else |
michael@0 | 135 | DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=mozsqlite3 |
michael@0 | 136 | endif # MOZ_FOLD_LIBS |
michael@0 | 137 | DEFAULT_GMAKE_FLAGS += SQLITE_INCLUDE_DIR=$(ABS_DIST)/include |
michael@0 | 138 | endif |
michael@0 | 139 | ifdef NSS_DISABLE_DBM |
michael@0 | 140 | DEFAULT_GMAKE_FLAGS += NSS_DISABLE_DBM=1 |
michael@0 | 141 | endif |
michael@0 | 142 | # Hack to force NSS build system to use "normal" object directories |
michael@0 | 143 | DEFAULT_GMAKE_FLAGS += topsrcdir='$(topsrcdir)' |
michael@0 | 144 | # topsrcdir can't be expanded here because msys path mangling likes to break |
michael@0 | 145 | # paths in that case. |
michael@0 | 146 | DEFAULT_GMAKE_FLAGS += BUILD='$(MOZ_BUILD_ROOT)/security/$$(subst $$(topsrcdir)/security/,,$$(CURDIR))' |
michael@0 | 147 | DEFAULT_GMAKE_FLAGS += BUILD_TREE='$$(BUILD)' OBJDIR='$$(BUILD)' DEPENDENCIES='$$(BUILD)/.deps' SINGLE_SHLIB_DIR='$$(BUILD)' |
michael@0 | 148 | DEFAULT_GMAKE_FLAGS += SOURCE_XP_DIR=$(ABS_DIST) |
michael@0 | 149 | ifndef MOZ_DEBUG |
michael@0 | 150 | DEFAULT_GMAKE_FLAGS += BUILD_OPT=1 OPT_CODE_SIZE=1 |
michael@0 | 151 | endif |
michael@0 | 152 | ifdef GNU_CC |
michael@0 | 153 | DEFAULT_GMAKE_FLAGS += NS_USE_GCC=1 |
michael@0 | 154 | else |
michael@0 | 155 | DEFAULT_GMAKE_FLAGS += NS_USE_GCC= |
michael@0 | 156 | endif |
michael@0 | 157 | ifdef USE_N32 |
michael@0 | 158 | # It is not really necessary to specify USE_PTHREADS=1. USE_PTHREADS |
michael@0 | 159 | # merely adds _PTH to coreconf's OBJDIR name. |
michael@0 | 160 | DEFAULT_GMAKE_FLAGS += USE_N32=1 USE_PTHREADS=1 |
michael@0 | 161 | endif |
michael@0 | 162 | ifdef HAVE_64BIT_OS |
michael@0 | 163 | DEFAULT_GMAKE_FLAGS += USE_64=1 |
michael@0 | 164 | endif |
michael@0 | 165 | ifeq ($(OS_ARCH),WINNT) |
michael@0 | 166 | DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95 |
michael@0 | 167 | ifdef MOZ_DEBUG |
michael@0 | 168 | ifndef MOZ_NO_DEBUG_RTL |
michael@0 | 169 | DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1 |
michael@0 | 170 | endif |
michael@0 | 171 | endif |
michael@0 | 172 | endif # WINNT |
michael@0 | 173 | ifeq ($(OS_ARCH),Darwin) |
michael@0 | 174 | # Make nsinstall use absolute symlinks by default when building NSS |
michael@0 | 175 | # for Mozilla on Mac OS X. (Bugzilla bug 193164) |
michael@0 | 176 | ifndef NSDISTMODE |
michael@0 | 177 | DEFAULT_GMAKE_FLAGS += NSDISTMODE=absolute_symlink |
michael@0 | 178 | endif |
michael@0 | 179 | ifdef MACOS_SDK_DIR |
michael@0 | 180 | DEFAULT_GMAKE_FLAGS += MACOS_SDK_DIR=$(MACOS_SDK_DIR) |
michael@0 | 181 | endif |
michael@0 | 182 | endif |
michael@0 | 183 | |
michael@0 | 184 | # Turn off TLS compression support because it requires system zlib. |
michael@0 | 185 | # See bug 580679 comment 18. |
michael@0 | 186 | DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ZLIB= |
michael@0 | 187 | |
michael@0 | 188 | # Disable building of the test programs in security/nss/lib/zlib |
michael@0 | 189 | DEFAULT_GMAKE_FLAGS += PROGRAMS= |
michael@0 | 190 | |
michael@0 | 191 | # Disable creating .chk files. They will be generated from packager.mk |
michael@0 | 192 | # When bug 681624 lands, we can replace CHECKLOC= with SKIP_SHLIBSIGN=1 |
michael@0 | 193 | DEFAULT_GMAKE_FLAGS += CHECKLOC= |
michael@0 | 194 | |
michael@0 | 195 | ifdef CROSS_COMPILE |
michael@0 | 196 | |
michael@0 | 197 | DEFAULT_GMAKE_FLAGS += \ |
michael@0 | 198 | NATIVE_CC='$(HOST_CC)' \ |
michael@0 | 199 | CC='$(CC)' \ |
michael@0 | 200 | CCC='$(CXX)' \ |
michael@0 | 201 | LINK='$(LD)' \ |
michael@0 | 202 | AS='$(AS)' \ |
michael@0 | 203 | AR='$(AR) $(AR_FLAGS:$@=$$@)' \ |
michael@0 | 204 | RANLIB='$(RANLIB)' \ |
michael@0 | 205 | RC='$(RC) $(RCFLAGS)' \ |
michael@0 | 206 | OS_ARCH='$(OS_ARCH)' \ |
michael@0 | 207 | OS_TEST='$(OS_TEST)' \ |
michael@0 | 208 | CPU_ARCH='$(TARGET_CPU)' \ |
michael@0 | 209 | $(NULL) |
michael@0 | 210 | |
michael@0 | 211 | # Android has pthreads integrated into -lc, so OS_PTHREAD is set to nothing |
michael@0 | 212 | ifeq ($(OS_TARGET), Android) |
michael@0 | 213 | DEFAULT_GMAKE_FLAGS += \ |
michael@0 | 214 | OS_RELEASE='2.6' \ |
michael@0 | 215 | OS_PTHREAD= \ |
michael@0 | 216 | $(NULL) |
michael@0 | 217 | |
michael@0 | 218 | DEFAULT_GMAKE_FLAGS += ARCHFLAG='$(CFLAGS) -DCHECK_FORK_GETPID -DRTLD_NOLOAD=0 -include $(topsrcdir)/security/manager/android_stub.h' |
michael@0 | 219 | endif |
michael@0 | 220 | endif |
michael@0 | 221 | |
michael@0 | 222 | ifdef WRAP_LDFLAGS |
michael@0 | 223 | DEFAULT_GMAKE_FLAGS += \ |
michael@0 | 224 | LDFLAGS='$(LDFLAGS) $(WRAP_LDFLAGS)' \ |
michael@0 | 225 | DSO_LDOPTS='$(DSO_LDOPTS) $(LDFLAGS) $(WRAP_LDFLAGS)' \ |
michael@0 | 226 | $(NULL) |
michael@0 | 227 | endif |
michael@0 | 228 | |
michael@0 | 229 | DEFAULT_GMAKE_FLAGS += FREEBL_NO_DEPEND=0 |
michael@0 | 230 | ifeq ($(OS_TARGET),Linux) |
michael@0 | 231 | DEFAULT_GMAKE_FLAGS += FREEBL_LOWHASH=1 |
michael@0 | 232 | endif |
michael@0 | 233 | |
michael@0 | 234 | ifdef MOZ_NO_WLZDEFS |
michael@0 | 235 | DEFAULT_GMAKE_FLAGS += ZDEFS_FLAG= |
michael@0 | 236 | endif |
michael@0 | 237 | ifdef MOZ_CFLAGS_NSS |
michael@0 | 238 | DEFAULT_GMAKE_FLAGS += XCFLAGS='$(CFLAGS)' |
michael@0 | 239 | DEFAULT_GMAKE_FLAGS += DARWIN_DYLIB_VERSIONS='-compatibility_version 1 -current_version 1 $(LDFLAGS)' |
michael@0 | 240 | endif |
michael@0 | 241 | |
michael@0 | 242 | DEFAULT_GMAKE_FLAGS += NSS_NO_PKCS11_BYPASS=1 |
michael@0 | 243 | |
michael@0 | 244 | # Put NSS headers directly under $(DIST)/include |
michael@0 | 245 | DEFAULT_GMAKE_FLAGS += PUBLIC_EXPORT_DIR='$(ABS_DIST)/include/$$(MODULE)' |
michael@0 | 246 | DEFAULT_GMAKE_FLAGS += SOURCE_XPHEADERS_DIR='$$(SOURCE_XP_DIR)/include/$$(MODULE)' |
michael@0 | 247 | DEFAULT_GMAKE_FLAGS += MODULE_INCLUDES='$$(addprefix -I$$(SOURCE_XP_DIR)/include/,$$(REQUIRES))' |
michael@0 | 248 | |
michael@0 | 249 | # Work around NSS's MAKE_OBJDIR being racy. See bug #836220 |
michael@0 | 250 | DEFAULT_GMAKE_FLAGS += MAKE_OBJDIR='$$(INSTALL) -D $$(OBJDIR)' |
michael@0 | 251 | |
michael@0 | 252 | # Work around NSS adding IMPORT_LIBRARY to TARGETS with no rule for |
michael@0 | 253 | # it, creating race conditions. See bug #836220 |
michael@0 | 254 | DEFAULT_GMAKE_FLAGS += TARGETS='$$(LIBRARY) $$(SHARED_LIBRARY) $$(PROGRAM)' |
michael@0 | 255 | |
michael@0 | 256 | ifdef MOZ_B2G_CERTDATA |
michael@0 | 257 | include $(srcdir)/b2g-certdata.mk |
michael@0 | 258 | endif |
michael@0 | 259 | |
michael@0 | 260 | ifdef MOZ_NSS_PATCH |
michael@0 | 261 | # If we're applying a patch, we'll copy the NSS source to the objdir |
michael@0 | 262 | # and build it from there. |
michael@0 | 263 | NSS_SRCDIR = $(CURDIR)/nss |
michael@0 | 264 | |
michael@0 | 265 | # This will copy and patch the NSS source for every build. |
michael@0 | 266 | # Since we "cp -p", it won't force rebuilds for most files, just |
michael@0 | 267 | # for patched files, but that's easier than trying to track |
michael@0 | 268 | # dependencies for patched files. |
michael@0 | 269 | export:: |
michael@0 | 270 | rm -rf $(NSS_SRCDIR) |
michael@0 | 271 | $(NSINSTALL) -D $(NSS_SRCDIR)/security |
michael@0 | 272 | cp -Rp $(topsrcdir)/security/nss $(NSS_SRCDIR)/security |
michael@0 | 273 | cp -Rp $(topsrcdir)/security/coreconf $(NSS_SRCDIR)/security |
michael@0 | 274 | cp -Rp $(topsrcdir)/security/dbm $(NSS_SRCDIR)/security |
michael@0 | 275 | cp -Rp $(topsrcdir)/dbm $(NSS_SRCDIR) |
michael@0 | 276 | (cd $(NSS_SRCDIR) && patch -p1 < $(abspath $(MOZ_NSS_PATCH))) |
michael@0 | 277 | else |
michael@0 | 278 | NSS_SRCDIR = $(topsrcdir) |
michael@0 | 279 | endif |
michael@0 | 280 | |
michael@0 | 281 | NSS_DIRS = |
michael@0 | 282 | ifndef MOZ_FOLD_LIBS |
michael@0 | 283 | NSS_DIRS += nss/lib |
michael@0 | 284 | else |
michael@0 | 285 | ifndef NSS_DISABLE_DBM |
michael@0 | 286 | NSS_DIRS += nss/lib/dbm |
michael@0 | 287 | endif |
michael@0 | 288 | endif |
michael@0 | 289 | NSS_DIRS += \ |
michael@0 | 290 | nss/cmd/lib \ |
michael@0 | 291 | nss/cmd/shlibsign \ |
michael@0 | 292 | $(NULL) |
michael@0 | 293 | |
michael@0 | 294 | ifdef ENABLE_TESTS |
michael@0 | 295 | NSS_DIRS += \ |
michael@0 | 296 | nss/cmd/certutil \ |
michael@0 | 297 | nss/cmd/pk12util \ |
michael@0 | 298 | nss/cmd/modutil \ |
michael@0 | 299 | $(NULL) |
michael@0 | 300 | endif |
michael@0 | 301 | |
michael@0 | 302 | ifneq (,$(filter %--build-id,$(LDFLAGS))) |
michael@0 | 303 | DEFAULT_GMAKE_ENV = LDFLAGS=-Wl,--build-id |
michael@0 | 304 | endif |
michael@0 | 305 | |
michael@0 | 306 | ifdef MOZ_FOLD_LIBS |
michael@0 | 307 | # TODO: The following can be replaced by something simpler when bug 844880 |
michael@0 | 308 | # is fixed. |
michael@0 | 309 | # All static libraries required for nss, smime, ssl and nssutil. |
michael@0 | 310 | # The strip is needed to remove potential linefeed characters, since they hang |
michael@0 | 311 | # around in some cases on Windows. |
michael@0 | 312 | NSS_STATIC_LIBS := $(strip $(shell $(MAKE) --no-print-directory -f $(srcdir)/nss.mk DEPTH='$(DEPTH)' topsrcdir='$(topsrcdir)' srcdir='$(srcdir)' echo-variable-libs)) |
michael@0 | 313 | # Corresponding build directories |
michael@0 | 314 | NSS_STATIC_DIRS := $(foreach lib,$(NSS_STATIC_LIBS),$(patsubst %/,%,$(dir $(lib)))) |
michael@0 | 315 | NSS_DIRS += $(NSS_STATIC_DIRS) |
michael@0 | 316 | |
michael@0 | 317 | # TODO: The following can be replaced by something simpler when bug 844884 |
michael@0 | 318 | # is fixed. |
michael@0 | 319 | # Remaining nss/lib directories |
michael@0 | 320 | NSS_DIRS += nss/lib/freebl nss/lib/softoken nss/lib/jar nss/lib/crmf nss/lib/ckfw nss/lib/libpkix |
michael@0 | 321 | ifeq (WINNT,$(OS_TARGET)) |
michael@0 | 322 | NSS_DIRS += nss/lib/zlib |
michael@0 | 323 | endif |
michael@0 | 324 | endif # MOZ_FOLD_LIBS |
michael@0 | 325 | |
michael@0 | 326 | # Filter-out $(LIBRARY_NAME) because it's already handled in config/rules.mk. |
michael@0 | 327 | NSS_DIST_DLL_FILES := $(addprefix $(DIST)/lib/$(DLL_PREFIX),$(addsuffix $(DLL_SUFFIX),$(filter-out $(LIBRARY_NAME),$(NSS_DLLS)) $(NSS_EXTRA_DLLS))) |
michael@0 | 328 | NSS_DIST_DLL_DEST := $(DIST)/bin |
michael@0 | 329 | INSTALL_TARGETS += NSS_DIST_DLL |
michael@0 | 330 | |
michael@0 | 331 | ifeq ($(OS_ARCH)_$(1), SunOS_softokn3) |
michael@0 | 332 | # has to use copy mode on Solaris, see #665509 |
michael@0 | 333 | $(DIST)/bin/$(DLL_PREFIX)softokn3$(DLL_SUFFIX): INSTALL := $(INSTALL) -t |
michael@0 | 334 | endif |
michael@0 | 335 | |
michael@0 | 336 | NSS_SDK_LIB_FILES := \ |
michael@0 | 337 | $(addprefix $(DIST)/lib/$(LIB_PREFIX),$(addsuffix .$(LIB_SUFFIX),$(SDK_LIBS))) \ |
michael@0 | 338 | $(addprefix $(DIST)/bin/$(DLL_PREFIX),$(addsuffix $(DLL_SUFFIX),$(NSS_DLLS))) \ |
michael@0 | 339 | $(NULL) |
michael@0 | 340 | NSS_SDK_LIB_DEST := $(DIST)/sdk/lib |
michael@0 | 341 | INSTALL_TARGETS += NSS_SDK_LIB |
michael@0 | 342 | |
michael@0 | 343 | ifdef MOZ_FOLD_LIBS |
michael@0 | 344 | ifeq (WINNT,$(OS_TARGET)) |
michael@0 | 345 | SUFFIX = _s.$(LIB_SUFFIX) |
michael@0 | 346 | else |
michael@0 | 347 | SUFFIX = .$(LIB_SUFFIX) |
michael@0 | 348 | endif |
michael@0 | 349 | |
michael@0 | 350 | # Fold NSPR libs |
michael@0 | 351 | EXTRA_DSO_LDOPTS += $(DEPTH)/nsprpub/pr/src/$(LIB_PREFIX)nspr4$(SUFFIX) |
michael@0 | 352 | EXTRA_DSO_LDOPTS += $(DEPTH)/nsprpub/lib/ds/$(LIB_PREFIX)plds4$(SUFFIX) |
michael@0 | 353 | EXTRA_DSO_LDOPTS += $(DEPTH)/nsprpub/lib/libc/src/$(LIB_PREFIX)plc4$(SUFFIX) |
michael@0 | 354 | |
michael@0 | 355 | # Fold SQLite |
michael@0 | 356 | EXTRA_DSO_LDOPTS += $(DEPTH)/db/sqlite3/src/$(LIB_PREFIX)mozsqlite3.$(LIB_SUFFIX) |
michael@0 | 357 | |
michael@0 | 358 | # Add all static libraries for nss, smime, ssl and nssutil |
michael@0 | 359 | SHARED_LIBRARY_LIBS = $(addprefix ../,$(NSS_STATIC_LIBS)) |
michael@0 | 360 | |
michael@0 | 361 | ifeq (WINNT,$(OS_TARGET)) |
michael@0 | 362 | # Create a .def file based on the various .def files for nss, smime, ssl and |
michael@0 | 363 | # nssutil. |
michael@0 | 364 | NSS_STATIC_LIBS_DEFS := $(wildcard $(addprefix $(srcdir)/../,$(NSS_STATIC_LIBS:.$(LIB_SUFFIX)=.def))) |
michael@0 | 365 | |
michael@0 | 366 | nss3.def: $(NSS_STATIC_LIBS_DEFS) $(DEPTH)/db/sqlite3/src/sqlite-processed.def |
michael@0 | 367 | echo LIBRARY nss3$(DLL_SUFFIX) > $@.tmp |
michael@0 | 368 | echo EXPORTS >> $@.tmp |
michael@0 | 369 | grep -v -h -e ^LIBRARY -e ^EXPORTS -e ^\; $^ >> $@.tmp |
michael@0 | 370 | mv $@.tmp $@ |
michael@0 | 371 | endif |
michael@0 | 372 | |
michael@0 | 373 | ifneq (,$(filter WINNT,$(OS_ARCH))) |
michael@0 | 374 | SDK_LIBRARY = $(IMPORT_LIBRARY) |
michael@0 | 375 | else |
michael@0 | 376 | SDK_LIBRARY = $(SHARED_LIBRARY) |
michael@0 | 377 | endif |
michael@0 | 378 | |
michael@0 | 379 | endif # MOZ_FOLD_LIBS |
michael@0 | 380 | |
michael@0 | 381 | include $(topsrcdir)/config/rules.mk |
michael@0 | 382 | |
michael@0 | 383 | ifdef MOZ_FOLD_LIBS |
michael@0 | 384 | # Force the linker to include everything from the static libraries. |
michael@0 | 385 | EXPAND_LIBS_EXEC += --extract |
michael@0 | 386 | |
michael@0 | 387 | $(SHARED_LIBRARY): $(SHARED_LIBRARY_LIBS) |
michael@0 | 388 | |
michael@0 | 389 | EXTRA_DSO_LDOPTS += $(REALTIME_LIBS) |
michael@0 | 390 | |
michael@0 | 391 | ifdef IMPORT_LIB_SUFFIX |
michael@0 | 392 | IMPORT_PREFIX = $(LIB_PREFIX) |
michael@0 | 393 | IMPORT_SUFFIX = .$(IMPORT_LIB_SUFFIX) |
michael@0 | 394 | else |
michael@0 | 395 | IMPORT_PREFIX = $(DLL_PREFIX) |
michael@0 | 396 | IMPORT_SUFFIX = $(DLL_SUFFIX) |
michael@0 | 397 | endif |
michael@0 | 398 | |
michael@0 | 399 | NSPR_IMPORT_LIBS = $(addprefix $(DIST)/lib/$(IMPORT_PREFIX),$(addsuffix $(IMPORT_SUFFIX),nspr4 plc4 plds4)) |
michael@0 | 400 | SQLITE_IMPORT_LIB = $(DIST)/lib/$(IMPORT_PREFIX)mozsqlite3$(IMPORT_SUFFIX) |
michael@0 | 401 | |
michael@0 | 402 | # TODO: The following can be replaced by something simpler when bug 844884 |
michael@0 | 403 | # is fixed. |
michael@0 | 404 | # Associate target files with the rules that build them. |
michael@0 | 405 | $(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX): libs-nss/lib/crmf |
michael@0 | 406 | $(DIST)/lib/$(DLL_PREFIX)freebl3$(DLL_SUFFIX): libs-nss/lib/freebl |
michael@0 | 407 | $(DIST)/lib/$(DLL_PREFIX)nssckbi$(DLL_SUFFIX): libs-nss/lib/ckfw |
michael@0 | 408 | $(DIST)/lib/$(DLL_PREFIX)softokn3$(DLL_SUFFIX): libs-nss/lib/softoken |
michael@0 | 409 | $(DIST)/lib/$(DLL_PREFIX)nssdbm3$(DLL_SUFFIX): libs-nss/lib/softoken |
michael@0 | 410 | $(foreach lib,$(NSS_STATIC_LIBS),$(eval ../$(lib): libs-$(patsubst %/,%,$(dir $(lib))))) |
michael@0 | 411 | |
michael@0 | 412 | # Create fake import libraries for the folded libraries, so that linking |
michael@0 | 413 | # against them works both for the NSS build system (see dependencies below) |
michael@0 | 414 | # and for the rest of the mozilla build system. |
michael@0 | 415 | $(NSPR_IMPORT_LIBS) \ |
michael@0 | 416 | $(SQLITE_IMPORT_LIB) \ |
michael@0 | 417 | $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) \ |
michael@0 | 418 | $(DIST)/lib/$(IMPORT_PREFIX)ssl3$(IMPORT_SUFFIX) \ |
michael@0 | 419 | $(DIST)/lib/$(IMPORT_PREFIX)smime3$(IMPORT_SUFFIX): $(DIST)/lib/$(IMPORT_PREFIX)nss3$(IMPORT_SUFFIX) |
michael@0 | 420 | ifeq (WINNT,$(OS_TARGET)) |
michael@0 | 421 | cp $< $@ |
michael@0 | 422 | else |
michael@0 | 423 | ln -sf $< $@ |
michael@0 | 424 | endif |
michael@0 | 425 | |
michael@0 | 426 | # Interdependencies between nss sub-directories, and dependencies on NSPR/SQLite |
michael@0 | 427 | libs-nss/lib/ckfw: libs-nss/lib/nss/../base $(NSPR_IMPORT_LIBS) |
michael@0 | 428 | libs-nss/lib/softoken: $(NSPR_IMPORT_LIBS) $(SQLITE_IMPORT_LIB) |
michael@0 | 429 | libs-nss/lib/softoken: libs-nss/lib/freebl |
michael@0 | 430 | ifndef NSS_DISABLE_DBM |
michael@0 | 431 | libs-nss/lib/softoken: libs-nss/lib/dbm |
michael@0 | 432 | endif |
michael@0 | 433 | libs-nss/lib/softoken: $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) |
michael@0 | 434 | libs-nss/lib/freebl: $(DIST)/lib/$(IMPORT_PREFIX)nssutil3$(IMPORT_SUFFIX) $(NSPR_IMPORT_LIBS) |
michael@0 | 435 | |
michael@0 | 436 | # For each directory where we build static libraries, force the NSS build system |
michael@0 | 437 | # to only build static libraries. |
michael@0 | 438 | $(addprefix libs-,$(NSS_STATIC_DIRS)): DEFAULT_GMAKE_FLAGS += SHARED_LIBRARY= IMPORT_LIBRARY= |
michael@0 | 439 | else |
michael@0 | 440 | $(NSS_DIST_DLL_FILES) $(NSS_SDK_LIB_FILES): libs-nss/lib |
michael@0 | 441 | endif # MOZ_FOLD_LIBS |
michael@0 | 442 | |
michael@0 | 443 | ifeq ($(NSINSTALL_PY),$(NSINSTALL)) |
michael@0 | 444 | DEFAULT_GMAKE_FLAGS += PYTHON='$(PYTHON)' |
michael@0 | 445 | DEFAULT_GMAKE_FLAGS += NSINSTALL_PY='$(abspath $(topsrcdir)/config/nsinstall.py)' |
michael@0 | 446 | DEFAULT_GMAKE_FLAGS += NSINSTALL='$$(PYTHON) $$(NSINSTALL_PY)' |
michael@0 | 447 | else |
michael@0 | 448 | DEFAULT_GMAKE_FLAGS += NSINSTALL='$(NSINSTALL)' |
michael@0 | 449 | endif |
michael@0 | 450 | ifeq ($(OS_ARCH),WINNT) |
michael@0 | 451 | DEFAULT_GMAKE_FLAGS += INSTALL='$$(NSINSTALL) -t' |
michael@0 | 452 | endif |
michael@0 | 453 | DEFAULT_GMAKE_FLAGS += $(EXTRA_GMAKE_FLAGS) |
michael@0 | 454 | |
michael@0 | 455 | $(addprefix libs-,$(NSS_DIRS)): libs-%: |
michael@0 | 456 | # Work around NSS's export rule being racy when recursing for private_export |
michael@0 | 457 | # See bug #836220. |
michael@0 | 458 | $(addprefix export-,$(NSS_DIRS)): EXTRA_GMAKE_FLAGS = PRIVATE_EXPORTS= |
michael@0 | 459 | $(addprefix export-,$(NSS_DIRS)): export-%: private_export-% |
michael@0 | 460 | $(addprefix private_export-,$(NSS_DIRS)): EXTRA_GMAKE_FLAGS = |
michael@0 | 461 | $(addprefix private_export-,$(NSS_DIRS)): private_export-%: |
michael@0 | 462 | |
michael@0 | 463 | # Work around bug #836228 in pymake |
michael@0 | 464 | ifdef .PYMAKE |
michael@0 | 465 | $(foreach p,libs export private_export,$(addprefix $(p)-,$(NSS_DIRS))): *=$(subst $(NULL) $(NULL),-,$(wordlist 2,$(words $(subst -, ,$@)),$(subst -, ,$@))) |
michael@0 | 466 | endif |
michael@0 | 467 | |
michael@0 | 468 | $(foreach p,libs export private_export,$(addprefix $(p)-,$(NSS_DIRS))): |
michael@0 | 469 | $(DEFAULT_GMAKE_ENV) $(MAKE) -C $(NSS_SRCDIR)/security/$* $(@:-$*=) $(DEFAULT_GMAKE_FLAGS) |
michael@0 | 470 | |
michael@0 | 471 | export:: $(addprefix export-,$(NSS_DIRS)) |
michael@0 | 472 | |
michael@0 | 473 | $(addprefix clean-,$(NSS_DIRS)): clean-%: |
michael@0 | 474 | $(MAKE) -C $(NSS_SRCDIR)/security/$* $(DEFAULT_GMAKE_FLAGS) clean |
michael@0 | 475 | |
michael@0 | 476 | clean clobber clobber_all realclean distclean depend:: $(addprefix clean-,$(NSS_DIRS)) |
michael@0 | 477 | |
michael@0 | 478 | NSS_CMD_TARGETS := $(addprefix libs-,$(filter-out nss/cmd/lib,$(filter nss/cmd/%,$(NSS_DIRS)))) |
michael@0 | 479 | libs:: $(NSS_CMD_TARGETS) |
michael@0 | 480 | |
michael@0 | 481 | ifdef MOZ_FOLD_LIBS |
michael@0 | 482 | $(NSS_CMD_TARGETS): $(addprefix $(DIST)/lib/$(IMPORT_PREFIX),$(addsuffix $(IMPORT_SUFFIX),$(NSS_LIBS))) |
michael@0 | 483 | libs-nss/cmd/modutil: libs-nss/lib/jar |
michael@0 | 484 | ifeq (WINNT,$(OS_TARGET)) |
michael@0 | 485 | libs-nss/cmd/modutil: libs-nss/lib/zlib |
michael@0 | 486 | endif |
michael@0 | 487 | $(NSS_CMD_TARGETS): libs-nss/cmd/lib |
michael@0 | 488 | else |
michael@0 | 489 | $(NSS_CMD_TARGETS): libs-nss/lib libs-nss/cmd/lib |
michael@0 | 490 | endif # MOZ_FOLD_LIBS |
michael@0 | 491 | |
michael@0 | 492 | # Work around NSS build system race condition creating certdata.c in |
michael@0 | 493 | # security/nss/lib/ckfw/builtins. See bug #836220. |
michael@0 | 494 | libs-nss/lib$(if $(MOZ_FOLD_LIBS),/ckfw): $(call mkdir_deps,../nss/lib/ckfw/builtins) |