37 |
# |
# |
38 |
# ***** END LICENSE BLOCK ***** |
# ***** END LICENSE BLOCK ***** |
39 |
|
|
40 |
DEPTH = ../.. |
DEPTH = . |
41 |
topsrcdir = @top_srcdir@ |
topsrcdir = @top_srcdir@ |
42 |
srcdir = @srcdir@ |
srcdir = @srcdir@ |
43 |
|
|
44 |
|
DIRS = config |
45 |
|
|
46 |
include $(DEPTH)/config/autoconf.mk |
include $(DEPTH)/config/autoconf.mk |
47 |
|
|
48 |
MODULE = js |
MODULE = js |
49 |
LIBRARY_NAME = mozjs |
LIBRARY_NAME = mozjs |
50 |
GRE_MODULE = 1 |
GRE_MODULE = 1 |
51 |
|
|
52 |
ifdef GNU_CC |
PROGRAM = js$(BIN_SUFFIX) |
53 |
ifdef INTEL_CC |
# 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 |
# icc gets special optimize flags |
# icc gets special optimize flags |
62 |
ifdef MOZ_PROFILE_GENERATE |
ifdef MOZ_PROFILE_GENERATE |
63 |
MODULE_OPTIMIZE_FLAGS = -O0 |
MODULE_OPTIMIZE_FLAGS = -O0 |
65 |
MODULE_OPTIMIZE_FLAGS = -O2 -ip |
MODULE_OPTIMIZE_FLAGS = -O2 -ip |
66 |
#XXX: do we want different INTERP_OPTIMIZER flags here? |
#XXX: do we want different INTERP_OPTIMIZER flags here? |
67 |
endif |
endif |
68 |
else |
else # not INTEL_CXX |
69 |
MODULE_OPTIMIZE_FLAGS = -Os -fstrict-aliasing $(MOZ_OPTIMIZE_SIZE_TWEAK) |
MODULE_OPTIMIZE_FLAGS = -Os -fstrict-aliasing $(MOZ_OPTIMIZE_SIZE_TWEAK) |
70 |
# Special optimization flags for jsinterp.c |
# Special optimization flags for jsinterp.c |
71 |
INTERP_OPTIMIZER = -O3 -fstrict-aliasing |
INTERP_OPTIMIZER = -O3 -fstrict-aliasing |
72 |
endif |
endif |
73 |
else |
else # not GNU_CXX |
74 |
ifeq ($(OS_ARCH),SunOS) |
ifeq ($(OS_ARCH),SunOS) |
75 |
MODULE_OPTIMIZE_FLAGS = -xO4 |
MODULE_OPTIMIZE_FLAGS = -xO4 |
76 |
endif |
endif |
77 |
ifeq ($(OS_ARCH),WINNT) |
ifeq ($(OS_ARCH),WINNT) |
78 |
|
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 |
MODULE_OPTIMIZE_FLAGS = -O2 -GL |
MODULE_OPTIMIZE_FLAGS = -O2 -GL |
83 |
endif |
endif |
84 |
endif |
endif |
85 |
|
endif |
86 |
|
|
87 |
|
|
88 |
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) |
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) |
89 |
LIBRARY_NAME = js$(MOZ_BITS)$(VERSION_NUMBER) |
# do not name the library "libjs3250.a" |
90 |
|
# LIBRARY_NAME = js$(MOZ_BITS)$(VERSION_NUMBER) |
91 |
RESFILE = js$(MOZ_BITS)40.res |
RESFILE = js$(MOZ_BITS)40.res |
92 |
endif |
endif |
93 |
|
|
|
PACKAGE_FILE = js.pkg |
|
|
|
|
94 |
# JavaScript must be built shared, even for static builds, as it is used by |
# 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 |
# 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, |
# the js code getting copied into xpinstall and jsd as well as mozilla-bin, |
174 |
jsdtracef.c |
jsdtracef.c |
175 |
endif |
endif |
176 |
|
|
177 |
EXPORTS = \ |
INSTALLED_HEADERS = \ |
178 |
|
js-config.h \ |
179 |
jsautocfg.h \ |
jsautocfg.h \ |
180 |
jsautokw.h \ |
jsautokw.h \ |
181 |
js.msg \ |
js.msg \ |
226 |
jsxml.h \ |
jsxml.h \ |
227 |
$(NULL) |
$(NULL) |
228 |
|
|
229 |
|
# unconditionally disable JIT |
230 |
|
ENABLE_JIT = |
231 |
ifdef ENABLE_JIT |
ifdef ENABLE_JIT |
232 |
VPATH += $(srcdir)/nanojit |
VPATH += $(srcdir)/nanojit |
233 |
|
|
234 |
EXPORTS += \ |
INSTALLED_HEADERS += \ |
235 |
|
builtins.tbl \ |
236 |
|
jsbuiltins.h \ |
237 |
Assembler.h \ |
Assembler.h \ |
238 |
LIR.h \ |
LIR.h \ |
239 |
avmplus.h \ |
avmplus.h \ |
|
vm_fops.h \ |
|
240 |
Fragmento.h \ |
Fragmento.h \ |
241 |
Native.h \ |
Native.h \ |
242 |
Native$(NANOJIT_ARCH).h \ |
Native$(NANOJIT_ARCH).h \ |
243 |
RegAlloc.h \ |
RegAlloc.h \ |
244 |
nanojit.h \ |
nanojit.h \ |
245 |
builtins.tbl \ |
TraceTreeDrawer.h \ |
246 |
$(NULL) |
$(NULL) |
247 |
|
|
248 |
CPPSRCS += \ |
CPPSRCS += \ |
257 |
$(NULL) |
$(NULL) |
258 |
|
|
259 |
ifdef DEBUG |
ifdef DEBUG |
|
EXPORTS += TraceTreeDrawer.h |
|
260 |
CPPSRCS += TraceTreeDrawer.cpp |
CPPSRCS += TraceTreeDrawer.cpp |
261 |
endif |
endif |
262 |
|
|
264 |
endif |
endif |
265 |
|
|
266 |
ifdef HAVE_DTRACE |
ifdef HAVE_DTRACE |
267 |
EXPORTS += \ |
INSTALLED_HEADERS += \ |
268 |
jsdtracef.h \ |
jsdtracef.h \ |
269 |
javascript-trace.h \ |
$(CURDIR)/javascript-trace.h \ |
270 |
$(NULL) |
$(NULL) |
271 |
endif |
endif |
272 |
|
|
273 |
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) |
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) |
274 |
EXPORTS += jscpucfg.h |
INSTALLED_HEADERS += jscpucfg.h |
275 |
endif |
endif |
276 |
|
|
277 |
JS_SAFE_ARENA = 1 |
JS_SAFE_ARENA = 1 |
340 |
|
|
341 |
include $(topsrcdir)/config/rules.mk |
include $(topsrcdir)/config/rules.mk |
342 |
|
|
343 |
|
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 |
# our build system doesn't handle subdir srcs very gracefully today |
# our build system doesn't handle subdir srcs very gracefully today |
365 |
export:: |
export:: |
366 |
mkdir -p nanojit |
mkdir -p nanojit |
519 |
|
|
520 |
jsopcode.h jsopcode.cpp: jsopcode.tbl |
jsopcode.h jsopcode.cpp: jsopcode.tbl |
521 |
|
|
522 |
|
export:: jsautocfg.h |
523 |
|
|
524 |
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) |
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) |
525 |
jsautocfg.h: |
jsautocfg.h: |
526 |
touch $@ |
touch $@ |
581 |
endif |
endif |
582 |
endif |
endif |
583 |
|
|
584 |
|
# 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 |
# Extra dependancies and rules for auto-generated headers |
# Extra dependancies and rules for auto-generated headers |
643 |
host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl |
host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl |
644 |
|
|
645 |
jsautokw.h: host_jskwgen$(HOST_BIN_SUFFIX) |
# 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 |
./host_jskwgen$(HOST_BIN_SUFFIX) $@ |
./host_jskwgen$(HOST_BIN_SUFFIX) $@ |
649 |
|
|
650 |
host_jsoplengen.$(OBJ_SUFFIX): jsopcode.tbl |
host_jsoplengen.$(OBJ_SUFFIX): jsopcode.tbl |
651 |
|
|
652 |
jsautooplen.h: host_jsoplengen$(HOST_BIN_SUFFIX) |
# 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 |
./host_jsoplengen$(HOST_BIN_SUFFIX) $@ |
./host_jsoplengen$(HOST_BIN_SUFFIX) $@ |
656 |
|
|
657 |
# Force auto-header generation before compiling any source that may use them |
# Force auto-header generation before compiling any source that may use them |
658 |
$(CPPSRCS:%.cpp=%.$(OBJ_SUFFIX)): jsautokw.h jsautooplen.h |
$(CPPSRCS:%.cpp=%.$(OBJ_SUFFIX)): $(CURDIR)/jsautokw.h $(CURDIR)/jsautooplen.h |
659 |
|
|
660 |
ifdef HAVE_DTRACE |
ifdef HAVE_DTRACE |
661 |
javascript-trace.h: $(srcdir)/javascript-trace.d |
$(CURDIR)/javascript-trace.h: $(srcdir)/javascript-trace.d |
662 |
dtrace -h -s $(srcdir)/javascript-trace.d -o javascript-trace.h.in |
dtrace -h -s $(srcdir)/javascript-trace.d -o javascript-trace.h.in |
663 |
sed 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \ |
sed 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \ |
664 |
javascript-trace.h.in > javascript-trace.h |
javascript-trace.h.in > javascript-trace.h |
665 |
|
|
666 |
|
$(CPPSRCS:%.cpp=%.$(OBJ_SUFFIX)): $(CURDIR)/javascript-trace.h |
667 |
endif |
endif |