CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / nsprpub / lib / tests / Makefile.in
blob839fb54042a1707b1253f42e7ef75ee1c4d5816b
1 #
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
13 # License.
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.
22 # Contributor(s):
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 *****
38 #! gmake
40 MOD_DEPTH = ../..
41 topsrcdir = @top_srcdir@
42 srcdir = @srcdir@
43 VPATH = @srcdir@
45 include $(MOD_DEPTH)/config/autoconf.mk
47 include $(topsrcdir)/config/config.mk
49 CSRCS = \
50 arena.c \
51 base64t.c \
52 getopt.c \
53 string.c
55 ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
56 CSRCS += arena.c
57 endif
59 ifeq (,$(filter-out WINCE WINNT OS2,$(OS_ARCH)))
60 PROG_SUFFIX = .exe
61 else
62 PROG_SUFFIX =
63 endif
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)
84 else
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)
88 endif
89 endif
91 ifeq ($(OS_ARCH),OS2)
92 LDOPTS += -Zomf -Zlinker /PM:VIO
93 endif
95 ifneq ($(OS_ARCH), WINNT)
96 PWD = $(shell pwd)
97 endif
99 ifeq ($(OS_ARCH), IRIX)
100 LDOPTS += -rpath $(PWD)/$(dist_libdir)
101 endif
103 ifeq ($(OS_ARCH), Linux)
104 ifeq ($(OS_RELEASE), 1.2)
105 EXTRA_LIBS = -ldl
106 else
107 LDOPTS += -Xlinker -rpath $(PWD)/$(dist_libdir)
108 ifeq ($(USE_PTHREADS),1)
109 EXTRA_LIBS = -lpthread
110 endif
111 endif
112 endif
114 ifeq (,$(filter-out OpenBSD,$(OS_ARCH)))
115 ifeq ($(USE_PTHREADS),1)
116 EXTRA_LIBS = -lpthread
117 endif
118 endif
120 ifeq ($(OS_ARCH), OSF1)
121 LDOPTS += -rpath $(PWD)/$(dist_libdir) -lpthread
122 endif
124 ifeq ($(OS_ARCH), HP-UX)
125 LDOPTS += -Wl,+s,+b,$(PWD)/$(dist_libdir)
126 endif
128 # AIX
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
133 endif
135 # Solaris
136 ifeq ($(OS_ARCH), SunOS)
137 ifneq ($(OS_RELEASE), 4.1.3_U1)
138 ifdef NS_USE_GCC
139 LDOPTS += -Xlinker -R -Xlinker $(PWD)/$(dist_libdir)
140 else
141 LDOPTS += -R $(PWD)/$(dist_libdir)
142 endif
143 endif
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)
148 ifdef USE_PTHREADS
149 EXTRA_LIBS = -lpthread
150 endif
151 endif
152 endif # SunOS
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)
163 endif
165 ifeq ($(OS_TARGET),Android)
166 LDOPTS = $(OS_LDFLAGS) $(WRAP_MALLOC_LIB)
167 endif
169 #####################################################
171 # The rules
173 #####################################################
175 include $(topsrcdir)/config/rules.mk
177 AIX_PRE_4_2 = 0
178 ifeq ($(OS_ARCH),AIX)
179 ifneq ($(OS_RELEASE),4.2)
180 ifneq ($(USE_PTHREADS), 1)
181 #AIX_PRE_4_2 = 1
182 endif
183 endif
184 endif
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)
197 @$(MAKE_OBJDIR)
198 rm -f $@ $(AIX_TMP)
199 $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(MOD_MAJOR_VERSION).a
200 $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
201 rm -f $(AIX_TMP)
203 else
205 # All platforms that are not AIX pre-4.2.
207 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
208 @$(MAKE_OBJDIR)
210 ifeq ($(OS_ARCH), WINNT)
211 link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) wsock32.lib -out:$@
212 else
213 ifeq ($(OS_ARCH), WINCE)
214 $(LD) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) ws2.lib -out:$@
215 else
216 ifeq ($(OS_ARCH),OS2)
217 $(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
218 else
219 $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBPLC) $(LIBPLDS) $(LIBPR) $(EXTRA_LIBS) -o $@
220 endif
221 endif
222 endif
223 endif
225 export:: $(TARGETS)
226 clean::
227 rm -f $(TARGETS)