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), WIN16)
50 OS_CFLAGS = $(OS_EXE_CFLAGS)
61 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
67 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
71 INCLUDES = -I$(dist_includedir)
75 # Setting the variables LDOPTS and LIBPR. We first initialize
76 # them to the default values, then adjust them for some platforms.
77 LDOPTS = -L$(dist_libdir)
78 LIBPR = -lnspr$(NSPR_VERSION)
79 LIBPLC = -lplc$(NSPR_VERSION)
81 ifeq ($(OS_ARCH), WINNT)
82 ifeq ($(OS_TARGET), WIN16)
83 LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
84 LIBPLC= $(dist_libdir)/plc$(NSPR_VERSION).lib
86 LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
87 LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
88 LIBPLC= $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
93 LDOPTS += -Zomf -Zlinker /PM:VIO
96 ifneq ($(OS_ARCH), WINNT)
100 ifeq ($(OS_ARCH), IRIX)
101 LDOPTS += -rpath $(PWD)/$(dist_libdir)
104 ifeq ($(OS_ARCH), OSF1)
105 LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
108 ifeq ($(OS_ARCH), HP-UX)
109 LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
113 ifeq ($(OS_ARCH),AIX)
114 LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
115 LIBPR = -lnspr$(NSPR_VERSION)_shr
116 LIBPLC = -lplc$(NSPR_VERSION)_shr
120 ifeq ($(OS_ARCH), SunOS)
121 ifneq ($(OS_RELEASE), 4.1.3_U1)
123 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
125 LDOPTS += -R $(PWD)/$(dist_libdir)
129 # SunOS 5.5 needs to link with -lpthread, even though we already
130 # linked with this system library when we built libnspr.so.
131 ifeq ($(OS_RELEASE), 5.5)
133 EXTRA_LIBS = -lpthread
138 ifeq ($(OS_ARCH), NCR)
139 # XXX: We see some strange problems when we link with libnspr.so.
140 # So for now we use static libraries on NCR. The shared library
141 # stuff below is commented out.
142 LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
143 LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
144 EXTRA_LIBS = -lsocket -lnsl -ldl
146 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
147 # implicitly by $(CC)) again even though we already linked with these
148 # system libraries when we built libnspr.so.
149 #EXTRA_LIBS = -lsocket -lnsl
150 # This hardcodes in the executable programs the directory to find
151 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
152 # option for ld on other platforms.
153 #export LD_RUN_PATH = $(PWD)/$(dist_libdir)
156 ifeq ($(OS_ARCH), SCOOS)
157 # SCO Unix needs to link against -lsocket again even though we
158 # already linked with these system libraries when we built libnspr.so.
159 EXTRA_LIBS = -lsocket
160 # This hardcodes in the executable programs the directory to find
161 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
162 # option for ld on other platforms.
163 export LD_RUN_PATH = $(PWD)/$(dist_libdir)
166 #####################################################
170 #####################################################
172 include $(topsrcdir)/config/rules.mk
175 ifeq ($(OS_ARCH),AIX)
176 ifneq ($(OS_RELEASE),4.2)
177 ifneq ($(USE_PTHREADS), 1)
183 ifeq ($(AIX_PRE_4_2),1)
185 # AIX releases prior to 4.2 need a special two-step linking hack
186 # in order to both override the system select() and be able to
187 # get at the original system select().
189 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
190 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
191 # two-step linking hack below.
193 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
196 $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a
197 $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
202 # All platforms that are not AIX pre-4.2.
204 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
206 ifeq ($(OS_ARCH), WINNT)
207 ifeq ($(OS_TARGET),WIN16)
208 echo system windows >w16link
209 echo option map >>w16link
210 echo option stack=10K >>w16link
211 echo option heapsize=32K >>w16link
212 echo debug $(DEBUGTYPE) all >>w16link
213 echo name $@ >>w16link
216 echo library >>w16link
217 echo $(LIBPR), >>w16link
218 echo $(LIBPLC), >>w16link
219 echo winsock.lib >>w16link
222 link $(LDOPTS) $< $(LIBPR) $(LIBPLC) wsock32.lib -out:$@
225 ifeq ($(OS_ARCH),OS2)
226 $(LINK) $(LDOPTS) $< $(LIBPR) $(LIBPLC) $(OS_LIBS) $(EXTRA_LIBS) -o $@
228 $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPR) $(LIBPLC) $(EXTRA_LIBS) -o $@