Upload Tizen:Base source
[toolchains/nspr.git] / mozilla / nsprpub / lib / msgc / tests / Makefile.in
1
2 # ***** BEGIN LICENSE BLOCK *****
3 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 #
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/
9 #
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.
14 #
15 # The Original Code is the Netscape Portable Runtime (NSPR).
16 #
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.
21 #
22 # Contributor(s):
23 #
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.
35 #
36 # ***** END LICENSE BLOCK *****
37
38 #! gmake
39
40 MOD_DEPTH       = ../../..
41 topsrcdir       = @top_srcdir@
42 srcdir          = @srcdir@
43 VPATH           = @srcdir@
44
45 include $(MOD_DEPTH)/config/autoconf.mk
46
47 include $(topsrcdir)/config/config.mk
48
49 ifeq ($(OS_TARGET), OS2)
50 OS_CFLAGS = $(OS_EXE_CFLAGS)
51 endif
52
53 CSRCS = gc1.c thrashgc.c
54
55 ifeq (,$(filter-out WINNT OS2,$(OS_ARCH)))
56 PROG_SUFFIX = .exe
57 else
58 PROG_SUFFIX =
59 endif
60
61 PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=$(PROG_SUFFIX)))
62
63 TARGETS = $(PROGS) $(OBJS)
64
65 INCLUDES = -I$(dist_includedir)
66
67 # Setting the variables LDOPTS and LIBPR.  We first initialize
68 # them to the default values, then adjust them for some platforms.
69 LDOPTS = -L$(dist_libdir)
70 NSPR_VERSION = $(MOD_MAJOR_VERSION)
71 GC_VERSION = $(MOD_MAJOR_VERSION)
72 LIBPR = -lnspr$(NSPR_VERSION)
73 LIBPLC = -lplc$(NSPR_VERSION)
74 LIBGC = -lmsgc$(GC_VERSION)
75
76 ifeq ($(OS_ARCH), WINNT)
77   LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
78   LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
79   LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
80   LIBGC= $(dist_libdir)/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
81 endif
82
83 ifeq ($(OS_ARCH),OS2)
84   LDOPTS += -Zomf -Zlinker /PM:VIO
85 endif
86
87 ifneq ($(OS_ARCH), WINNT)
88 PWD = $(shell pwd)
89 endif
90
91 ifeq ($(OS_ARCH), IRIX)
92 LDOPTS += -rpath $(PWD)/$(dist_libdir) -rdata_shared
93
94 # For 6.x machines, include this flag
95 ifeq ($(basename $(OS_RELEASE)),6)
96 ifeq ($(USE_N32),1)
97 LDOPTS += -n32
98 else
99 LDOPTS += -32
100 endif
101 endif
102
103 endif
104
105 ifeq ($(OS_ARCH), OSF1)
106 # I haven't figured out how to pass -rpath to cc on OSF1 V3.2, so
107 # we do static linking.
108 ifeq ($(OS_RELEASE), V3.2)
109   LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
110   LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
111   LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a
112   EXTRA_LIBS = -lc_r
113 else
114   LDOPTS += -rpath $(PWD)/$(dist_libdir)
115 endif
116 endif
117
118 ifeq ($(OS_ARCH), HP-UX)
119 LDOPTS += -z -Wl,+s,+b,$(PWD)/$(dist_libdir)
120 endif
121
122 # AIX
123 ifeq ($(OS_ARCH),AIX)
124 LDOPTS += -blibpath:$(PWD)/$(dist_libdir):/usr/lib:/lib
125 ifeq ($(OS_ARCH)$(OS_RELEASE),AIX4.1)
126 LIBPR = -lnspr$(NSPR_VERSION)_shr
127 LIBPLC = -lplc$(NSPR_VERSION)_shr
128 LIBGC = -lmsgc$(GC_VERSION)_shr
129 else
130 LDOPTS += -brtl
131 EXTRA_LIBS = -ldl
132 endif
133 endif
134
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
144
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
153
154 ifeq ($(OS_ARCH),NEC)
155 EXTRA_LIBS = $(OS_LIBS)
156 # This hardcodes in the executable programs the directory to find
157 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
158 # option for ld on other platforms.
159 export LD_RUN_PATH = $(PWD)/$(dist_libdir)
160 endif
161
162 ifeq ($(OS_ARCH), NCR)
163 # XXX: We see some strange problems when we link with libnspr.so.
164 # So for now we use static libraries on NCR.  The shared library
165 # stuff below is commented out.
166 LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).a
167 LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).a
168 LIBGC = $(dist_libdir)/libmsgc$(GC_VERSION).a
169 EXTRA_LIBS = -lsocket -lnsl -ldl
170
171 # NCR needs to link against -lsocket -lnsl (and -lc, which is linked
172 # implicitly by $(CC)) again even though we already linked with these
173 # system libraries when we built libnspr.so.
174 #EXTRA_LIBS = -lsocket -lnsl
175 # This hardcodes in the executable programs the directory to find
176 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
177 # option for ld on other platforms.
178 #export LD_RUN_PATH = $(PWD)/$(dist_libdir)
179 endif
180
181 ifeq ($(OS_ARCH), Linux)
182 ifeq ($(OS_RELEASE), 1.2)
183 EXTRA_LIBS = -ldl
184 endif
185 endif
186
187 ifeq ($(OS_ARCH), SCOOS)
188 # SCO Unix needs to link against -lsocket again even though we
189 # already linked with these system libraries when we built libnspr.so.
190 EXTRA_LIBS = -lsocket
191 # This hardcodes in the executable programs the directory to find
192 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath 
193 # option for ld on other platforms.
194 export LD_RUN_PATH = $(PWD)/$(dist_libdir)
195 endif
196
197 ifeq ($(OS_ARCH),SINIX)
198 EXTRA_LIBS = -lsocket -lnsl -lresolv -ldl
199 # This hardcodes in the executable programs the directory to find
200 # libnspr.so etc. at program startup.  Equivalent to the -R or -rpath
201 # option for ld on other platforms.
202 export LD_RUN_PATH = $(PWD)/$(dist_libdir)
203 endif
204
205 ifeq ($(OS_ARCH), UNIXWARE)
206 export LD_RUN_PATH = $(PWD)/$(dist_libdir)
207 endif
208
209 ifeq ($(OS_ARCH),BSD_OS)
210 EXTRA_LIBS = -ldl
211 endif
212
213 ifeq ($(OS_ARCH),DGUX)
214 EXTRA_LIBS = -lsocket -lnsl -ldl
215 endif
216
217 #####################################################
218 #
219 # The rules
220 #
221 #####################################################
222
223 include $(topsrcdir)/config/rules.mk
224
225 AIX_PRE_4_2 = 0
226 ifeq ($(OS_ARCH),AIX)
227 ifneq ($(OS_RELEASE),4.2)
228 ifneq ($(USE_PTHREADS), 1)
229 #AIX_PRE_4_2 = 1
230 endif
231 endif
232 endif
233
234 ifeq ($(AIX_PRE_4_2),1)
235
236 # AIX releases prior to 4.2 need a special two-step linking hack
237 # in order to both override the system select() and be able to 
238 # get at the original system select().
239 #
240 # We use a pattern rule in ns/nspr20/config/rules.mk to generate
241 # the .$(OBJ_SUFFIX) file from the .c source file, then do the
242 # two-step linking hack below.
243
244 $(OBJDIR)/%: $(OBJDIR)/%.$(OBJ_SUFFIX)
245         @$(MAKE_OBJDIR)
246         rm -f $@ $(AIX_TMP)
247         $(CC) $(AIX_LINK_OPTS) -o $(AIX_TMP) $< $(dist_libdir)/libnspr$(NSPR_VERSION).a
248         $(CC) -o $@ $(AIX_TMP) $(AIX_WRAP)
249         rm -f $(AIX_TMP)
250
251 else
252
253 # All platforms that are not AIX pre-4.2.
254
255 $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
256         @$(MAKE_OBJDIR)
257 ifeq ($(OS_ARCH), WINNT)
258         link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
259 else
260 ifeq ($(OS_ARCH),OS2)
261         $(LINK) $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS) -o $@
262 else
263         $(CC) $(XCFLAGS) $< $(LDOPTS) $(LIBGC) $(LIBPLC) $(LIBPR) $(EXTRA_LIBS) -o $@
264 endif
265 endif
266 endif
267
268 export:: $(TARGETS)
269 clean::
270         rm -f $(TARGETS)