1 |
siliconforks |
332 |
# -*- Mode: makefile -*- |
2 |
|
|
# |
3 |
|
|
# ***** BEGIN LICENSE BLOCK ***** |
4 |
|
|
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
5 |
|
|
# |
6 |
|
|
# The contents of this file are subject to the Mozilla Public License Version |
7 |
|
|
# 1.1 (the "License"); you may not use this file except in compliance with |
8 |
|
|
# the License. You may obtain a copy of the License at |
9 |
|
|
# http://www.mozilla.org/MPL/ |
10 |
|
|
# |
11 |
|
|
# Software distributed under the License is distributed on an "AS IS" basis, |
12 |
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
13 |
|
|
# for the specific language governing rights and limitations under the |
14 |
|
|
# License. |
15 |
|
|
# |
16 |
|
|
# The Original Code is Mozilla Communicator client code, released |
17 |
|
|
# March 31, 1998. |
18 |
|
|
# |
19 |
|
|
# The Initial Developer of the Original Code is |
20 |
|
|
# Netscape Communications Corporation. |
21 |
|
|
# Portions created by the Initial Developer are Copyright (C) 1998 |
22 |
|
|
# the Initial Developer. All Rights Reserved. |
23 |
|
|
# |
24 |
|
|
# Contributor(s): |
25 |
|
|
# |
26 |
|
|
# Alternatively, the contents of this file may be used under the terms of |
27 |
|
|
# either of the GNU General Public License Version 2 or later (the "GPL"), |
28 |
|
|
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
29 |
|
|
# in which case the provisions of the GPL or the LGPL are applicable instead |
30 |
|
|
# of those above. If you wish to allow use of your version of this file only |
31 |
|
|
# under the terms of either the GPL or the LGPL, and not to allow others to |
32 |
|
|
# use your version of this file under the terms of the MPL, indicate your |
33 |
|
|
# decision by deleting the provisions above and replace them with the notice |
34 |
|
|
# and other provisions required by the GPL or the LGPL. If you do not delete |
35 |
|
|
# the provisions above, a recipient may use your version of this file under |
36 |
|
|
# the terms of any one of the MPL, the GPL or the LGPL. |
37 |
|
|
# |
38 |
|
|
# ***** END LICENSE BLOCK ***** |
39 |
|
|
|
40 |
siliconforks |
399 |
DEPTH = . |
41 |
siliconforks |
332 |
topsrcdir = @top_srcdir@ |
42 |
|
|
srcdir = @srcdir@ |
43 |
|
|
|
44 |
siliconforks |
399 |
DIRS = config |
45 |
|
|
|
46 |
siliconforks |
332 |
include $(DEPTH)/config/autoconf.mk |
47 |
|
|
|
48 |
|
|
MODULE = js |
49 |
|
|
LIBRARY_NAME = mozjs |
50 |
|
|
GRE_MODULE = 1 |
51 |
|
|
|
52 |
siliconforks |
399 |
PROGRAM = js$(BIN_SUFFIX) |
53 |
|
|
# The shell uses some 'HIDDEN' symbols to produce statistics, so we |
54 |
|
|
# link directly against the .o files, not against the JS shared |
55 |
|
|
# library. |
56 |
|
|
PROGOBJS = js.$(OBJ_SUFFIX) $(OBJS) |
57 |
|
|
LIBS = $(NSPR_LIBS) |
58 |
|
|
|
59 |
|
|
ifdef GNU_CXX |
60 |
|
|
ifdef INTEL_CXX |
61 |
siliconforks |
332 |
# icc gets special optimize flags |
62 |
|
|
ifdef MOZ_PROFILE_GENERATE |
63 |
|
|
MODULE_OPTIMIZE_FLAGS = -O0 |
64 |
|
|
else |
65 |
|
|
MODULE_OPTIMIZE_FLAGS = -O2 -ip |
66 |
|
|
#XXX: do we want different INTERP_OPTIMIZER flags here? |
67 |
|
|
endif |
68 |
siliconforks |
399 |
else # not INTEL_CXX |
69 |
siliconforks |
332 |
MODULE_OPTIMIZE_FLAGS = -Os -fstrict-aliasing $(MOZ_OPTIMIZE_SIZE_TWEAK) |
70 |
|
|
# Special optimization flags for jsinterp.c |
71 |
|
|
INTERP_OPTIMIZER = -O3 -fstrict-aliasing |
72 |
|
|
endif |
73 |
siliconforks |
399 |
else # not GNU_CXX |
74 |
siliconforks |
332 |
ifeq ($(OS_ARCH),SunOS) |
75 |
|
|
MODULE_OPTIMIZE_FLAGS = -xO4 |
76 |
|
|
endif |
77 |
|
|
ifeq ($(OS_ARCH),WINNT) |
78 |
siliconforks |
399 |
ifdef WINCE |
79 |
|
|
# -GL is not supported on windows mobile while we are using the arm-wince-link command |
80 |
|
|
MODULE_OPTIMIZE_FLAGS = -O2 |
81 |
|
|
else |
82 |
siliconforks |
332 |
MODULE_OPTIMIZE_FLAGS = -O2 -GL |
83 |
|
|
endif |
84 |
|
|
endif |
85 |
siliconforks |
399 |
endif |
86 |
siliconforks |
332 |
|
87 |
siliconforks |
399 |
|
88 |
siliconforks |
332 |
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) |
89 |
siliconforks |
403 |
# do not name the library "libjs3250.a" |
90 |
|
|
# LIBRARY_NAME = js$(MOZ_BITS)$(VERSION_NUMBER) |
91 |
siliconforks |
332 |
RESFILE = js$(MOZ_BITS)40.res |
92 |
|
|
endif |
93 |
|
|
|
94 |
|
|
# JavaScript must be built shared, even for static builds, as it is used by |
95 |
|
|
# other modules which are always built shared. Failure to do so results in |
96 |
|
|
# the js code getting copied into xpinstall and jsd as well as mozilla-bin, |
97 |
|
|
# and then the static data cells used for locking no longer work. |
98 |
|
|
|
99 |
|
|
ifndef JS_STATIC_BUILD |
100 |
|
|
FORCE_SHARED_LIB = 1 |
101 |
|
|
endif |
102 |
|
|
|
103 |
|
|
ifeq (86,$(findstring 86,$(OS_TEST))) |
104 |
|
|
ifeq (64,$(findstring 64,$(OS_TEST))) |
105 |
|
|
else |
106 |
|
|
DEFINES += -DAVMPLUS_IA32 |
107 |
|
|
NANOJIT_ARCH = i386 |
108 |
|
|
ENABLE_JIT = 1 |
109 |
|
|
endif |
110 |
|
|
endif |
111 |
|
|
|
112 |
|
|
ifeq (arm,$(findstring arm,$(OS_TEST))) |
113 |
|
|
DEFINES += -DAVMPLUS_ARM |
114 |
|
|
NANOJIT_ARCH = ARM |
115 |
|
|
ENABLE_JIT = 1 |
116 |
|
|
endif |
117 |
|
|
|
118 |
|
|
ifneq (,$(filter Linux Darwin SunOS FreeBSD,$(OS_ARCH))) |
119 |
|
|
DEFINES += -DAVMPLUS_UNIX |
120 |
|
|
endif |
121 |
|
|
|
122 |
|
|
ifeq ($(OS_ARCH),Linux) |
123 |
|
|
DEFINES += -DAVMPLUS_LINUX |
124 |
|
|
endif |
125 |
|
|
|
126 |
|
|
ifeq ($(OS_ARCH),WINNT) |
127 |
|
|
DEFINES += -DAVMPLUS_WIN32 |
128 |
|
|
endif |
129 |
|
|
|
130 |
|
|
VPATH = $(srcdir) |
131 |
|
|
|
132 |
|
|
CPPSRCS = \ |
133 |
|
|
jsapi.cpp \ |
134 |
|
|
jsarena.cpp \ |
135 |
|
|
jsarray.cpp \ |
136 |
|
|
jsatom.cpp \ |
137 |
|
|
jsbool.cpp \ |
138 |
|
|
jscntxt.cpp \ |
139 |
|
|
jsdate.cpp \ |
140 |
|
|
jsdbgapi.cpp \ |
141 |
|
|
jsdhash.cpp \ |
142 |
|
|
jsdtoa.cpp \ |
143 |
|
|
jsemit.cpp \ |
144 |
|
|
jsexn.cpp \ |
145 |
|
|
jsfun.cpp \ |
146 |
|
|
jsgc.cpp \ |
147 |
|
|
jshash.cpp \ |
148 |
|
|
jsinterp.cpp \ |
149 |
|
|
jsinvoke.cpp \ |
150 |
|
|
jsiter.cpp \ |
151 |
|
|
jslock.cpp \ |
152 |
|
|
jslog2.cpp \ |
153 |
|
|
jslong.cpp \ |
154 |
|
|
jsmath.cpp \ |
155 |
|
|
jsnum.cpp \ |
156 |
|
|
jsobj.cpp \ |
157 |
|
|
json.cpp \ |
158 |
|
|
jsopcode.cpp \ |
159 |
|
|
jsparse.cpp \ |
160 |
|
|
jsprf.cpp \ |
161 |
|
|
jsregexp.cpp \ |
162 |
|
|
jsscan.cpp \ |
163 |
|
|
jsscope.cpp \ |
164 |
|
|
jsscript.cpp \ |
165 |
|
|
jsstr.cpp \ |
166 |
|
|
jsutil.cpp \ |
167 |
|
|
jsxdrapi.cpp \ |
168 |
|
|
jsxml.cpp \ |
169 |
|
|
prmjtime.cpp \ |
170 |
|
|
$(NULL) |
171 |
|
|
|
172 |
|
|
ifdef HAVE_DTRACE |
173 |
|
|
CSRCS += \ |
174 |
|
|
jsdtracef.c |
175 |
|
|
endif |
176 |
|
|
|
177 |
siliconforks |
399 |
INSTALLED_HEADERS = \ |
178 |
|
|
js-config.h \ |
179 |
siliconforks |
332 |
jsautocfg.h \ |
180 |
|
|
jsautokw.h \ |
181 |
|
|
js.msg \ |
182 |
|
|
jsapi.h \ |
183 |
|
|
jsarray.h \ |
184 |
|
|
jsarena.h \ |
185 |
|
|
jsatom.h \ |
186 |
|
|
jsbit.h \ |
187 |
|
|
jsbool.h \ |
188 |
|
|
jsclist.h \ |
189 |
|
|
jscntxt.h \ |
190 |
|
|
jscompat.h \ |
191 |
|
|
jsdate.h \ |
192 |
|
|
jsdbgapi.h \ |
193 |
|
|
jsdhash.h \ |
194 |
|
|
jsdtoa.h \ |
195 |
|
|
jsemit.h \ |
196 |
|
|
jsfun.h \ |
197 |
|
|
jsgc.h \ |
198 |
|
|
jshash.h \ |
199 |
|
|
jsinterp.h \ |
200 |
|
|
jsiter.h \ |
201 |
|
|
jslock.h \ |
202 |
|
|
jslong.h \ |
203 |
|
|
jsmath.h \ |
204 |
|
|
jsnum.h \ |
205 |
|
|
jsobj.h \ |
206 |
|
|
json.h \ |
207 |
|
|
jsopcode.tbl \ |
208 |
|
|
jsopcode.h \ |
209 |
|
|
jsotypes.h \ |
210 |
|
|
jsparse.h \ |
211 |
|
|
jsprf.h \ |
212 |
|
|
jsproto.tbl \ |
213 |
|
|
jsprvtd.h \ |
214 |
|
|
jspubtd.h \ |
215 |
|
|
jsregexp.h \ |
216 |
|
|
jsscan.h \ |
217 |
|
|
jsscope.h \ |
218 |
|
|
jsscript.h \ |
219 |
|
|
jsstddef.h \ |
220 |
|
|
jsstr.h \ |
221 |
|
|
jstracer.h \ |
222 |
|
|
jstypes.h \ |
223 |
|
|
jsutil.h \ |
224 |
|
|
jsversion.h \ |
225 |
|
|
jsxdrapi.h \ |
226 |
|
|
jsxml.h \ |
227 |
|
|
$(NULL) |
228 |
|
|
|
229 |
siliconforks |
403 |
# unconditionally disable JIT |
230 |
|
|
ENABLE_JIT = |
231 |
siliconforks |
332 |
ifdef ENABLE_JIT |
232 |
|
|
VPATH += $(srcdir)/nanojit |
233 |
|
|
|
234 |
siliconforks |
399 |
INSTALLED_HEADERS += \ |
235 |
|
|
builtins.tbl \ |
236 |
|
|
jsbuiltins.h \ |
237 |
siliconforks |
332 |
Assembler.h \ |
238 |
|
|
LIR.h \ |
239 |
|
|
avmplus.h \ |
240 |
|
|
Fragmento.h \ |
241 |
|
|
Native.h \ |
242 |
|
|
Native$(NANOJIT_ARCH).h \ |
243 |
|
|
RegAlloc.h \ |
244 |
|
|
nanojit.h \ |
245 |
siliconforks |
399 |
TraceTreeDrawer.h \ |
246 |
siliconforks |
332 |
$(NULL) |
247 |
|
|
|
248 |
|
|
CPPSRCS += \ |
249 |
|
|
jstracer.cpp \ |
250 |
|
|
Assembler.cpp \ |
251 |
|
|
Fragmento.cpp \ |
252 |
|
|
LIR.cpp \ |
253 |
|
|
RegAlloc.cpp \ |
254 |
|
|
avmplus.cpp \ |
255 |
|
|
Native$(NANOJIT_ARCH).cpp \ |
256 |
|
|
jsbuiltins.cpp \ |
257 |
|
|
$(NULL) |
258 |
|
|
|
259 |
|
|
ifdef DEBUG |
260 |
|
|
CPPSRCS += TraceTreeDrawer.cpp |
261 |
|
|
endif |
262 |
|
|
|
263 |
|
|
DEFINES += -DFEATURE_NANOJIT -DJS_TRACER |
264 |
|
|
endif |
265 |
|
|
|
266 |
|
|
ifdef HAVE_DTRACE |
267 |
siliconforks |
399 |
INSTALLED_HEADERS += \ |
268 |
siliconforks |
332 |
jsdtracef.h \ |
269 |
siliconforks |
399 |
$(CURDIR)/javascript-trace.h \ |
270 |
siliconforks |
332 |
$(NULL) |
271 |
|
|
endif |
272 |
|
|
|
273 |
|
|
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) |
274 |
siliconforks |
399 |
INSTALLED_HEADERS += jscpucfg.h |
275 |
siliconforks |
332 |
endif |
276 |
|
|
|
277 |
|
|
JS_SAFE_ARENA = 1 |
278 |
|
|
|
279 |
|
|
DASH_R = -r |
280 |
|
|
|
281 |
|
|
ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH))) |
282 |
|
|
SDK_LIBRARY = $(IMPORT_LIBRARY) |
283 |
|
|
else |
284 |
|
|
SDK_LIBRARY = $(SHARED_LIBRARY) |
285 |
|
|
endif |
286 |
|
|
|
287 |
|
|
include $(topsrcdir)/config/config.mk |
288 |
|
|
|
289 |
|
|
EXTRA_DSO_LDOPTS += $(NSPR_LIBS) |
290 |
|
|
|
291 |
|
|
ifdef MOZ_MEMORY |
292 |
|
|
ifeq ($(OS_ARCH),SunOS) |
293 |
|
|
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib) |
294 |
|
|
endif |
295 |
|
|
endif |
296 |
|
|
|
297 |
|
|
# When using gcc the assembly is inlined in the C-file (see jslock.cpp) |
298 |
|
|
ifeq ($(OS_ARCH),SunOS) |
299 |
|
|
ifneq (86,$(findstring 86,$(OS_TEST))) |
300 |
|
|
ifndef GNU_CC |
301 |
|
|
ASFILES = lock_$(OS_ARCH).s |
302 |
|
|
endif |
303 |
|
|
endif |
304 |
|
|
endif |
305 |
|
|
|
306 |
|
|
ifndef BUILD_OPT |
307 |
|
|
MOCHAFILE = 1 |
308 |
|
|
endif |
309 |
|
|
|
310 |
|
|
ifndef NSBUILDROOT |
311 |
|
|
JSJAVA_STUBHEADERS = \ |
312 |
|
|
-I$(topsrcdir)/sun-java/include/_gen \ |
313 |
|
|
-I$(topsrcdir)/sun-java/netscape/javascript/_jri \ |
314 |
|
|
-I$(topsrcdir)/sun-java/netscape/security/_jri |
315 |
|
|
else |
316 |
|
|
JSJAVA_STUBHEADERS = -I$(JRI_GEN_DIR) -I$(JDK_GEN_DIR) |
317 |
|
|
endif |
318 |
|
|
|
319 |
|
|
JSJAVA_CFLAGS = \ |
320 |
|
|
-I$(topsrcdir)/sun-java/md-include \ |
321 |
|
|
-I$(topsrcdir)/sun-java/include \ |
322 |
|
|
$(JSJAVA_STUBHEADERS) |
323 |
|
|
|
324 |
|
|
# Define keyword generator before rules.mk, see bug 323979 comment 50 |
325 |
|
|
|
326 |
|
|
HOST_SIMPLE_PROGRAMS += host_jskwgen$(HOST_BIN_SUFFIX) |
327 |
|
|
GARBAGE += jsautokw.h host_jskwgen$(HOST_BIN_SUFFIX) |
328 |
|
|
|
329 |
|
|
HOST_SIMPLE_PROGRAMS += host_jsoplengen$(HOST_BIN_SUFFIX) |
330 |
|
|
GARBAGE += jsautooplen.h host_jsoplengen$(HOST_BIN_SUFFIX) |
331 |
|
|
|
332 |
|
|
USE_HOST_CXX = 1 |
333 |
|
|
|
334 |
|
|
ifdef HAVE_DTRACE |
335 |
|
|
ifneq ($(OS_ARCH),Darwin) |
336 |
|
|
DTRACE_PROBE_OBJ = $(LIBRARY_NAME)-dtrace.$(OBJ_SUFFIX) |
337 |
|
|
endif |
338 |
|
|
MOZILLA_DTRACE_SRC = $(srcdir)/javascript-trace.d |
339 |
|
|
endif |
340 |
|
|
|
341 |
|
|
include $(topsrcdir)/config/rules.mk |
342 |
|
|
|
343 |
siliconforks |
399 |
ifdef MOZ_SYNC_BUILD_FILES |
344 |
|
|
# Because the SpiderMonkey can be distributed and built independently |
345 |
|
|
# of the Mozilla source tree, it contains its own copies of many of |
346 |
|
|
# the files used by the top-level Mozilla build process, from the |
347 |
|
|
# 'config' and 'build' subtrees. |
348 |
|
|
# |
349 |
|
|
# To make it simpler to keep the copies in sync, we follow the policy |
350 |
|
|
# that the SpiderMonkey copies must always be exact copies of those in |
351 |
|
|
# the containing Mozilla tree. If you've made a change in one, it |
352 |
|
|
# belongs in the other as well. If the change isn't right for both |
353 |
|
|
# places, then that's something to bring up with the other developers. |
354 |
|
|
# |
355 |
|
|
# Some files are reasonable to diverge; for example, |
356 |
|
|
# js/config/autoconf.mk.in doesn't need most of the stuff in |
357 |
|
|
# config/autoconf.mk.in. |
358 |
|
|
check-sync-dirs = $(PYTHON) $(srcdir)/config/check-sync-dirs.py |
359 |
|
|
check:: |
360 |
|
|
$(check-sync-dirs) $(srcdir)/config $(MOZ_SYNC_BUILD_FILES)/config |
361 |
|
|
$(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build |
362 |
|
|
endif |
363 |
|
|
|
364 |
siliconforks |
332 |
# our build system doesn't handle subdir srcs very gracefully today |
365 |
|
|
export:: |
366 |
|
|
mkdir -p nanojit |
367 |
|
|
|
368 |
|
|
DEFINES += -DEXPORT_JS_API |
369 |
|
|
|
370 |
|
|
INCLUDES += -I$(srcdir) |
371 |
|
|
|
372 |
|
|
# MSVC '-Gy' cc flag and '/OPT:REF' linker flag cause JS_GetArgument and |
373 |
|
|
# JS_GetLocalVariable to be folded to the same address by the linker, |
374 |
|
|
# leading to a crash on startup. See bug 151066. So, in optimized builds, |
375 |
|
|
# add the /OPT:NOICF flag, which turns off 'identical COMDAT folding'. |
376 |
|
|
# |
377 |
|
|
# N.B.: 'identical COMDAT folding' that folds functions whose addresses |
378 |
|
|
# are taken violates the ISO C and C++ standards. |
379 |
|
|
ifndef MOZ_DEBUG |
380 |
|
|
ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH)) |
381 |
|
|
LDFLAGS += -OPT:NOICF |
382 |
|
|
endif |
383 |
|
|
endif |
384 |
|
|
|
385 |
|
|
GARBAGE += jscpucfg.o jsautocfg.h jsautocfg.tmp jscpucfg |
386 |
|
|
|
387 |
|
|
ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) |
388 |
|
|
TARGETS += jscpucfg$(HOST_BIN_SUFFIX) |
389 |
|
|
endif |
390 |
|
|
|
391 |
|
|
ifdef JS_SAFE_ARENA |
392 |
|
|
DEFINES += -DJS_USE_SAFE_ARENA |
393 |
|
|
endif |
394 |
|
|
|
395 |
|
|
ifdef JS_THREADSAFE |
396 |
|
|
DEFINES += -DJS_THREADSAFE |
397 |
|
|
endif |
398 |
|
|
|
399 |
|
|
ifdef JS_NO_THIN_LOCKS |
400 |
|
|
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS |
401 |
|
|
endif |
402 |
|
|
|
403 |
|
|
ifdef JS_VERSION |
404 |
|
|
DEFINES += -DJS_VERSION=$(JS_VERSION) |
405 |
|
|
endif |
406 |
|
|
|
407 |
|
|
ifneq ($(findstring -L,$(NSPR_LIBS)),) |
408 |
|
|
NSPR_STATIC_PATH = $(subst -L,,$(findstring -L,$(NSPR_LIBS))) |
409 |
|
|
else |
410 |
|
|
NSPR_STATIC_PATH = $(DIST)/lib |
411 |
|
|
endif |
412 |
|
|
|
413 |
|
|
ifdef MOZ_SHARK |
414 |
|
|
CFLAGS += -F/System/Library/PrivateFrameworks |
415 |
|
|
CXXFLAGS += -F/System/Library/PrivateFrameworks |
416 |
|
|
LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD |
417 |
|
|
endif |
418 |
|
|
|
419 |
|
|
ifdef MOZ_VTUNE |
420 |
|
|
CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include |
421 |
|
|
EXTRA_DSO_LDOPTS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib |
422 |
|
|
LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib |
423 |
|
|
endif |
424 |
|
|
|
425 |
|
|
# BeOS and HP-UX do not require the extra linking of "-lm" |
426 |
|
|
ifeq (,$(filter BeOS HP-UX WINNT WINCE OpenVMS,$(OS_ARCH))) |
427 |
|
|
EXTRA_LIBS += -lm |
428 |
|
|
endif |
429 |
|
|
|
430 |
|
|
# Prevent floating point errors caused by VC++ optimizations |
431 |
|
|
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_) |
432 |
|
|
ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER))) |
433 |
|
|
CFLAGS += -Op |
434 |
|
|
else |
435 |
|
|
CFLAGS += -fp:precise |
436 |
|
|
endif |
437 |
|
|
endif # WINNT |
438 |
|
|
|
439 |
|
|
ifeq ($(OS_ARCH),FreeBSD) |
440 |
|
|
EXTRA_LIBS += -pthread |
441 |
|
|
endif |
442 |
|
|
ifeq ($(OS_ARCH),IRIX) |
443 |
|
|
ifdef USE_N32 |
444 |
|
|
DASH_R += -n32 |
445 |
|
|
endif |
446 |
|
|
endif |
447 |
|
|
ifeq ($(OS_ARCH),Linux) |
448 |
|
|
EXTRA_LIBS += -ldl |
449 |
|
|
endif |
450 |
|
|
ifeq ($(OS_ARCH),OSF1) |
451 |
|
|
EXTRA_LIBS += -lc_r |
452 |
|
|
endif |
453 |
|
|
ifeq ($(OS_ARCH),SunOS) |
454 |
|
|
ifeq ($(TARGET_CPU),sparc) |
455 |
|
|
|
456 |
|
|
ifdef JS_ULTRASPARC_OPTS |
457 |
|
|
DEFINES += -DULTRA_SPARC |
458 |
|
|
ifdef GNU_CC |
459 |
|
|
CFLAGS += -Wa,-xarch=v8plus,-DULTRA_SPARC,-P,-L,-D_ASM,-D__STDC__=0 |
460 |
|
|
CXXFLAGS += -Wa,-xarch=v8plus,-DULTRA_SPARC,-P,-L,-D_ASM,-D__STDC__=0,-K,PIC |
461 |
|
|
else |
462 |
|
|
ASFLAGS += -xarch=v8plus -DULTRA_SPARC -P -L -D_ASM -D__STDC__=0 -K PIC |
463 |
|
|
endif # GNU_CC |
464 |
|
|
endif # JS_ULTRASPARC_OPTS |
465 |
|
|
|
466 |
|
|
endif |
467 |
|
|
ifeq ($(OS_RELEASE),4.1) |
468 |
|
|
EXTRA_LIBS += -ldl -lnsl |
469 |
|
|
else |
470 |
|
|
EXTRA_LIBS += -lposix4 -ldl -lnsl -lsocket |
471 |
|
|
endif |
472 |
|
|
endif |
473 |
|
|
|
474 |
|
|
ifdef MOZ_MEMORY |
475 |
|
|
ifeq ($(OS_ARCH),Darwin) |
476 |
|
|
LDFLAGS += -ljemalloc |
477 |
|
|
endif |
478 |
|
|
endif |
479 |
|
|
|
480 |
|
|
# Sun Studio x86 has an optimization bug with LIR.cpp, use -xO2 instead. |
481 |
|
|
ifeq ($(OS_ARCH),SunOS) |
482 |
|
|
ifeq (86,$(findstring 86,$(OS_TEST))) |
483 |
|
|
ifndef GNU_CC |
484 |
|
|
LIR.o: LIR.cpp Makefile.in |
485 |
|
|
$(REPORT_BUILD) |
486 |
|
|
@$(MAKE_DEPS_AUTO_CXX) |
487 |
|
|
$(CXX) -o $@ -c $(patsubst -xO%,-xO2,$(COMPILE_CFLAGS)) $< |
488 |
|
|
endif |
489 |
|
|
endif |
490 |
|
|
endif |
491 |
|
|
|
492 |
|
|
# Allow building jsinterp.c with special optimization flags |
493 |
|
|
ifdef INTERP_OPTIMIZER |
494 |
|
|
jsinterp.$(OBJ_SUFFIX): MODULE_OPTIMIZE_FLAGS=$(INTERP_OPTIMIZER) |
495 |
|
|
endif |
496 |
|
|
|
497 |
|
|
ifeq ($(OS_ARCH),IRIX) |
498 |
|
|
ifndef GNU_CC |
499 |
|
|
_COMPILE_CFLAGS = $(patsubst -O%,-O1,$(COMPILE_CFLAGS)) |
500 |
|
|
jsapi.o jsxdrapi.o jsarena.o jsarray.o jsatom.o jsemit.o jsfun.o jsinterp.o jsregexp.o jsparse.o jsopcode.o jsscript.o: %.o: %.cpp Makefile.in |
501 |
|
|
$(REPORT_BUILD) |
502 |
|
|
@$(MAKE_DEPS_AUTO_CXX) |
503 |
|
|
$(CXX) -o $@ -c $(_COMPILE_CFLAGS) $< |
504 |
|
|
endif |
505 |
|
|
endif |
506 |
|
|
|
507 |
|
|
# An AIX Optimization bug causes PR_dtoa() & JS_dtoa to produce wrong result. |
508 |
|
|
# This suppresses optimization for this single compilation unit. |
509 |
|
|
ifeq ($(OS_ARCH),AIX) |
510 |
|
|
jsatom.o: jsatom.cpp Makefile.in |
511 |
|
|
$(REPORT_BUILD) |
512 |
|
|
@$(MAKE_DEPS_AUTO_CXX) |
513 |
|
|
$(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $< |
514 |
|
|
jsdtoa.o: jsdtoa.cpp Makefile.in |
515 |
|
|
$(REPORT_BUILD) |
516 |
|
|
@$(MAKE_DEPS_AUTO_CXX) |
517 |
|
|
$(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $< |
518 |
|
|
endif |
519 |
|
|
|
520 |
|
|
jsopcode.h jsopcode.cpp: jsopcode.tbl |
521 |
|
|
|
522 |
siliconforks |
399 |
export:: jsautocfg.h |
523 |
|
|
|
524 |
siliconforks |
332 |
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) |
525 |
|
|
jsautocfg.h: |
526 |
|
|
touch $@ |
527 |
|
|
else |
528 |
|
|
ifeq ($(OS_ARCH),WINCE) |
529 |
|
|
jsautocfg.h: |
530 |
|
|
touch $@ |
531 |
|
|
else |
532 |
|
|
jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX) |
533 |
|
|
@rm -f $@ jsautocfg.tmp |
534 |
|
|
./jscpucfg > jsautocfg.tmp |
535 |
|
|
mv jsautocfg.tmp $@ |
536 |
|
|
endif |
537 |
|
|
endif |
538 |
|
|
|
539 |
|
|
# jscpucfg is a strange target |
540 |
|
|
# Needs to be built with the host compiler but needs to include |
541 |
|
|
# the mdcpucfg for the target so it needs the appropriate target defines |
542 |
|
|
ifdef HOST_NSPR_MDCPUCFG |
543 |
|
|
HOST_CXX := $(HOST_CXX) -DMDCPUCFG=$(TARGET_NSPR_MDCPUCFG) |
544 |
|
|
HOST_CXXFLAGS := $(patsubst -DXP_%,,$(HOST_CXXFLAGS)) |
545 |
|
|
endif |
546 |
|
|
|
547 |
|
|
ifdef CROSS_COMPILE |
548 |
|
|
# jscpucfg needs to know when it's supposed to produce a config for the target |
549 |
|
|
JSCPUCFG_DEFINES = $(ACDEFINES) |
550 |
|
|
|
551 |
|
|
# This is incredibly hacky. Darwin NSPR uses the same MDCPUCFG for multiple |
552 |
|
|
# processors, and determines which processor to configure for based on |
553 |
|
|
# #ifdef i386. This macro is among the NSPR defines, but is also automatically |
554 |
|
|
# defined by the compiler when building for i386. It therefore needs to be |
555 |
|
|
# defined here if targeting i386, and explicitly undefined otherwise. |
556 |
|
|
ifeq ($(OS_ARCH),Darwin) |
557 |
|
|
ifeq ($(TARGET_CPU),powerpc) |
558 |
|
|
JSCPUCFG_DEFINES += -Ui386 |
559 |
|
|
else |
560 |
|
|
JSCPUCFG_DEFINES += -Di386=1 |
561 |
|
|
endif |
562 |
|
|
endif |
563 |
|
|
endif |
564 |
|
|
|
565 |
|
|
ifeq ($(OS_ARCH),QNX) |
566 |
|
|
ifneq ($(OS_TARGET),NTO) |
567 |
|
|
# QNX's compiler apparently can't build a binary directly from a source file. |
568 |
|
|
jscpucfg.o: jscpucfg.cpp Makefile.in |
569 |
|
|
$(HOST_CXX) $(HOST_CXXFLAGS) -c $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) -o $@ $< |
570 |
|
|
|
571 |
|
|
jscpucfg: jscpucfg.o |
572 |
|
|
$(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) -o $@ $< |
573 |
|
|
endif |
574 |
|
|
else |
575 |
|
|
ifeq ($(OS_ARCH),WINCE) |
576 |
|
|
jscpucfg$(HOST_BIN_SUFFIX): |
577 |
|
|
echo no need to build jscpucfg $< |
578 |
|
|
else |
579 |
|
|
jscpucfg$(HOST_BIN_SUFFIX): jscpucfg.cpp Makefile.in |
580 |
|
|
$(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) $(HOST_OUTOPTION)$@ $< |
581 |
|
|
endif |
582 |
|
|
endif |
583 |
|
|
|
584 |
siliconforks |
399 |
# Compute the linker flags that programs linking against SpiderMonkey should |
585 |
|
|
# pass to get SpiderMonkey and its dependencies, beyond just the -L and -l |
586 |
|
|
# for the SpiderMonkey library itself. |
587 |
|
|
# - EXTRA_DSO_LDOPTS includes the NSPR -L and -l flags. |
588 |
|
|
# - OS_LIBS includes libraries selected by the configure script. |
589 |
|
|
# - EXTRA_LIBS includes libraries selected by this Makefile. |
590 |
|
|
JS_CONFIG_LIBS=$(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) |
591 |
|
|
|
592 |
|
|
# The configure script invokes this rule explicitly at configure time! |
593 |
|
|
# It's important that js-config be ready by the time we're done |
594 |
|
|
# configuring, because we may be running other configure scripts that |
595 |
|
|
# would like to run js-config themselves, before js is built. |
596 |
|
|
# |
597 |
|
|
# This file and rules.mk go through a certain amount of work to decide |
598 |
|
|
# which libraries to build, what to name them, and what flags to pass |
599 |
|
|
# when linking them (and thus what flags its own clients must pass). |
600 |
|
|
# All this information needs to go into the js-config script. To |
601 |
|
|
# avoid trying to re-compute all that in the configure script, we just |
602 |
|
|
# have the configure script generate this Makefile, and then invoke |
603 |
|
|
# this rule. |
604 |
|
|
at=@ |
605 |
|
|
js-config: js-config.in Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk $(topsrcdir)/config/rules.mk |
606 |
|
|
rm -f js-config.tmp |
607 |
|
|
sed < $< > js-config.tmp \ |
608 |
|
|
-e 's|$(at)prefix$(at)|$(prefix)|' \ |
609 |
|
|
-e 's|$(at)exec_prefix$(at)|$(exec_prefix)|' \ |
610 |
|
|
-e 's|$(at)includedir$(at)|$(includedir)|' \ |
611 |
|
|
-e 's|$(at)libdir$(at)|$(libdir)|' \ |
612 |
|
|
-e 's|$(at)MOZILLA_VERSION$(at)|$(MOZILLA_VERSION)|' \ |
613 |
|
|
-e 's|$(at)LIBRARY_NAME$(at)|$(LIBRARY_NAME)|' \ |
614 |
|
|
-e 's|$(at)NSPR_CFLAGS$(at)|$(NSPR_CFLAGS)|' \ |
615 |
|
|
-e 's|$(at)JS_CONFIG_LIBS$(at)|$(JS_CONFIG_LIBS)|' \ |
616 |
|
|
-e 's|$(at)MOZ_JS_LIBS$(at)|$(MOZ_JS_LIBS)|' \ |
617 |
|
|
&& mv js-config.tmp $@ && chmod +x $@ |
618 |
|
|
|
619 |
|
|
SCRIPTS = js-config |
620 |
|
|
|
621 |
|
|
install:: $(INSTALLED_HEADERS) |
622 |
|
|
$(SYSINSTALL) $(IFLAGS1) $^ $(includedir)/$(MODULE) |
623 |
|
|
|
624 |
|
|
install:: $(SCRIPTS) $(PROGRAM) |
625 |
|
|
$(SYSINSTALL) $(IFLAGS2) $^ $(bindir) |
626 |
|
|
|
627 |
|
|
# The Mozilla top-level makefiles use install-runtime-libs directly to |
628 |
|
|
# place an additional copy of the libraries in the 'dist/bin' |
629 |
|
|
# directory. |
630 |
|
|
install:: install-runtime-libs |
631 |
|
|
install-runtime-libs:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) |
632 |
|
|
ifneq (,$(LIBRARY)) |
633 |
|
|
$(SYSINSTALL) $(IFLAGS1) $(LIBRARY) $(libdir) |
634 |
|
|
endif |
635 |
|
|
ifneq (,$(SHARED_LIBRARY)) |
636 |
|
|
$(SYSINSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(libdir) |
637 |
|
|
endif |
638 |
|
|
ifneq (,$(IMPORT_LIBRARY)) |
639 |
|
|
$(SYSINSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir) |
640 |
|
|
endif |
641 |
|
|
|
642 |
siliconforks |
332 |
# Extra dependancies and rules for auto-generated headers |
643 |
|
|
host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl |
644 |
|
|
|
645 |
siliconforks |
399 |
# Use CURDIR to avoid finding a jsautokw.h in the source tree (from a |
646 |
|
|
# previous build?) via VPATH when we're building in a separate tree. |
647 |
|
|
$(CURDIR)/jsautokw.h: host_jskwgen$(HOST_BIN_SUFFIX) |
648 |
siliconforks |
332 |
./host_jskwgen$(HOST_BIN_SUFFIX) $@ |
649 |
|
|
|
650 |
|
|
host_jsoplengen.$(OBJ_SUFFIX): jsopcode.tbl |
651 |
|
|
|
652 |
siliconforks |
399 |
# Use CURDIR to avoid finding a jsautooplen.h in the source tree (from |
653 |
|
|
# a previous build?) via VPATH when we're building in a separate tree. |
654 |
|
|
$(CURDIR)/jsautooplen.h: host_jsoplengen$(HOST_BIN_SUFFIX) |
655 |
siliconforks |
332 |
./host_jsoplengen$(HOST_BIN_SUFFIX) $@ |
656 |
|
|
|
657 |
|
|
# Force auto-header generation before compiling any source that may use them |
658 |
siliconforks |
399 |
$(CPPSRCS:%.cpp=%.$(OBJ_SUFFIX)): $(CURDIR)/jsautokw.h $(CURDIR)/jsautooplen.h |
659 |
siliconforks |
332 |
|
660 |
|
|
ifdef HAVE_DTRACE |
661 |
siliconforks |
399 |
$(CURDIR)/javascript-trace.h: $(srcdir)/javascript-trace.d |
662 |
siliconforks |
332 |
dtrace -h -s $(srcdir)/javascript-trace.d -o javascript-trace.h.in |
663 |
|
|
sed 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \ |
664 |
|
|
javascript-trace.h.in > javascript-trace.h |
665 |
siliconforks |
399 |
|
666 |
|
|
$(CPPSRCS:%.cpp=%.$(OBJ_SUFFIX)): $(CURDIR)/javascript-trace.h |
667 |
siliconforks |
332 |
endif |