Bug 453310 - Reparameterize GetNewOrUsed and move some work around. r+sr=brendan
[mozilla-central.git] / security / manager / Makefile.in
blobb8f5cb3ee82d58b5febc1e1f7674bf7101e2e424
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 # The contents of this file are subject to the Mozilla Public License Version
6 # 1.1 (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
8 # http://www.mozilla.org/MPL/
10 # Software distributed under the License is distributed on an "AS IS" basis,
11 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 # for the specific language governing rights and limitations under the
13 # License.
15 # The Original Code is mozilla.org code.
17 # The Initial Developer of the Original Code is
18 # Netscape Communications Corporation.
19 # Portions created by the Initial Developer are Copyright (C) 1998
20 # the Initial Developer. All Rights Reserved.
22 # Contributor(s):
23 # Brian Ryner <bryner@brianryner.com>
25 # Alternatively, the contents of this file may be used under the terms of
26 # either the GNU General Public License Version 2 or later (the "GPL"), or
27 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 # in which case the provisions of the GPL or the LGPL are applicable instead
29 # of those above. If you wish to allow use of your version of this file only
30 # under the terms of either the GPL or the LGPL, and not to allow others to
31 # use your version of this file under the terms of the MPL, indicate your
32 # decision by deleting the provisions above and replace them with the notice
33 # and other provisions required by the GPL or the LGPL. If you do not delete
34 # the provisions above, a recipient may use your version of this file under
35 # the terms of any one of the MPL, the GPL or the LGPL.
37 # ***** END LICENSE BLOCK *****
39 DEPTH = ../..
40 topsrcdir = @top_srcdir@
41 srcdir = @srcdir@
42 VPATH = @srcdir@
44 include $(DEPTH)/config/autoconf.mk
46 MODULE = psm
48 PACKAGE_FILE = psm.pkg
50 ifndef MOZ_NATIVE_NSS
51 PACKAGE_VARS += \
52 NSS3_LIB \
53 NSSUTIL3_LIB \
54 SMIME3_LIB \
55 SSL3_LIB \
56 SOFTOKEN3_LIB \
57 SOFTOKEN3_CHK \
58 NSSDBM3_LIB \
59 LOADABLE_ROOT_MODULE \
60 HAVE_FREEBL_LIBS \
61 HAVE_FREEBL_LIBS_32 \
62 HAVE_FREEBL_LIBS_32INT64 \
63 HAVE_FREEBL_LIBS_64 \
64 $(NULL)
66 LOADABLE_ROOT_MODULE = $(DLL_PREFIX)nssckbi$(DLL_SUFFIX)
67 endif
69 NSS3_LIB = $(DLL_PREFIX)nss3$(DLL_SUFFIX)
70 NSSUTIL3_LIB = $(DLL_PREFIX)nssutil3$(DLL_SUFFIX)
71 SMIME3_LIB = $(DLL_PREFIX)smime3$(DLL_SUFFIX)
72 SSL3_LIB = $(DLL_PREFIX)ssl3$(DLL_SUFFIX)
73 SOFTOKEN3_LIB = $(DLL_PREFIX)softokn3$(DLL_SUFFIX)
74 SOFTOKEN3_CHK = $(DLL_PREFIX)softokn3.chk
75 NSSDBM3_LIB = $(DLL_PREFIX)nssdbm3$(DLL_SUFFIX)
77 ifndef MOZ_NATIVE_NSS
78 ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
79 SDK_LIBS = \
80 $(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
81 $(DIST)/lib/$(LIB_PREFIX)smime3.$(IMPORT_LIB_SUFFIX) \
82 $(DIST)/lib/$(LIB_PREFIX)ssl3.$(IMPORT_LIB_SUFFIX) \
83 $(DIST)/lib/$(LIB_PREFIX)nss3.$(IMPORT_LIB_SUFFIX) \
84 $(DIST)/lib/$(LIB_PREFIX)nssutil3.$(IMPORT_LIB_SUFFIX) \
85 $(DIST)/lib/$(LIB_PREFIX)softokn3.$(IMPORT_LIB_SUFFIX) \
86 $(NULL)
87 else
88 SDK_LIBS = \
89 $(DIST)/lib/$(LIB_PREFIX)crmf.$(LIB_SUFFIX) \
90 $(DIST)/lib/$(LIB_PREFIX)smime.$(LIB_SUFFIX) \
91 $(DIST)/lib/$(LIB_PREFIX)ssl.$(LIB_SUFFIX) \
92 $(DIST)/lib/$(LIB_PREFIX)nss.$(LIB_SUFFIX) \
93 $(DIST)/lib/$(LIB_PREFIX)nssutil.$(LIB_SUFFIX) \
94 $(DIST)/lib/$(LIB_PREFIX)softokn.$(LIB_SUFFIX) \
95 $(NULL)
96 endif
97 endif
99 # Default
100 HAVE_FREEBL_LIBS = 1
102 # 32-bit HP-UX PA-RISC
103 ifeq ($(OS_ARCH), HP-UX)
104 ifneq ($(OS_TEST), ia64)
105 ifndef HAVE_64BIT_OS
106 HAVE_FREEBL_LIBS =
107 HAVE_FREEBL_LIBS_32 = 1
108 endif
109 endif
110 endif
112 # SunOS SPARC
113 ifeq ($(OS_ARCH), SunOS)
114 ifneq (86,$(findstring 86,$(OS_TEST)))
115 ifdef HAVE_64BIT_OS
116 HAVE_FREEBL_LIBS =
117 HAVE_FREEBL_LIBS_64 = 1
118 else
119 HAVE_FREEBL_LIBS =
120 HAVE_FREEBL_LIBS_32 = 1
121 HAVE_FREEBL_LIBS_32INT64 = 1
122 endif
123 endif
124 endif
126 ifdef HAVE_FREEBL_LIBS
127 FREEBL_LIB = $(DLL_PREFIX)freebl3$(DLL_SUFFIX)
128 FREEBL_CHK = $(DLL_PREFIX)freebl3.chk
129 endif
130 ifdef HAVE_FREEBL_LIBS_32
131 FREEBL_32INT_LIB = libfreebl_32int_3$(DLL_SUFFIX)
132 FREEBL_32INT_CHK = libfreebl_32int_3.chk
133 FREEBL_32FPU_LIB = libfreebl_32fpu_3$(DLL_SUFFIX)
134 FREEBL_32FPU_CHK = libfreebl_32fpu_3.chk
135 endif
136 ifdef HAVE_FREEBL_LIBS_32INT64
137 FREEBL_32INT64_LIB = libfreebl_32int64_3$(DLL_SUFFIX)
138 FREEBL_32INT64_CHK = libfreebl_32int64_3.chk
139 endif
140 ifdef HAVE_FREEBL_LIBS_64
141 FREEBL_64INT_LIB = libfreebl_64int_3$(DLL_SUFFIX)
142 FREEBL_64INT_CHK = libfreebl_64int_3.chk
143 FREEBL_64FPU_LIB = libfreebl_64fpu_3$(DLL_SUFFIX)
144 FREEBL_64FPU_CHK = libfreebl_64fpu_3.chk
145 endif
147 ABS_DIST := $(shell cd $(DIST) && pwd)
148 ifeq ($(HOST_OS_ARCH),WINNT)
149 ifdef CYGDRIVE_MOUNT
150 ABS_DIST := $(shell cygpath -w $(ABS_DIST) | sed -e 's|\\|/|g')
151 endif
152 ifneq (,$(filter mingw%,$(host_os)))
153 ABS_DIST := $(shell cd $(DIST) && pwd -W)
154 endif
155 endif
156 NSPR_INCLUDE_DIR = $(firstword $(filter -I%,$(NSPR_CFLAGS)))
157 ifneq (,$(strip $(NSPR_INCLUDE_DIR)))
158 NSPR_INCLUDE_DIR := $(subst -I,,$(subst -I$(DIST),-I$(ABS_DIST),$(NSPR_INCLUDE_DIR)))
159 else
160 NSPR_INCLUDE_DIR = $(ABS_DIST)/include/nspr
161 endif
162 NSPR_LIB_DIR = $(firstword $(filter -L%,$(NSPR_LIBS)))
163 ifneq (,$(strip $(NSPR_LIB_DIR)))
164 NSPR_LIB_DIR := $(subst -L,,$(subst -L$(DIST),-L$(ABS_DIST),$(NSPR_LIB_DIR)))
165 else
166 NSPR_LIB_DIR = $(ABS_DIST)/lib
167 endif
168 # Can't pass this in DEFAULT_GMAKE_FLAGS because that overrides
169 # definitions in NSS, so just export it into the sub-make's environment.
170 ifeq (WINNT_1,$(OS_TARGET)_$(MOZ_MEMORY))
171 export DLLFLAGS
172 endif
173 # NSS makefiles are not safe for parallel execution.
174 DEFAULT_GMAKE_FLAGS = MAKE="$(MAKE) -j1" -j1
175 DEFAULT_GMAKE_FLAGS += CC="$(CC)"
176 DEFAULT_GMAKE_FLAGS += SOURCE_MD_DIR=$(ABS_DIST)
177 DEFAULT_GMAKE_FLAGS += DIST=$(ABS_DIST)
178 DEFAULT_GMAKE_FLAGS += NSPR_INCLUDE_DIR=$(NSPR_INCLUDE_DIR)
179 DEFAULT_GMAKE_FLAGS += NSPR_LIB_DIR=$(NSPR_LIB_DIR)
180 DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1
181 DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1
182 DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1
183 ABS_topsrcdir := $(shell cd $(topsrcdir); pwd)
184 ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
185 DEFAULT_GMAKE_FLAGS += BUILD_TREE=$(MOZ_BUILD_ROOT)
186 endif
187 ifndef MOZ_DEBUG
188 DEFAULT_GMAKE_FLAGS += BUILD_OPT=1 OPT_CODE_SIZE=1
189 endif
190 ifdef GNU_CC
191 DEFAULT_GMAKE_FLAGS += NS_USE_GCC=1 NS_USE_NATIVE=
192 else
193 DEFAULT_GMAKE_FLAGS += NS_USE_GCC= NS_USE_NATIVE=1
194 endif
195 ifdef USE_N32
196 # It is not really necessary to specify USE_PTHREADS=1. USE_PTHREADS
197 # merely adds _PTH to coreconf's OBJDIR name.
198 DEFAULT_GMAKE_FLAGS += USE_N32=1 USE_PTHREADS=1
199 endif
200 ifdef HAVE_64BIT_OS
201 DEFAULT_GMAKE_FLAGS += USE_64=1
202 endif
203 ifeq ($(OS_ARCH),WINNT)
204 DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
205 ifdef MOZ_DEBUG
206 ifndef MOZ_NO_DEBUG_RTL
207 DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
208 endif
209 endif
210 endif # WINNT
211 ifeq ($(OS_ARCH),OS2)
212 ifdef MOZ_OS2_HIGH_MEMORY
213 DEFAULT_GMAKE_FLAGS += MOZ_OS2_HIGH_MEMORY=1
214 endif
215 endif # OS2
216 # OS_CFLAGS needs to be passed on down.
217 ifeq ($(OS_ARCH),OpenVMS)
218 DEFAULT_GMAKE_FLAGS += XCFLAGS="$(OS_CFLAGS)"
219 endif
220 ifeq ($(OS_ARCH),Darwin)
221 # Make nsinstall use absolute symlinks by default when building NSS
222 # for Mozilla on Mac OS X. (Bugzilla bug 193164)
223 ifndef NSDISTMODE
224 DEFAULT_GMAKE_FLAGS += NSDISTMODE=absolute_symlink
225 endif
226 ifdef MACOS_SDK_DIR
227 DEFAULT_GMAKE_FLAGS += MACOS_SDK_DIR=$(MACOS_SDK_DIR)
228 endif
229 endif
230 ifdef CROSS_COMPILE
231 DEFAULT_GMAKE_FLAGS += \
232 NSINSTALL="$(NSINSTALL)" \
233 NATIVE_CC="$(HOST_CC)" \
234 CC="$(CC)" \
235 CCC="$(CXX)" \
236 LINK="$(LD)" \
237 AS="$(AS)" \
238 AR='$(AR) $(AR_FLAGS:$@=$$@)' \
239 RANLIB="$(RANLIB)" \
240 RC="$(RC) $(RCFLAGS)" \
241 OS_ARCH="$(OS_ARCH)" \
242 OS_TEST="$(OS_TEST)" \
243 CPU_ARCH="$(TARGET_CPU)" \
244 $(NULL)
245 SKIP_CHK=1
246 endif
247 SUBMAKEFILES = boot/Makefile ssl/Makefile pki/Makefile locales/Makefile
249 include $(topsrcdir)/config/rules.mk
251 # Attempt to properly handle NSS' refusal to implement a dependency system
252 export:: .nss.cleaned
254 .nss.cleaned: .nss.checkout
255 ifndef MOZ_NATIVE_NSS
256 $(MAKE) -C $(topsrcdir)/security/coreconf $(DEFAULT_GMAKE_FLAGS) clean
257 $(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS) clean
258 ifndef SKIP_CHK
259 $(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS) clean
260 $(MAKE) -C $(topsrcdir)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS) clean
261 endif
262 touch $@
263 endif
265 GARBAGE += .nss.cleaned
267 .nss.checkout:
268 ifndef MOZ_NATIVE_NSS
269 touch $(srcdir)/$@
270 endif
272 dependclean export packages chrome::
273 $(MAKE) -C boot $@
274 $(MAKE) -C ssl $@
275 $(MAKE) -C locales $@
276 ifdef MOZ_XUL
277 $(MAKE) -C pki $@
278 endif
280 libs::
281 ifndef MOZ_NATIVE_NSS
282 $(MAKE) -C $(topsrcdir)/security/coreconf $(DEFAULT_GMAKE_FLAGS)
283 $(MAKE) -C $(topsrcdir)/security/dbm $(DEFAULT_GMAKE_FLAGS)
284 $(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS)
285 ifdef ENABLE_TESTS
286 # Need certutil binary for mochitest certificates generation
287 $(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS)
288 $(MAKE) -C $(topsrcdir)/security/nss/cmd/certutil $(DEFAULT_GMAKE_FLAGS)
289 $(MAKE) -C $(topsrcdir)/security/nss/cmd/pk12util $(DEFAULT_GMAKE_FLAGS)
290 endif
291 ifndef SKIP_CHK
292 ifndef ENABLE_TESTS # Just avoid secondary compile
293 $(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS)
294 endif
295 $(MAKE) -C $(topsrcdir)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS)
296 endif
297 $(INSTALL) -m 755 $(DIST)/lib/$(LOADABLE_ROOT_MODULE) $(DIST)/bin
298 ifndef SKIP_CHK
299 $(INSTALL) -m 644 $(DIST)/lib/$(SOFTOKEN3_CHK) $(DIST)/bin
300 endif
301 $(INSTALL) -m 755 $(DIST)/lib/$(SOFTOKEN3_LIB) $(DIST)/bin
302 $(INSTALL) -m 755 $(DIST)/lib/$(NSSDBM3_LIB) $(DIST)/bin
303 $(INSTALL) -m 755 $(DIST)/lib/$(NSS3_LIB) $(DIST)/bin
304 $(INSTALL) -m 755 $(DIST)/lib/$(NSSUTIL3_LIB) $(DIST)/bin
305 $(INSTALL) -m 755 $(DIST)/lib/$(SSL3_LIB) $(DIST)/bin
306 $(INSTALL) -m 755 $(DIST)/lib/$(SMIME3_LIB) $(DIST)/bin
307 $(INSTALL) -m 755 $(SDK_LIBS) $(DIST)/sdk/lib
308 ifdef HAVE_FREEBL_LIBS
309 ifndef SKIP_CHK
310 $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_CHK) $(DIST)/bin
311 endif
312 $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_LIB) $(DIST)/bin
313 endif
314 ifdef HAVE_FREEBL_LIBS_32
315 ifndef SKIP_CHK
316 $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_32INT_CHK) $(DIST)/bin
317 $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_32FPU_CHK) $(DIST)/bin
318 endif
319 $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT_LIB) $(DIST)/bin
320 $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32FPU_LIB) $(DIST)/bin
321 endif
322 ifdef HAVE_FREEBL_LIBS_32INT64
323 ifndef SKIP_CHK
324 $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_32INT64_CHK) $(DIST)/bin
325 endif
326 $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT64_LIB) $(DIST)/bin
327 endif
328 ifdef HAVE_FREEBL_LIBS_64
329 ifndef SKIP_CHK
330 $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_64INT_CHK) $(DIST)/bin
331 $(INSTALL) -m 644 $(DIST)/lib/$(FREEBL_64FPU_CHK) $(DIST)/bin
332 endif
333 $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_64INT_LIB) $(DIST)/bin
334 $(INSTALL) -m 755 $(DIST)/lib/$(FREEBL_64FPU_LIB) $(DIST)/bin
335 endif
336 endif
337 ifndef MOZ_NATIVE_NSS
338 # NSS installs headers to dist/public and we want them in dist/include
339 $(NSINSTALL) -D $(DIST)/include/nss
340 (cd $(DIST)/public/nss && tar $(TAR_CREATE_FLAGS) - .) | \
341 (cd $(DIST)/include/nss && tar -xf -)
342 (cd $(DIST)/public/nss && tar $(TAR_CREATE_FLAGS) - .) | \
343 (cd $(DIST)/sdk/include && tar -xf -)
344 endif
345 $(MAKE) -C boot $@
346 $(MAKE) -C ssl $@
347 $(MAKE) -C locales $@
348 ifdef MOZ_XUL
349 $(MAKE) -C pki $@
350 endif
352 check::
353 $(MAKE) -C ssl $@
355 install::
356 ifndef MOZ_NATIVE_NSS
357 $(SYSINSTALL) -m 755 $(DIST)/lib/$(LOADABLE_ROOT_MODULE) $(DESTDIR)$(mozappdir)
358 ifndef SKIP_CHK
359 $(SYSINSTALL) -m 644 $(DIST)/lib/$(SOFTOKEN3_CHK) $(DESTDIR)$(mozappdir)
360 endif
361 $(SYSINSTALL) -m 755 $(DIST)/lib/$(SOFTOKEN3_LIB) $(DESTDIR)$(mozappdir)
362 $(SYSINSTALL) -m 755 $(DIST)/lib/$(NSSDBM3_LIB) $(DESTDIR)$(mozappdir)
363 $(SYSINSTALL) -m 755 $(DIST)/lib/$(NSS3_LIB) $(DESTDIR)$(mozappdir)
364 $(SYSINSTALL) -m 755 $(DIST)/lib/$(NSSUTIL3_LIB) $(DESTDIR)$(mozappdir)
365 $(SYSINSTALL) -m 755 $(DIST)/lib/$(SSL3_LIB) $(DESTDIR)$(mozappdir)
366 $(SYSINSTALL) -m 755 $(DIST)/lib/$(SMIME3_LIB) $(DESTDIR)$(mozappdir)
367 ifdef HAVE_FREEBL_LIBS
368 ifndef SKIP_CHK
369 $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_CHK) $(DESTDIR)$(mozappdir)
370 endif
371 $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_LIB) $(DESTDIR)$(mozappdir)
372 endif
373 ifdef HAVE_FREEBL_LIBS_32
374 ifndef SKIP_CHK
375 $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_32INT_CHK) $(DESTDIR)$(mozappdir)
376 $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_32FPU_CHK) $(DESTDIR)$(mozappdir)
377 endif
378 $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT_LIB) $(DESTDIR)$(mozappdir)
379 $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32FPU_LIB) $(DESTDIR)$(mozappdir)
380 endif
381 ifdef HAVE_FREEBL_LIBS_32INT64
382 ifndef SKIP_CHK
383 $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_32INT64_CHK) $(DESTDIR)$(mozappdir)
384 endif
385 $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_32INT64_LIB) $(DESTDIR)$(mozappdir)
386 endif
387 ifdef HAVE_FREEBL_LIBS_64
388 ifndef SKIP_CHK
389 $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_64INT_CHK) $(DESTDIR)$(mozappdir)
390 $(SYSINSTALL) -m 644 $(DIST)/lib/$(FREEBL_64FPU_CHK) $(DESTDIR)$(mozappdir)
391 endif
392 $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_64INT_LIB) $(DESTDIR)$(mozappdir)
393 $(SYSINSTALL) -m 755 $(DIST)/lib/$(FREEBL_64FPU_LIB) $(DESTDIR)$(mozappdir)
394 endif
395 endif
396 $(MAKE) -C boot $@
397 $(MAKE) -C ssl $@
398 $(MAKE) -C locales $@
399 ifdef MOZ_XUL
400 $(MAKE) -C pki $@
401 endif
403 clean clobber clobber_all realclean distclean depend::
404 $(MAKE) -C boot $@
405 $(MAKE) -C ssl $@
406 $(MAKE) -C locales $@
407 ifdef MOZ_XUL
408 $(MAKE) -C pki $@
409 endif
410 ifndef MOZ_NATIVE_NSS
411 $(MAKE) -C $(topsrcdir)/security/coreconf $(DEFAULT_GMAKE_FLAGS) clean
412 $(MAKE) -C $(topsrcdir)/security/nss/lib $(DEFAULT_GMAKE_FLAGS) clean
413 ifndef SKIP_CHK
414 $(MAKE) -C $(topsrcdir)/security/nss/cmd/lib $(DEFAULT_GMAKE_FLAGS) clean
415 $(MAKE) -C $(topsrcdir)/security/nss/cmd/shlibsign $(DEFAULT_GMAKE_FLAGS) clean
416 endif
417 endif
419 echo-requires-recursive::
420 $(MAKE) -C boot $@
421 $(MAKE) -C ssl $@
422 $(MAKE) -C pki $@
423 $(MAKE) -C locales $@