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
ifeq ($(OS_TARGET), OS2)
50
OS_CFLAGS = $(OS_EXE_CFLAGS)
53
CSRCS = gc1.c thrashgc.c
55
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
61
PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
63
TARGETS = $(PROGS) $(OBJS)
65
INCLUDES = -I$(dist_includedir)
67
# Setting the variables LDOPTS and LIBPR. We first initialize
68
# them to the default values, then adjust them for some platforms.
69
LDOPTS = -L$(dist_libdir)
70
NSPR_VERSION = $(MOD_MAJOR_VERSION)
71
GC_VERSION = $(MOD_MAJOR_VERSION)
72
LIBPR = -lnspr$(NSPR_VERSION)
73
LIBPLC = -lplc$(NSPR_VERSION)
74
LIBGC = -lmsgc$(GC_VERSION)
76
ifeq ($(OS_ARCH), WINNT)
77
LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
78
LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
79
LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
80
LIBGC= $(dist_libdir)/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
84
LDOPTS += -Zomf -Zlinker /PM:VIO
87
ifneq ($(OS_ARCH), WINNT)
91
ifeq ($(OS_ARCH), IRIX)
92
LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
94
# For 6.x machines, include this flag
95
ifeq ($(basename $(OS_RELEASE)),6)
105
ifeq ($(OS_ARCH), OSF1)
106
# I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
107
# we do static linking.
108
ifeq ($(OS_RELEASE), V3.2)
109
LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
110
LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
111
LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a
114
LDOPTS += -rpath $(PWD)/$(dist_libdir)
118
ifeq ($(OS_ARCH), HP-UX)
119
LDOPTS += -z -Wl,+s,+b,$(PWD)/$(dist_libdir)
123
ifeq ($(OS_ARCH),AIX)
124
LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
125
ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
126
LIBPR = -lnspr$(NSPR_VERSION)_shr
127
LIBPLC = -lplc$(NSPR_VERSION)_shr
128
LIBGC = -lmsgc$(GC_VERSION)_shr
136
ifeq ($(OS_ARCH), SunOS)
137
ifneq ($(OS_RELEASE), 4.1.3_U1)
139
LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
141
LDOPTS += -R $(PWD)/$(dist_libdir)
145
# SunOS 5.5 needs to link with -lpthread, even though we already
146
# linked with this system library when we built libnspr.so.
147
ifeq ($(OS_RELEASE), 5.5)
149
EXTRA_LIBS = -lpthread
154
ifeq ($(OS_ARCH),NEC)
155
EXTRA_LIBS = $(OS_LIBS)
156
# This hardcodes in the executable programs the directory to find
157
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
158
# option for ld on other platforms.
159
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
162
ifeq ($(OS_ARCH), NCR)
163
# XXX: We see some strange problems when we link with libnspr.so.
164
# So for now we use static libraries on NCR. The shared library
165
# stuff below is commented out.
166
LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
167
LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
168
LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a
169
EXTRA_LIBS = -lsocket -lnsl -ldl
171
# NCR needs to link against -lsocket -lnsl (and -lc, which is linked
172
# implicitly by $(CC)) again even though we already linked with these
173
# system libraries when we built libnspr.so.
174
#EXTRA_LIBS = -lsocket -lnsl
175
# This hardcodes in the executable programs the directory to find
176
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
177
# option for ld on other platforms.
178
#export LD_RUN_PATH = $(PWD)/$(dist_libdir)
181
ifeq ($(OS_ARCH), Linux)
182
ifeq ($(OS_RELEASE), 1.2)
187
ifeq ($(OS_ARCH), SCOOS)
188
# SCO Unix needs to link against -lsocket again even though we
189
# already linked with these system libraries when we built libnspr.so.
190
EXTRA_LIBS = -lsocket
191
# This hardcodes in the executable programs the directory to find
192
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
193
# option for ld on other platforms.
194
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
197
ifeq ($(OS_ARCH),SINIX)
198
EXTRA_LIBS = -lsocket -lnsl -lresolv -ldl
199
# This hardcodes in the executable programs the directory to find
200
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
201
# option for ld on other platforms.
202
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
205
ifeq ($(OS_ARCH), UNIXWARE)
206
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
209
ifeq ($(OS_ARCH),BSD_OS)
213
ifeq ($(OS_ARCH),DGUX)
214
EXTRA_LIBS = -lsocket -lnsl -ldl
217
#####################################################
221
#####################################################
223
include $(topsrcdir)/config/rules.mk
226
ifeq ($(OS_ARCH),AIX)
227
ifneq ($(OS_RELEASE),4.2)
228
ifneq ($(USE_PTHREADS), 1)
234
ifeq ($(AIX_PRE_4_2),1)
236
# AIX releases prior to 4.2 need a special two-step linking hack
237
# in order to both override the system select() and be able to
238
# get at the original system select().
240
# We use a pattern rule in ns/nspr20/config/rules.mk to generate
241
# the .$(OBJ_SUFFIX) file from the .c source file, then do the
242
# two-step linking hack below.
244
$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
247
$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a
248
$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
253
# All platforms that are not AIX pre-4.2.
255
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
257
ifeq ($(OS_ARCH), WINNT)
258
link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
260
ifeq ($(OS_ARCH),OS2)
261
$(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
263
$(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBGC) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@