Bumping manifests a=b2g-bump
[gecko.git] / js / src / Makefile.in
blob372bcbd88f0660649a439c8db8e70b29e14692dd
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)
9 endif
10 make_min_ver := 3.81
11 ifneq ($(make_min_ver),$(firstword $(sort $(make_min_ver) $(MAKE_VERSION))))
12 $(error GNU Make $(make_min_ver) or higher is required)
13 endif
15 TOPLEVEL_BUILD := 1
17 run_for_side_effects := $(shell echo 'MAKE: $(MAKE)')
19 DIST_INSTALL = 1
20 NO_EXPAND_LIBS = 1
22 ifdef JS_HAS_CTYPES
23 ifdef MOZ_NATIVE_FFI
24 LOCAL_INCLUDES = $(MOZ_FFI_CFLAGS)
25 endif
27 # Windows needs this to be linked with a static library.
28 ifndef MOZ_NATIVE_FFI
29 DEFINES += -DFFI_BUILDING
30 endif
32 endif # JS_HAS_CTYPES
34 DASH_R = -r
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
42 USE_HOST_CXX = 1
44 ifdef HAVE_DTRACE
45 ifneq ($(OS_ARCH),Darwin)
46 DTRACE_PROBE_OBJ = $(LIBRARY_NAME)-dtrace.$(OBJ_SUFFIX)
47 endif
48 MOZILLA_DTRACE_SRC = $(srcdir)/devtools/javascript-trace.d
49 endif
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
61 endif
63 export_files = js-config.h
64 ifdef HAVE_DTRACE
65 export_files += $(CURDIR)/javascript-trace.h
66 endif
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)
84 ifdef ENABLE_INTL_API
85 ifndef MOZ_NATIVE_ICU
87 endif
88 endif
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
107 endif
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.
112 check-ooms:
113 $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(topsrcdir)/config/find_OOM_errors.py --regression 125
115 ifeq ($(MOZ_DEBUG),1)
116 #check:: check-ooms
117 endif
119 ifdef MOZ_VALGRIND
120 ifndef MOZ_ASAN
121 JITTEST_VALGRIND_FLAG = --valgrind
122 endif
123 endif
125 ifdef MOZ_ASAN
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)'
129 endif
130 endif
132 check-style::
133 (cd $(srcdir) && $(PYTHON) $(topsrcdir)/config/check_spidermonkey_style.py);
135 check-jit-test::
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)
140 check:: check-style
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.
146 check-jstests:
147 RC=0; \
148 for f in `echo '$(JITFLAGS)' | tr ',' '\n'`; \
149 do \
150 $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/tests/jstests.py \
151 --tinderbox --no-progress \
152 --no-extensions \
153 --timeout 300 \
154 --args="`echo $$f | sed 's/\(.\)/ -\1/g'`" \
155 $(DIST)/bin/$(JS_SHELL_NAME)$(BIN_SUFFIX); \
156 RC=$$(( $$RC || $$?)); \
157 done; \
158 exit $$RC
160 # FIXME:
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)
172 ifndef HAVE_DTRACE
173 #check:: check-jstests
174 endif
175 endif
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
185 distclean::
186 $(RM) $(DIST_GARBAGE)
188 CFLAGS += $(MOZ_ZLIB_CFLAGS)
190 # Silence warnings on AIX/HP-UX from non-GNU compilers
191 ifndef GNU_CC
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
198 endif
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
205 endif
206 endif
207 ifeq ($(OS_ARCH),SunOS)
208 ifeq ($(TARGET_CPU),sparc)
210 ifdef GNU_CC
211 CFLAGS += -mcpu=v9
212 CXXFLAGS += -mcpu=v9
213 endif # GNU_CC
215 endif
216 endif
218 SCRIPTS = $(JS_CONFIG_NAME)
219 SDK_BINARY = $(JS_CONFIG_NAME)
221 $(LIBRARY_NAME).pc: js.pc
222 cp $^ $@
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:
238 # $(includedir)/
239 # $(LIBRARY_NAME)/
240 # jsapi.h, jspubtd.h, etc. (all of EXPORTS)
241 # js/
242 # js/public/* headers (all are public)
243 # ds/
244 # js/src/ds/* public headers
245 # gc/
246 # js/src/gc/* public headers
247 # mozilla/
248 # mfbt headers
251 install::
252 $(call py_action,process_install_manifest,--no-remove $(DESTDIR)$(includedir) $(DEPTH)/_build_manifests/install/dist_include)
255 # END SpiderMonkey header installation
256 #############################################
258 install:: $(SCRIPTS)
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))
265 endif
266 ifneq (,$(SHARED_LIBRARY))
267 $(SYSINSTALL) $(SHARED_LIBRARY) $(DESTDIR)$(libdir)
268 endif
269 ifneq (,$(IMPORT_LIBRARY))
270 $(SYSINSTALL) $(IMPORT_LIBRARY) $(DESTDIR)$(libdir)
271 endif
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
282 ifdef MOZ_ETW
283 ETWProvider.h ETWProvider.rc ETWProvider.mof: ETWProvider.man
284 $(MC) -um -mof $^
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)
294 endif
296 ifdef HAVE_DTRACE
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
306 endif
308 # Prepare self-hosted JS code for embedding
309 export:: selfhosting
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 \
328 $(NULL)
330 selfhosted_out_h_deps := \
331 $(selfhosting_srcs) \
332 $(srcdir)/js.msg \
333 $(srcdir)/builtin/embedjs.py \
334 $(srcdir)/builtin/TypedObjectConstants.h \
335 $(srcdir)/builtin/SelfHostingDefines.h \
336 $(NULL)
338 SELFHOSTED_DEFINES += $(DEFINES) $(ACDEFINES)
339 ifdef MOZ_DEBUG
340 SELFHOSTED_DEFINES += $(MOZ_DEBUG_ENABLE_DEFS)
341 else
342 SELFHOSTED_DEFINES += $(MOZ_DEBUG_DISABLE_DEFS)
343 endif
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)
353 ifneq (,$(TAR))
355 source-package:
356 SRCDIR=$(srcdir) \
357 DIST=$(DIST) \
358 MAKE=$(MAKE) \
359 MKDIR=$(MKDIR) \
360 TAR=$(TAR) \
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
367 clean::
368 DIST=$(DIST) \
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
375 endif