2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 topsrcdir
= @top_srcdir@
14 include $(MOD_DEPTH
)/config
/autoconf.mk
16 include $(topsrcdir
)/config
/config.mk
181 ifeq ($(OS_ARCH
),WINCE
)
182 CFLAGS
+= -FImozce_shunt.h
-Zi
-UDEBUG
-DNDEBUG
183 LDOPTS
+= -link
$(DIST
)/lib
/mozce_shunt.lib ws2.lib
-DEBUG
-DEBUGTYPE
:CV
-INCREMENTAL
:NO
-PDB
:$(@
:.exe
=.pdb
)
186 ifeq ($(OS_TARGET
),OS2
)
194 ifeq (,$(filter-out WINCE WINNT OS2
,$(OS_ARCH
)))
202 PROGS
= $(addprefix $(OBJDIR
)/, $(CSRCS
:.c
=$(PROG_SUFFIX
)))
206 INCLUDES
= -I
$(dist_includedir
) -I
$(topsrcdir
)/pr
/include -I
$(topsrcdir
)/pr
/include/private
208 ifeq ($(OS_ARCH
), WINNT
)
210 EXTRA_LIBS
+= -lws2_32
212 EXTRA_LIBS
+= ws2_32.lib
213 LDOPTS
= -NOLOGO
-DEBUG
-DEBUGTYPE
:CV
-INCREMENTAL
:NO
214 CFLAGS
+= -Fd
$(@
:.
$(OBJ_SUFFIX
)=.pdb
)
216 LDOPTS
+= -PROFILE
-MAP
221 ifeq ($(OS_ARCH
),OS2
)
222 EXTRA_LIBS
= $(OS_LIBS
)
223 LDOPTS
= -Zomf
-Zlinker
/PM
:VIO
-Zlinker
/ST
:0x64000
226 ifneq ($(OS_ARCH
), WINNT
)
227 # Use an absolute pathname as the runtime library path (for the -R
228 # or -rpath linker option or the LD_RUN_PATH environment variable).
229 ifeq (,$(patsubst /%,,$(DIST
)))
230 # $(DIST) is already an absolute pathname.
231 ABSOLUTE_LIB_DIR
= $(dist_libdir
)
233 # $(DIST) is a relative pathname: prepend the current directory.
235 ABSOLUTE_LIB_DIR
= $(PWD
)/$(dist_libdir
)
239 ifeq ($(OS_ARCH
), HP-UX
)
240 LDOPTS
+= -z
-Wl
,+s
,+b
,$(ABSOLUTE_LIB_DIR
)
244 ifeq ($(USE_PTHREADS
),1)
245 EXTRA_LIBS
= $(LIBPTHREAD
)
250 ifeq ($(OS_ARCH
),AIX
)
251 LDOPTS
+= -blibpath
:$(ABSOLUTE_LIB_DIR
):/usr
/lib
:/lib
252 ifneq ($(OS_ARCH
)$(OS_RELEASE
),AIX4.1
)
259 ifeq ($(OS_ARCH
), SunOS
)
261 LDOPTS
+= -Xlinker
-R
-Xlinker
$(ABSOLUTE_LIB_DIR
)
263 ifeq ($(USE_CPLUS
), 1)
266 LDOPTS
+= -R
$(ABSOLUTE_LIB_DIR
)
270 EXTRA_LIBS
= -lpthread
274 ifeq (,$(filter-out Linux GNU GNU_
%,$(OS_ARCH
)))
275 LDOPTS
+= -Xlinker
-rpath
$(ABSOLUTE_LIB_DIR
)
276 ifeq ($(USE_PTHREADS
),1)
277 EXTRA_LIBS
= -lpthread
281 ifeq ($(OS_ARCH
), SCOOS
)
282 # SCO Unix needs to link against -lsocket again even though we
283 # already linked with these system libraries when we built libnspr.so.
284 EXTRA_LIBS
= -lsocket
285 # This hardcodes in the executable programs the directory to find
286 # libnspr.so etc. at program startup. Equivalent to the -R or -rpath
287 # option for ld on other platforms.
288 export LD_RUN_PATH
= $(ABSOLUTE_LIB_DIR
)
291 ifeq ($(OS_ARCH
),OpenUNIX
)
292 export LD_RUN_PATH
= $(ABSOLUTE_LIB_DIR
)
293 ifeq ($(USE_PTHREADS
),1)
298 ifeq ($(OS_ARCH
), UNIXWARE
)
299 export LD_RUN_PATH
= $(ABSOLUTE_LIB_DIR
)
302 ifeq ($(OS_ARCH
),FreeBSD
)
303 ifeq ($(USE_PTHREADS
),1)
306 LDOPTS
+= -Xlinker
-R
$(ABSOLUTE_LIB_DIR
)
309 ifeq ($(OS_ARCH
),OpenBSD
)
310 ifeq ($(USE_PTHREADS
),1)
315 ifeq ($(OS_ARCH
),BSD_OS
)
316 ifneq ($(OS_RELEASE
),1.1)
321 ifeq ($(OS_ARCH
),RISCOS
)
325 ifeq ($(USE_PTHREADS
),1)
326 LIBPTHREAD
= -lpthread
327 ifeq ($(OS_ARCH
),AIX
)
328 LIBPTHREAD
= -lpthreads
330 ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX
,$(OS_ARCH
)))
335 ifeq ($(OS_TARGET
),Android
)
337 XCFLAGS
= $(OS_CFLAGS
)
340 #####################################################
344 #####################################################
346 include $(topsrcdir
)/config
/rules.mk
349 ifeq ($(OS_ARCH
),AIX
)
350 ifeq ($(OS_RELEASE
),4.1)
351 ifneq ($(USE_PTHREADS
), 1)
357 ifeq ($(AIX_PRE_4_2
),1)
359 # AIX releases prior to 4.2 need a special two-step linking hack
360 # in order to both override the system select() and be able to
361 # get at the original system select().
363 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
364 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
365 # two-step linking hack below.
367 $(OBJDIR
)/%: $(OBJDIR
)/%.
$(OBJ_SUFFIX
)
370 $(CC
) $(AIX_LINK_OPTS
) -o
$(AIX_TMP
) $< $(dist_libdir
)/libnspr
$(MOD_MAJOR_VERSION
).a
371 $(CC
) -o
$@
$(AIX_TMP
) $(AIX_WRAP
)
376 # All platforms that are not AIX pre-4.2.
378 $(OBJDIR
)/%$(PROG_SUFFIX
): $(OBJDIR
)/%.
$(OBJ_SUFFIX
)
380 ifeq ($(NS_USE_GCC
)_
$(OS_ARCH
),_WINNT
)
381 link
$(LDOPTS
) $(EXTRA_LDOPTS
) $< $(LIBPLC
) $(LIBNSPR
) $(EXTRA_LIBS
) -out
:$@
383 @if
test -f
$@.manifest
; then \
384 $(MT
) -NOLOGO
-MANIFEST
$@.manifest
-OUTPUTRESOURCE
:$@\
;1; \
389 $(PURE
) $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBNSPR
) $(EXTRA_LIBS
) -o
$@
397 # The following tests call BSD socket functions, so they need to link
398 # with -lsocket on some platforms.
399 ifeq ($(OS_ARCH
),SunOS
)
401 $(OBJDIR
)/gethost
: $(OBJDIR
)/gethost.o
402 $(PURE
) $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBNSPR
) -lsocket
$(EXTRA_LIBS
) -o
$@
404 $(OBJDIR
)/prpoll
: $(OBJDIR
)/prpoll.o
405 $(PURE
) $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBNSPR
) -lsocket
$(EXTRA_LIBS
) -o
$@
408 ifeq ($(USE_PTHREADS
), 1)
409 $(OBJDIR
)/attach
: $(OBJDIR
)/attach.o
410 $(PURE
) $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBNSPR
) $(LIBPTHREAD
) $(EXTRA_LIBS
) -o
$@
411 $(OBJDIR
)/foreign
: $(OBJDIR
)/foreign.o
412 $(PURE
) $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBNSPR
) $(LIBPTHREAD
) $(EXTRA_LIBS
) -o
$@
413 $(OBJDIR
)/provider
: $(OBJDIR
)/provider.o
414 $(PURE
) $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBNSPR
) $(LIBPTHREAD
) $(EXTRA_LIBS
) -o
$@
415 $(OBJDIR
)/socket
: $(OBJDIR
)/socket.o
416 $(PURE
) $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBNSPR
) $(LIBPTHREAD
) $(EXTRA_LIBS
) -o
$@
417 $(OBJDIR
)/testfile
: $(OBJDIR
)/testfile.o
418 $(PURE
) $(CC
) $(XCFLAGS
) $< $(LDOPTS
) $(LIBPLC
) $(LIBNSPR
) $(LIBPTHREAD
) $(EXTRA_LIBS
) -o
$@
422 # Run the test programs with no arguments
424 # Test output goes to the file pointed to by the environment variable
425 # NSPR_TEST_LOGFILE, if set, else to /dev/null
428 PROGRAMS
= $(notdir $(PROGS
))
429 ifdef NSPR_TEST_LOGFILE
430 LOGFILE
= $(NSPR_TEST_LOGFILE
)
432 ifeq (,$(filter-out WINNT OS2
,$(OS_ARCH
)))
439 ifeq ($(OS_TARGET
),Linux
)
445 runtests
:: $(PROGS
) ALWAYS
446 $(topsrcdir
)/pr
/tests
/runtests.sh
$(DIST
)