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
55 ifeq (,$(filter-out WINCE WINNT OS2
,$(OS_ARCH
)))
59 ifeq (,$(filter-out WINCE WINNT OS2
,$(OS_ARCH
)))
65 PROGS
= $(addprefix $(OBJDIR
)/, $(CSRCS
:.c
=$(PROG_SUFFIX
)))
67 TARGETS
= $(PROGS
) $(OBJS
)
69 INCLUDES
= -I
$(dist_includedir
)
71 # Setting the variables LDOPTS and LIBPR. We first initialize
72 # them to the default values, then adjust them for some platforms.
73 LDOPTS
= -L
$(dist_libdir
)
74 LIBPR
= -lnspr
$(MOD_MAJOR_VERSION
)
75 LIBPLC
= -lplc
$(MOD_MAJOR_VERSION
)
76 LIBPLDS
= -lplds
$(MOD_MAJOR_VERSION
)
78 ifeq (,$(filter-out WINCE WINNT
, $(OS_ARCH
)))
79 LDOPTS
= -NOLOGO
-DEBUG
-INCREMENTAL
:NO
80 ifeq (,$(filter-out WIN95 WINCE WINMO
, $(OS_TARGET
)))
81 LIBPR
= $(dist_libdir
)/nspr
$(MOD_MAJOR_VERSION
).
$(LIB_SUFFIX
)
82 LIBPLC
= $(dist_libdir
)/plc
$(MOD_MAJOR_VERSION
).
$(LIB_SUFFIX
)
83 LIBPLDS
= $(dist_libdir
)/plds
$(MOD_MAJOR_VERSION
).
$(LIB_SUFFIX
)
85 LIBPR
= $(dist_libdir
)/libnspr
$(MOD_MAJOR_VERSION
).
$(LIB_SUFFIX
)
86 LIBPLC
= $(dist_libdir
)/libplc
$(MOD_MAJOR_VERSION
).
$(LIB_SUFFIX
)
87 LIBPLDS
= $(dist_libdir
)/libplds
$(MOD_MAJOR_VERSION
).
$(LIB_SUFFIX
)
92 LDOPTS
+= -Zomf
-Zlinker
/PM
:VIO
95 ifneq ($(OS_ARCH
), WINNT
)
99 ifeq ($(OS_ARCH
), IRIX
)
100 LDOPTS
+= -rpath
$(PWD
)/$(dist_libdir
)
103 ifeq ($(OS_ARCH
), Linux
)
104 ifeq ($(OS_RELEASE
), 1.2)
107 LDOPTS
+= -Xlinker
-rpath
$(PWD
)/$(dist_libdir
)
108 ifeq ($(USE_PTHREADS
),1)
109 EXTRA_LIBS
= -lpthread
114 ifeq (,$(filter-out OpenBSD
,$(OS_ARCH
)))
115 ifeq ($(USE_PTHREADS
),1)
116 EXTRA_LIBS
= -lpthread
120 ifeq ($(OS_ARCH
), OSF1
)
121 LDOPTS
+= -rpath
$(PWD
)/$(dist_libdir
) -lpthread
124 ifeq ($(OS_ARCH
), HP-UX
)
125 LDOPTS
+= -Wl
,+s
,+b
,$(PWD
)/$(dist_libdir
)
129 ifeq ($(OS_ARCH
),AIX
)
130 LDOPTS
+= -blibpath
:$(PWD
)/$(dist_libdir
):/usr
/lib
:/lib
131 LIBPR
= -lnspr
$(MOD_MAJOR_VERSION
)_shr
132 LIBPLC
= -lplc
$(MOD_MAJOR_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
), NCR
)
155 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
156 # implicitly by $(CC)) again even though we already linked with these
157 # system libraries when we built libnspr.so.
158 EXTRA_LIBS
= -lsocket
-lnsl
159 # This hardcodes in the executable programs the directory to find
160 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
161 # option for ld on other platforms.
162 export LD_RUN_PATH
= $(PWD
)/$(dist_libdir
)
165 ifeq ($(OS_TARGET
),Android
)
166 LDOPTS
= $(OS_LDFLAGS
) $(WRAP_MALLOC_LIB
)
169 #####################################################
173 #####################################################
175 include $(topsrcdir
)/config
/rules.mk
178 ifeq ($(OS_ARCH
),AIX
)
179 ifneq ($(OS_RELEASE
),4.2)
180 ifneq ($(USE_PTHREADS
), 1)
186 ifeq ($(AIX_PRE_4_2
),1)
188 # AIX releases prior to 4.2 need a special two-step linking hack
189 # in order to both override the system select() and be able to
190 # get at the original system select().
192 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
193 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
194 # two-step linking hack below.
196 $(OBJDIR
)/%: $(OBJDIR
)/%.
$(OBJ_SUFFIX
)
199 $(CC
) $(AIX_LINK_OPTS
) -o
$(AIX_TMP
) $< $(dist_libdir
)/libnspr
$(MOD_MAJOR_VERSION
).a
200 $(CC
) -o
$@
$(AIX_TMP
) $(AIX_WRAP
)
205 # All platforms that are not AIX pre-4.2.
207 $(OBJDIR
)/%$(PROG_SUFFIX
): $(OBJDIR
)/%.
$(OBJ_SUFFIX
)
210 ifeq ($(OS_ARCH
), WINNT
)
211 link
$(LDOPTS
) $< $(LIBPLC
) $(LIBPLDS
) $(LIBPR
) wsock32.lib
-out
:$@
213 ifeq ($(OS_ARCH
), WINCE
)
214 $(LD
) $(LDOPTS
) $< $(LIBPLC
) $(LIBPLDS
) $(LIBPR
) ws2.lib
-out
:$@
216 ifeq ($(OS_ARCH
),OS2
)
217 $(LINK
) $(EXEFLAGS
) $(LDOPTS
) $< $(LIBPLC
) $(LIBPLDS
) $(LIBPR
) $(OS_LIBS
) $(EXTRA_LIBS
)
219 $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBPLDS
) $(LIBPR
) $(EXTRA_LIBS
) -o
$@