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
15
# The Original Code is the Netscape Portable Runtime (NSPR).
17
# The Initial Developer of the Original Code is
18
# Netscape Communications Corporation.
19
# Portions created by the Initial Developer are Copyright (C) 1998-2000
20
# the Initial Developer. All Rights Reserved.
24
# Alternatively, the contents of this file may be used under the terms of
25
# either the GNU General Public License Version 2 or later (the "GPL"), or
26
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
# in which case the provisions of the GPL or the LGPL are applicable instead
28
# of those above. If you wish to allow use of your version of this file only
29
# under the terms of either the GPL or the LGPL, and not to allow others to
30
# use your version of this file under the terms of the MPL, indicate your
31
# decision by deleting the provisions above and replace them with the notice
32
# and other provisions required by the GPL or the LGPL. If you do not delete
33
# the provisions above, a recipient may use your version of this file under
34
# the terms of any one of the MPL, the GPL or the LGPL.
36
# ***** END LICENSE BLOCK *****
41
topsrcdir = @top_srcdir@
45
include $(MOD_DEPTH)/config/autoconf.mk
47
include $(topsrcdir)/config/config.mk
49
DIRS = io linking malloc md memory misc threads
51
# For VAC++ 4 geticcdata rule in config/OS2.mk
52
ifeq ($(MOZ_OS2_TOOLS),VACPP)
56
ifeq ($(USE_PTHREADS), 1)
60
ifeq ($(USE_BTHREADS), 1)
64
ifeq ($(USE_CPLUS), 1)
69
# Define platform-dependent OS_LIBS
72
ifeq ($(OS_ARCH),SunOS)
73
ifeq ($(OS_RELEASE),4.1.3_U1)
76
MAPFILE = $(OBJDIR)/nsprmap.sun
80
MKSHLIB += -Wl,--version-script,$(MAPFILE)
82
MKSHLIB += -Wl,-M,$(MAPFILE)
85
MKSHLIB += -M $(MAPFILE)
88
# In Solaris 2.6 or earlier, -lrt is called -lposix4.
90
LIBRT_TEST=$(firstword $(sort 5.7 $(OS_RELEASE)))
91
ifeq (5.7, $(LIBRT_TEST))
98
OS_LIBS = -lpthread -lthread ${LIBRT} -lsocket -lnsl -ldl -lc
100
ifdef LOCAL_THREADS_ONLY
101
OS_LIBS = -lsocket -lnsl -ldl -lc
103
OS_LIBS = -lthread ${LIBRT} -lsocket -lnsl -ldl -lc
104
endif # LOCAL_THREADS_ONLY
106
ifeq ($(OS_TEST),sun4u)
108
DSO_LDOPTS += -Wl,-f,\$$ORIGIN/cpu/\$$ISALIST/lib$(ULTRASPARC_LIBRARY)$(LIBRARY_VERSION).so
114
ifeq ($(OS_ARCH), IRIX)
115
ifeq ($(USE_PTHREADS), 1)
121
ifeq ($(OS_ARCH),AIX)
122
ifeq ($(CLASSIC_NSPR),1)
123
ifeq ($(OS_RELEASE),4.1)
129
ifeq ($(OS_RELEASE),4.1)
130
OS_LIBS = -lpthreads -lsvld -lC_r -lC -lc_r -lm /usr/lib/libc.a
132
OS_LIBS = -lpthreads -ldl -lC_r -lC -lc_r -lm /usr/lib/libc.a
137
# On AIX, we override malloc in non-pthread versions. On AIX 4.2 or
138
# above, this requires that we use the rtl-enabled version of libc.a.
139
ifeq ($(OS_ARCH),AIX)
140
ifneq (,$(filter-out 3.2 4.1,$(OS_RELEASE)))
141
ifneq ($(USE_PTHREADS),1)
142
BUILD_AIX_RTL_LIBC = 1
143
AIX_RTL_LIBC = $(OBJDIR)/libc.a
148
ifeq ($(OS_ARCH),OS2)
149
MAPFILE = $(OBJDIR)/$(LIBRARY_NAME)$(LIBRARY_VERSION).def
150
ADD_TO_DEF_FILE = cat $(srcdir)/os2extra.def >> $(MAPFILE)
151
GARBAGE += $(MAPFILE)
152
MKSHLIB += $(MAPFILE)
155
ifeq ($(OS_ARCH),OSF1)
156
ifeq ($(USE_PTHREADS), 1)
157
OS_LIBS = -lpthread -lrt
159
ifneq ($(OS_RELEASE),V2.0)
164
ifeq ($(OS_ARCH),Linux)
165
ifeq ($(USE_PTHREADS), 1)
166
OS_LIBS = -lpthread -ldl
172
ifeq ($(OS_ARCH),HP-UX)
173
ifeq ($(USE_PTHREADS), 1)
174
ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE)))
177
OS_LIBS = -lpthread -lrt
180
ifeq ($(PTHREADS_USER), 1)
183
ifeq ($(basename $(OS_RELEASE)),A.09)
184
OS_LIBS += -ldld -L/lib/pa1.1 -lm
186
OS_LIBS += -ldld -lm -lc
190
ifeq ($(OS_ARCH),UNIXWARE)
191
OS_LIBS = -lsocket -lc
194
ifeq ($(OS_ARCH),NEWS-OS)
195
OS_LIBS = -lsocket -lnsl -lgen -lresolv
198
ifeq ($(OS_ARCH),WINNT)
200
OS_LIBS = -ladvapi32 -lwsock32
202
OS_LIBS = advapi32.lib wsock32.lib
206
ifeq ($(OS_TARGET),MacOSX)
207
OS_LIBS = -framework CoreServices -framework CoreFoundation
210
ifdef GC_LEAK_DETECTOR
211
EXTRA_LIBS = -L$(dist_libdir) -lboehm
214
EXTRA_LIBS += $(OS_LIBS)
217
# Define platform-dependent OBJS
221
$(OBJDIR)/prvrsion.$(OBJ_SUFFIX) \
222
io/$(OBJDIR)/prfdcach.$(OBJ_SUFFIX) \
223
io/$(OBJDIR)/prmwait.$(OBJ_SUFFIX) \
224
io/$(OBJDIR)/prmapopt.$(OBJ_SUFFIX) \
225
io/$(OBJDIR)/priometh.$(OBJ_SUFFIX) \
226
io/$(OBJDIR)/pripv6.$(OBJ_SUFFIX) \
227
io/$(OBJDIR)/prlayer.$(OBJ_SUFFIX) \
228
io/$(OBJDIR)/prlog.$(OBJ_SUFFIX) \
229
io/$(OBJDIR)/prmmap.$(OBJ_SUFFIX) \
230
io/$(OBJDIR)/prpolevt.$(OBJ_SUFFIX) \
231
io/$(OBJDIR)/prprf.$(OBJ_SUFFIX) \
232
io/$(OBJDIR)/prscanf.$(OBJ_SUFFIX) \
233
io/$(OBJDIR)/prstdio.$(OBJ_SUFFIX) \
234
threads/$(OBJDIR)/prcmon.$(OBJ_SUFFIX) \
235
threads/$(OBJDIR)/prrwlock.$(OBJ_SUFFIX) \
236
threads/$(OBJDIR)/prtpd.$(OBJ_SUFFIX) \
237
linking/$(OBJDIR)/prlink.$(OBJ_SUFFIX) \
238
malloc/$(OBJDIR)/prmem.$(OBJ_SUFFIX) \
239
md/$(OBJDIR)/prosdep.$(OBJ_SUFFIX) \
240
memory/$(OBJDIR)/prshm.$(OBJ_SUFFIX) \
241
memory/$(OBJDIR)/prshma.$(OBJ_SUFFIX) \
242
memory/$(OBJDIR)/prseg.$(OBJ_SUFFIX) \
243
misc/$(OBJDIR)/pralarm.$(OBJ_SUFFIX) \
244
misc/$(OBJDIR)/pratom.$(OBJ_SUFFIX) \
245
misc/$(OBJDIR)/prcountr.$(OBJ_SUFFIX) \
246
misc/$(OBJDIR)/prdtoa.$(OBJ_SUFFIX) \
247
misc/$(OBJDIR)/prenv.$(OBJ_SUFFIX) \
248
misc/$(OBJDIR)/prerr.$(OBJ_SUFFIX) \
249
misc/$(OBJDIR)/prerror.$(OBJ_SUFFIX) \
250
misc/$(OBJDIR)/prerrortable.$(OBJ_SUFFIX) \
251
misc/$(OBJDIR)/prinit.$(OBJ_SUFFIX) \
252
misc/$(OBJDIR)/prinrval.$(OBJ_SUFFIX) \
253
misc/$(OBJDIR)/pripc.$(OBJ_SUFFIX) \
254
misc/$(OBJDIR)/prlog2.$(OBJ_SUFFIX) \
255
misc/$(OBJDIR)/prlong.$(OBJ_SUFFIX) \
256
misc/$(OBJDIR)/prnetdb.$(OBJ_SUFFIX) \
257
misc/$(OBJDIR)/prolock.$(OBJ_SUFFIX) \
258
misc/$(OBJDIR)/prrng.$(OBJ_SUFFIX) \
259
misc/$(OBJDIR)/prsystem.$(OBJ_SUFFIX) \
260
misc/$(OBJDIR)/prthinfo.$(OBJ_SUFFIX) \
261
misc/$(OBJDIR)/prtpool.$(OBJ_SUFFIX) \
262
misc/$(OBJDIR)/prtrace.$(OBJ_SUFFIX) \
263
misc/$(OBJDIR)/prtime.$(OBJ_SUFFIX)
265
# ilib now rejects empty objects
266
ifneq ($(MOZ_OS2_TOOLS),VACPP)
267
OBJS += malloc/$(OBJDIR)/prmalloc.$(OBJ_SUFFIX)
272
pthreads/$(OBJDIR)/ptsynch.$(OBJ_SUFFIX) \
273
pthreads/$(OBJDIR)/ptio.$(OBJ_SUFFIX) \
274
pthreads/$(OBJDIR)/ptthread.$(OBJ_SUFFIX) \
275
pthreads/$(OBJDIR)/ptmisc.$(OBJ_SUFFIX)
278
io/$(OBJDIR)/prdir.$(OBJ_SUFFIX) \
279
io/$(OBJDIR)/prfile.$(OBJ_SUFFIX) \
280
io/$(OBJDIR)/prio.$(OBJ_SUFFIX) \
281
io/$(OBJDIR)/prsocket.$(OBJ_SUFFIX) \
282
misc/$(OBJDIR)/pripcsem.$(OBJ_SUFFIX)
286
threads/$(OBJDIR)/prcthr.$(OBJ_SUFFIX) \
287
threads/$(OBJDIR)/prdump.$(OBJ_SUFFIX) \
288
threads/$(OBJDIR)/prmon.$(OBJ_SUFFIX) \
289
threads/$(OBJDIR)/prsem.$(OBJ_SUFFIX) \
290
threads/combined/$(OBJDIR)/prucpu.$(OBJ_SUFFIX) \
291
threads/combined/$(OBJDIR)/prucv.$(OBJ_SUFFIX) \
292
threads/combined/$(OBJDIR)/prulock.$(OBJ_SUFFIX) \
293
threads/combined/$(OBJDIR)/prustack.$(OBJ_SUFFIX) \
294
threads/combined/$(OBJDIR)/pruthr.$(OBJ_SUFFIX)
299
ifeq ($(USE_CPLUS), 1)
301
cplus/$(OBJDIR)/rcbase.$(OBJ_SUFFIX) \
302
cplus/$(OBJDIR)/rccv.$(OBJ_SUFFIX) \
303
cplus/$(OBJDIR)/rcfileio.$(OBJ_SUFFIX) \
304
cplus/$(OBJDIR)/rcinrval.$(OBJ_SUFFIX) \
305
cplus/$(OBJDIR)/rcio.$(OBJ_SUFFIX) \
306
cplus/$(OBJDIR)/rclock.$(OBJ_SUFFIX) \
307
cplus/$(OBJDIR)/rcnetdb.$(OBJ_SUFFIX) \
308
cplus/$(OBJDIR)/rcnetio.$(OBJ_SUFFIX) \
309
cplus/$(OBJDIR)/rcthread.$(OBJ_SUFFIX) \
310
cplus/$(OBJDIR)/rctime.$(OBJ_SUFFIX)
313
ifdef GC_LEAK_DETECTOR
314
OBJS += memory/$(OBJDIR)/prgcleak.$(OBJ_SUFFIX)
317
ifeq ($(OS_ARCH), WINNT)
319
DLLBASE=-Wl,--image-base -Wl,0x30000000
321
DLLBASE=/BASE:0x30000000
323
RES=$(OBJDIR)/nspr.res
327
include $(srcdir)/md/$(PR_MD_ARCH_DIR)/objs.mk
329
include $(srcdir)/bthreads/objs.mk
333
LIBRARY_VERSION = $(MOD_MAJOR_VERSION)
335
RELEASE_LIBS = $(TARGETS)
337
include $(topsrcdir)/config/rules.mk
339
ifeq ($(BUILD_AIX_RTL_LIBC),1)
340
TARGETS += $(AIX_RTL_LIBC)
341
# XXX is this a shared library?
345
# Version information generation (begin)
348
INCLUDES = -I$(dist_includedir) -I$(topsrcdir)/pr/include -I$(topsrcdir)/pr/include/private
349
TINC = $(OBJDIR)/_pr_bld.h
351
ifeq ($(OS_TARGET),OS2)
352
PROD = nspr$(MOD_MAJOR_VERSION).$(DLL_SUFFIX)
354
PROD = $(notdir $(SHARED_LIBRARY))
357
NOW = $(MOD_DEPTH)/config/$(OBJDIR)/now
358
SH_DATE = $(shell date "+%Y-%m-%d %T")
359
SH_NOW = $(shell $(NOW))
361
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
367
DEFINES += -D_NSPR_BUILD_
373
@$(ECHO) '#define _BUILD_STRING "$(SH_DATE)"' > $(TINC)
374
@if test ! -z "$(SH_NOW)"; then \
375
$(ECHO) '#define _BUILD_TIME $(SH_NOW)$(SUF)' >> $(TINC); \
379
@$(ECHO) '#define _PRODUCTION "$(PROD)"' >> $(TINC)
382
$(OBJDIR)/prvrsion.$(OBJ_SUFFIX): prvrsion.c $(TINC)
383
ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
384
$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
386
ifeq ($(MOZ_OS2_TOOLS), VACPP)
387
$(CC) -Fo$@ -c $(CFLAGS) -I$(OBJDIR) $<
389
$(CC) -o $@ -c $(CFLAGS) -I$(OBJDIR) $<
393
# Version information generation (end)
398
# The Client build wants the shared libraries in $(dist_bindir)
399
# so we also install them there.
403
$(INSTALL) -m 444 $(TARGETS) $(dist_libdir)
405
ifeq ($(OS_ARCH),HP-UX)
406
$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
407
$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
409
$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
412
ifeq ($(MOZ_BITS),16)
413
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
414
$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/bin
417
ifeq ($(BUILD_AIX_RTL_LIBC),1)
418
$(AIX_RTL_LIBC): /usr/ccs/lib/libc.a