1 # -*- Mode: makefile -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 ifeq (,$(MAKE_VERSION
))
8 $(error GNU Make is required
)
11 ifneq ($(make_min_ver
),$(firstword $(sort $(make_min_ver
) $(MAKE_VERSION
))))
12 $(error GNU Make
$(make_min_ver
) or higher is required
)
17 run_for_side_effects
:= $(shell echo
'MAKE: $(MAKE)')
24 LOCAL_INCLUDES
= $(MOZ_FFI_CFLAGS
)
27 # Windows needs this to be linked with a static library.
29 DEFINES
+= -DFFI_BUILDING
36 # Define keyword generator before rules.mk, see bug 323979 comment 50
38 GARBAGE
+= jsautokw.h host_jskwgen
$(HOST_BIN_SUFFIX
)
40 GARBAGE
+= selfhosted.out.h
45 ifneq ($(OS_ARCH
),Darwin
)
46 DTRACE_PROBE_OBJ
= $(LIBRARY_NAME
)-dtrace.
$(OBJ_SUFFIX
)
48 MOZILLA_DTRACE_SRC
= $(srcdir)/devtools
/javascript-trace.d
51 # Ensure symbol versions of shared library on Linux do not conflict
52 # with those in libxul.
53 ifeq (Linux
,$(OS_TARGET
))
54 OS_LDFLAGS
+= -Wl
,-version-script
,symverscript
56 symverscript
: symverscript.in
57 $(call py_action
,preprocessor
, \
58 -DVERSION
='$(subst -,_,$(LIBRARY_NAME))' $< -o
$@
)
60 EXTRA_DEPS
+= symverscript
63 export_files
= js-config.h
65 export_files
+= $(CURDIR
)/javascript-trace.h
68 INSTALL_TARGETS
+= jsconfig
69 jsconfig_FILES
= $(export_files
)
70 jsconfig_DEST
= $(DIST
)/include
71 jsconfig_TARGET
:= export
73 include $(topsrcdir
)/config
/rules.mk
75 #############################################
76 # BEGIN ECMAScript Internationalization API
79 # ICU headers need to be available whether we build with the complete
80 # Internationalization API or not - ICU stubs rely on them.
82 LOCAL_INCLUDES
+= $(MOZ_ICU_CFLAGS
)
91 # END ECMAScript Internationalization API
92 #############################################
95 # check_vanilla_allocations.py is tailored to Linux, so only run it there.
96 # That should be enough to catch any problems.
97 check-vanilla-allocations
:
98 $(PYTHON
) $(topsrcdir
)/config
/check_vanilla_allocations.py
$(REAL_LIBRARY
)
100 # The "aggressive" variant will likely fail on some compiler/platform
101 # combinations, but is worth running by hand every once in a while.
102 check-vanilla-allocations-aggressive
:
103 $(PYTHON
) $(topsrcdir
)/config
/check_vanilla_allocations.py
--aggressive
$(REAL_LIBRARY
)
105 ifeq ($(OS_ARCH
),Linux
)
106 check:: check-vanilla-allocations
109 # Help ensure that the number of OOM errors in SpiderMonkey doesn't increase.
110 # If the number of OOM errors changes, update the number below. We intend this
111 # number to go down over time, by fixing OOMs.
113 $(wildcard $(RUN_TEST_PROGRAM
)) $(PYTHON
) -u
$(topsrcdir
)/config
/find_OOM_errors.py
--regression
125
115 ifeq ($(MOZ_DEBUG
),1)
121 JITTEST_VALGRIND_FLAG
= --valgrind
126 ifneq ($(LLVM_SYMBOLIZER
),)
127 # Use the LLVM symbolizer when running jit-tests under ASan, if available
128 JITTEST_ASAN_ENV
=ASAN_SYMBOLIZER_PATH
='$(LLVM_SYMBOLIZER)'
133 (cd
$(srcdir) && $(PYTHON
) $(topsrcdir
)/config
/check_spidermonkey_style.py
);
136 $(JITTEST_ASAN_ENV
) $(wildcard $(RUN_TEST_PROGRAM
)) $(PYTHON
) -u
$(srcdir)/jit-test
/jit_test.py \
137 --no-slow
--no-progress
--tinderbox
--tbpl
$(JITTEST_VALGRIND_FLAG
) \
138 $(DIST
)/bin
/$(JS_SHELL_NAME
)$(BIN_SUFFIX
)
142 # jstests doesn't have a --jitflags option, so we need to loop, updating the
143 # exit code (RC) after each invocation.
144 # FIXME: MethodJIT doesn't work for 1 test case (bug 644393), so
145 # --no-extensions is set to skip that test. Remove as soon as possible.
148 for f in
`echo '$(JITFLAGS)' | tr ',' '\n'`; \
150 $(wildcard $(RUN_TEST_PROGRAM
)) $(PYTHON
) -u
$(srcdir)/tests
/jstests.py \
151 --tinderbox
--no-progress \
154 --args
="`echo $$f | sed 's/\(.\)/ -\1/g'`" \
155 $(DIST
)/bin
/$(JS_SHELL_NAME
)$(BIN_SUFFIX
); \
156 RC
=$$(( $$RC ||
$$?
)); \
161 # We want to run check-jstests as part of |make check| on all platforms, on
162 # tinderbox. However, some configurations don't work quite right just yet.
163 # Rather than risking regressions in major configurations while fixing these
164 # secondary configuration, we work around them and fix the bugs later.
166 # Bug 652154: On Windows, SM(!m !t) don't work because of path problems with
167 # their unusual directory layout
169 # Bug 652155: On Mac, SM(d) doesn't work for unknown reasons
171 ifneq ($(OS_ARCH
),WINNT
)
173 #check:: check-jstests
177 DIST_GARBAGE
= config.cache config.log config.status
* \
178 config
/autoconf.mk config
/emptyvars.mk \
179 js-config.h js-confdefs.h \
180 backend.mk config
/backend.mk devtools
/backend.mk editline
/backend.mk \
181 gdb
/backend.mk jsapi-tests
/backend.mk
shell/backend.mk tests
/backend.mk \
182 backend.RecursiveMakeBackend backend.RecursiveMakeBackend.pp \
183 devtools
/rootAnalysis
/Makefile
186 $(RM
) $(DIST_GARBAGE
)
188 CFLAGS
+= $(MOZ_ZLIB_CFLAGS
)
190 # Silence warnings on AIX/HP-UX from non-GNU compilers
192 ifeq ($(OS_ARCH
),AIX
)
193 # Suppress warnings from xlC
194 # 1540-1281: offsetof() on null non-POD types
195 # 1540-1608: anonymous unions using static data members
196 CFLAGS
+= -qsuppress
=1540-1281 -qsuppress
=1540-1608
197 CXXFLAGS
+= -qsuppress
=1540-1281 -qsuppress
=1540-1608
199 ifeq ($(OS_ARCH
),HP-UX
)
200 # Suppress warnings from aCC
201 # 3055: anonymous unions declaring types
202 # 4189: offsetof() on non-POD types
203 CFLAGS
+= +W3055
,4189
204 CXXFLAGS
+= +W3055
,4189
207 ifeq ($(OS_ARCH
),SunOS
)
208 ifeq ($(TARGET_CPU
),sparc
)
218 SCRIPTS
= $(JS_CONFIG_NAME
)
219 SDK_BINARY
= $(JS_CONFIG_NAME
)
221 $(LIBRARY_NAME
).
pc: js.
pc
224 install:: $(LIBRARY_NAME
).
pc
225 $(SYSINSTALL
) $^
$(DESTDIR
)$(libdir)/pkgconfig
227 ######################################################
228 # BEGIN SpiderMonkey header installation
230 # Mozilla/Gecko/Firefox mostly doesn't concern itself with defining a sensible
231 # install target, because it's shipping primarily packaged builds. And even if
232 # it did, those builds wouldn't really have reason to include header files. So
233 # we have to install public headers ourselves, rather than using something from
234 # config/rules.mk or similar.
236 # The overall directory structure of the installed headers looks like so:
240 # jsapi.h, jspubtd.h, etc. (all of EXPORTS)
242 # js/public/* headers (all are public)
244 # js/src/ds/* public headers
246 # js/src/gc/* public headers
252 $(call py_action
,process_install_manifest
,--no-remove
$(DESTDIR
)$(includedir) $(DEPTH
)/_build_manifests
/install/dist_include
)
255 # END SpiderMonkey header installation
256 #############################################
259 $(SYSINSTALL
) $^
$(DESTDIR
)$(bindir)
261 install:: $(REAL_LIBRARY
) $(SHARED_LIBRARY
) $(IMPORT_LIBRARY
)
262 ifneq (,$(REAL_LIBRARY
))
263 $(SYSINSTALL
) $(REAL_LIBRARY
) $(DESTDIR
)$(libdir)
264 mv
-f
$(DESTDIR
)$(libdir)/$(REAL_LIBRARY
) $(subst $(STATIC_LIBRARY_NAME
),$(LIBRARY_NAME
),$(DESTDIR
)$(libdir)/$(REAL_LIBRARY
))
266 ifneq (,$(SHARED_LIBRARY
))
267 $(SYSINSTALL
) $(SHARED_LIBRARY
) $(DESTDIR
)$(libdir)
269 ifneq (,$(IMPORT_LIBRARY
))
270 $(SYSINSTALL
) $(IMPORT_LIBRARY
) $(DESTDIR
)$(libdir)
272 $(MAKE
) -C
shell install
274 # Use CURDIR to avoid finding a jsautokw.h in the source tree (from a
275 # previous build?) via VPATH when we're building in a separate tree.
276 $(CURDIR
)/jsautokw.h
: host_jskwgen
$(HOST_BIN_SUFFIX
)
277 .
/host_jskwgen
$(HOST_BIN_SUFFIX
) $@
279 # Force auto-header generation before compiling any source that may use them
280 $(OBJS
): $(CURDIR
)/jsautokw.h
283 ETWProvider.h ETWProvider.rc ETWProvider.mof
: ETWProvider.man
286 ETWProvider.res
: ETWProvider.rc
287 $(RC
) -r
-i
'$(SDKDIR)Include' $^
289 export:: ETWProvider.res
291 install:: ETWProvider.mof ETWProvider.man
292 $(SYSINSTALL
) $^
$(DESTDIR
)$(bindir)
297 $(CURDIR
)/javascript-trace.h
: $(srcdir)/devtools
/javascript-trace.d
298 dtrace
-h
-s
$(srcdir)/devtools
/javascript-trace.d
-o javascript-trace.h.in
299 sed
-e
's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \
300 -e
'/const/!s/char \*/const char */g' \
301 javascript-trace.h.in
> javascript-trace.h
303 # We can't automatically generate dependencies on auto-generated headers;
304 # we have to list them explicitly.
305 $(addsuffix .
$(OBJ_SUFFIX
),Probes jsinterp jsobj
): $(CURDIR
)/javascript-trace.h
308 # Prepare self-hosted JS code for embedding
310 selfhosting
:: selfhosted.out.h
312 selfhosting_srcs
:= \
313 $(srcdir)/builtin
/Utilities.js \
314 $(srcdir)/builtin
/ParallelUtilities.js \
315 $(srcdir)/builtin
/Array.js \
316 $(srcdir)/builtin
/Date.js \
317 $(srcdir)/builtin
/Error.js \
318 $(srcdir)/builtin
/Intl.js \
319 $(srcdir)/builtin
/IntlData.js \
320 $(srcdir)/builtin
/Iterator.js \
321 $(srcdir)/builtin
/Map.js \
322 $(srcdir)/builtin
/Number.js \
323 $(srcdir)/builtin
/Object.js \
324 $(srcdir)/builtin
/String.js \
325 $(srcdir)/builtin
/Set.js \
326 $(srcdir)/builtin
/TypedObject.js \
327 $(srcdir)/builtin
/WeakSet.js \
330 selfhosted_out_h_deps
:= \
331 $(selfhosting_srcs
) \
333 $(srcdir)/builtin
/embedjs.py \
334 $(srcdir)/builtin
/TypedObjectConstants.h \
335 $(srcdir)/builtin
/SelfHostingDefines.h \
338 SELFHOSTED_DEFINES
+= $(DEFINES
) $(ACDEFINES
)
340 SELFHOSTED_DEFINES
+= $(MOZ_DEBUG_ENABLE_DEFS
)
342 SELFHOSTED_DEFINES
+= $(MOZ_DEBUG_DISABLE_DEFS
)
345 selfhosted.out.h
: $(selfhosted_out_h_deps
)
346 $(PYTHON
) $(srcdir)/builtin
/embedjs.py
$(SELFHOSTED_DEFINES
) \
347 -c
'$(CCC)' -p
'$(PREPROCESS_OPTION)' -m
$(srcdir)/js.msg \
348 -o
$@
$(selfhosting_srcs
)
350 ###############################################
351 # Generating source package tarballs
352 # (only possible when tar is found)
361 MOZJS_MAJOR_VERSION
=$(MOZJS_MAJOR_VERSION
) \
362 MOZJS_MINOR_VERSION
=$(MOZJS_MINOR_VERSION
) \
363 MOZJS_PATCH_VERSION
=$(MOZJS_PATCH_VERSION
) \
364 MOZJS_ALPHA
=$(MOZJS_ALPHA
) \
365 $(srcdir)/make-source-package.sh
369 MOZJS_MAJOR_VERSION
=$(MOZJS_MAJOR_VERSION
) \
370 MOZJS_MINOR_VERSION
=$(MOZJS_MINOR_VERSION
) \
371 MOZJS_PATCH_VERSION
=$(MOZJS_PATCH_VERSION
) \
372 MOZJS_ALPHA
=$(MOZJS_ALPHA
) \
373 $(srcdir)/make-source-package.sh
clean