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
MOD_DEPTH = ../../../..
42
topsrcdir = @top_srcdir@
46
include $(MOD_DEPTH)/config/autoconf.mk
48
include $(topsrcdir)/config/config.mk
50
ifeq ($(OS_TARGET), WIN16)
51
OS_CFLAGS = $(OS_EXE_CFLAGS)
64
OBJS = $(addprefix $(OBJDIR)/,$(CXXSRCS:.cpp=.$(OBJ_SUFFIX)))
66
ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
72
PROGS = $(addprefix $(OBJDIR)/, $(CXXSRCS:.cpp=$(PROG_SUFFIX)))
74
TARGETS = $(PROGS) $(OBJS)
76
INCLUDES = -I.. -I$(dist_includedir)
78
# Setting the variables LDOPTS and LIBPR. We first initialize
79
# them to the default values, then adjust them for some platforms.
80
LDOPTS = -L$(dist_libdir)
81
LIBPR = -lnspr$(MOD_MAJOR_VERSION)
82
LIBPL = -lplc$(MOD_MAJOR_VERSION)
84
ifeq ($(OS_ARCH), IRIX)
85
LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
86
# For 6.x machines, include this flag
87
ifeq ($(basename $(OS_RELEASE)),6)
94
ifeq ($(USE_PTHREADS), 1)
95
ifeq ($(OS_RELEASE), 6.2)
96
LDOPTS += -Wl,-woff,85
103
ifeq ($(OS_ARCH), SunOS)
104
ifneq ($(OS_RELEASE), 4.1.3_U1)
106
LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
108
LDOPTS += -R $(PWD)/$(dist_libdir)
112
ifneq ($(LOCAL_THREADS_ONLY),1)
113
# SunOS 5.4 and 5.5 need to link with -lthread or -lpthread,
114
# even though we already linked with these system libraries
115
# when we built libnspr.so.
116
ifeq ($(OS_RELEASE), 5.4)
117
EXTRA_LIBS = -lthread
120
ifeq ($(OS_RELEASE), 5.5)
122
EXTRA_LIBS = -lpthread
124
EXTRA_LIBS = -lthread
127
endif # LOCAL_THREADS_ONLY
130
ifeq ($(OS_ARCH), WINNT)
131
ifeq ($(OS_TARGET), WIN16)
132
LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
133
LIBPL = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
135
LDOPTS = -NOLOGO -DEBUG -DEBUGTYPE:CV -INCREMENTAL:NO
136
LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
137
LIBPL = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
141
ifeq ($(OS_ARCH),OS2)
142
ifeq ($(MOZ_OS2_TOOLS),VACPP)
143
LDOPTS = -NOE -DEBUG -nologo -PMTYPE:VIO
144
LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
145
LIBPLC = $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
147
LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
151
ifneq ($(OS_ARCH), WINNT)
155
ifeq ($(OS_ARCH), OSF1)
156
LDOPTS += -rpath $(PWD)/$(dist_libdir)
159
ifeq ($(OS_ARCH), HP-UX)
160
LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
164
ifeq ($(OS_ARCH),AIX)
165
LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
166
ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
167
LIBPR = -lnspr$(MOD_MAJOR_VERSION)_shr
168
LIBPLC = -lplc$(MOD_MAJOR_VERSION)_shr
175
ifeq ($(OS_ARCH), Linux)
176
ifeq ($(OS_RELEASE), 1.2)
179
LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir)
180
ifeq ($(USE_PTHREADS),1)
181
EXTRA_LIBS = -lpthread
186
ifeq ($(OS_ARCH), NCR)
187
# XXX: We see some strange problems when we link with libnspr.so.
188
# So for now we use static libraries on NCR. The shared library
189
# stuff below is commented out.
190
LIBPR = $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
191
LIBPL = $(dist_libdir)/libplc$(MOD_MAJOR_VERSION).a
192
EXTRA_LIBS = -lsocket -lnsl -ldl
194
# NCR needs to link against -lsocket -lnsl (and -lc, which is linked
195
# implicitly by $(CC)) again even though we already linked with these
196
# system libraries when we built libnspr.so.
197
#EXTRA_LIBS = -lsocket -lnsl
198
# This hardcodes in the executable programs the directory to find
199
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
200
# option for ld on other platforms.
201
#export LD_RUN_PATH = $(PWD)/$(dist_libdir)
204
ifeq ($(OS_ARCH), SCO_SV)
205
# SCO Unix needs to link against -lsocket again even though we
206
# already linked with these system libraries when we built libnspr.so.
207
EXTRA_LIBS = -lsocket
208
# This hardcodes in the executable programs the directory to find
209
# libnspr.so etc. at program startup. Equivalent to the -R or -rpath
210
# option for ld on other platforms.
211
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
214
ifeq ($(OS_ARCH), UNIXWARE)
215
export LD_RUN_PATH = $(PWD)/$(dist_libdir)
218
#####################################################
222
#####################################################
224
include $(topsrcdir)/config/rules.mk
227
ifeq ($(OS_ARCH),AIX)
228
ifneq ($(OS_RELEASE),4.2)
229
ifneq ($(USE_PTHREADS), 1)
235
ifeq ($(AIX_PRE_4_2),1)
237
# AIX releases prior to 4.2 need a special two-step linking hack
238
# in order to both override the system select() and be able to
239
# get at the original system select().
241
# We use a pattern rule in ns/nspr20/config/rules.mk to generate
242
# the .$(OBJ_SUFFIX) file from the .c source file, then do the
243
# two-step linking hack below.
245
$(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
248
$(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
249
$(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
254
# All platforms that are not AIX pre-4.2.
256
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
258
ifeq ($(OS_ARCH), WINNT)
259
ifeq ($(OS_TARGET),WIN16)
260
echo system windows >w16link
261
echo option map >>w16link
262
echo option stack=10K >>w16link
263
echo option heapsize=32K >>w16link
264
echo debug $(DEBUGTYPE) all >>w16link
265
echo name $@ >>w16link
268
echo library >>w16link
269
echo $(LIBPR), >>w16link
270
echo $(LIBPL), >>w16link
271
echo winsock.lib >>w16link
274
link $(LDOPTS) $< $(LIBPR) $(LIBPL) wsock32.lib -out:$@
277
ifeq ($(OS_ARCH),OS2)
278
$(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
280
$(CCC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPL) $(EXTRA_LIBS) -o $@