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