1# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
2# vim: set filetype=python:
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/.
6
7# Directory metadata
8component_engine = ('Core', 'JavaScript Engine')
9component_gc     = ('Core', 'JavaScript: GC')
10component_intl   = ('Core', 'JavaScript: Internationalization API')
11component_jit    = ('Core', 'JavaScript Engine: JIT')
12component_stl    = ('Core', 'JavaScript: Standard Library')
13
14FILES_PER_UNIFIED_FILE = 6
15
16with Files('../public/**'):
17    BUG_COMPONENT = component_engine
18with Files('*'):
19    BUG_COMPONENT = component_engine
20
21with Files('asmjs/**'):
22    BUG_COMPONENT = component_jit
23with Files('builtin/**'):
24    BUG_COMPONENT = component_stl
25with Files('ctypes/**'):
26    BUG_COMPONENT = ('Core', 'js-ctypes')
27with Files('gc/**'):
28    BUG_COMPONENT = component_gc
29with Files('jit/**'):
30    BUG_COMPONENT = component_jit
31
32# File-specific metadata
33for gcfile in ['jsgc*', 'devtools/rootAnalysis', 'devtools/gc-ubench', 'devtools/gctrace']:
34    with Files(gcfile):
35        BUG_COMPONENT = component_gc
36for header in ('GCAPI.h', 'HeapAPI.h', 'RootingAPI.h', 'SliceBudget.h', 'TraceKind.h', 'TracingAPI.h', 'WeakMapPtr.h'):
37    with Files('../public/' + header):
38        BUG_COMPONENT = component_gc
39
40for stlfile in ['jsarray.*', 'jsbool*', 'jsdate.*', 'jsnum.*', 'json.*', 'jsstr.*']:
41    with Files(stlfile):
42        BUG_COMPONENT = component_stl
43
44with Files('builtin/Intl*'):
45    BUG_COMPONENT = component_intl
46with Files('builtin/make_intl_data.py'):
47    BUG_COMPONENT = component_intl
48
49with Files('../public/TrackedOptimizationInfo.h'):
50    BUG_COMPONENT = component_jit
51
52
53if CONFIG['JS_BUNDLED_EDITLINE']:
54    DIRS += ['editline']
55
56# editline needs to get built before the shell
57if not CONFIG['JS_DISABLE_SHELL']:
58    DIRS += ['shell']
59
60TEST_DIRS += ['jsapi-tests', 'tests', 'gdb']
61
62CONFIGURE_SUBST_FILES += [
63    'devtools/rootAnalysis/Makefile',
64    'js-confdefs.h',
65    'js-config',
66    'js.pc',
67]
68
69if not CONFIG['JS_STANDALONE']:
70    CONFIGURE_SUBST_FILES += [
71        '../../config/autoconf-js.mk',
72        '../../config/emptyvars-js.mk',
73    ]
74
75CONFIGURE_DEFINE_FILES += [
76    'js-config.h',
77]
78
79# Changes to internal header files, used externally, massively slow down
80# browser builds.  Don't add new files here unless you know what you're
81# doing!
82EXPORTS += [
83    'js.msg',
84    'jsalloc.h',
85    'jsapi.h',
86    'jsbytecode.h',
87    'jsclist.h',
88    'jscpucfg.h',
89    'jsfriendapi.h',
90    'jsprf.h',
91    'jsprototypes.h',
92    'jspubtd.h',
93    'jstypes.h',
94    'jsversion.h',
95    'jswrapper.h',
96    'perf/jsperf.h',
97]
98
99# If you add a header here, add it to js/src/jsapi-tests/testIntTypesABI.cpp so
100# that we ensure we don't over-expose our internal integer typedefs.  Note that
101# LegacyIntTypes.h below is deliberately exempted from this requirement.
102EXPORTS.js += [
103    '../public/CallArgs.h',
104    '../public/CallNonGenericMethod.h',
105    '../public/CharacterEncoding.h',
106    '../public/Class.h',
107    '../public/Conversions.h',
108    '../public/Date.h',
109    '../public/Debug.h',
110    '../public/GCAPI.h',
111    '../public/GCHashTable.h',
112    '../public/HashTable.h',
113    '../public/HeapAPI.h',
114    '../public/Id.h',
115    '../public/Initialization.h',
116    '../public/LegacyIntTypes.h',
117    '../public/MemoryMetrics.h',
118    '../public/Principals.h',
119    '../public/ProfilingFrameIterator.h',
120    '../public/ProfilingStack.h',
121    '../public/Proxy.h',
122    '../public/RequiredDefines.h',
123    '../public/RootingAPI.h',
124    '../public/SliceBudget.h',
125    '../public/StructuredClone.h',
126    '../public/TraceableVector.h',
127    '../public/TraceKind.h',
128    '../public/TracingAPI.h',
129    '../public/TrackedOptimizationInfo.h',
130    '../public/TypeDecls.h',
131    '../public/UbiNode.h',
132    '../public/UbiNodeBreadthFirst.h',
133    '../public/UbiNodeCensus.h',
134    '../public/UbiNodeDominatorTree.h',
135    '../public/UbiNodePostOrder.h',
136    '../public/Utility.h',
137    '../public/Value.h',
138    '../public/Vector.h',
139    '../public/WeakMapPtr.h',
140]
141
142UNIFIED_SOURCES += [
143    'asmjs/AsmJSFrameIterator.cpp',
144    'asmjs/AsmJSLink.cpp',
145    'asmjs/AsmJSModule.cpp',
146    'asmjs/AsmJSSignalHandlers.cpp',
147    'asmjs/AsmJSValidate.cpp',
148    'asmjs/WasmGenerator.cpp',
149    'asmjs/WasmIonCompile.cpp',
150    'asmjs/WasmStubs.cpp',
151    'builtin/AtomicsObject.cpp',
152    'builtin/Eval.cpp',
153    'builtin/Intl.cpp',
154    'builtin/MapObject.cpp',
155    'builtin/ModuleObject.cpp',
156    'builtin/Object.cpp',
157    'builtin/Profilers.cpp',
158    'builtin/Reflect.cpp',
159    'builtin/ReflectParse.cpp',
160    'builtin/SIMD.cpp',
161    'builtin/SymbolObject.cpp',
162    'builtin/TestingFunctions.cpp',
163    'builtin/TypedObject.cpp',
164    'builtin/WeakMapObject.cpp',
165    'builtin/WeakSetObject.cpp',
166    'devtools/sharkctl.cpp',
167    'ds/LifoAlloc.cpp',
168    'frontend/BytecodeCompiler.cpp',
169    'frontend/BytecodeEmitter.cpp',
170    'frontend/FoldConstants.cpp',
171    'frontend/NameFunctions.cpp',
172    'frontend/ParseMaps.cpp',
173    'frontend/ParseNode.cpp',
174    'frontend/TokenStream.cpp',
175    'gc/Allocator.cpp',
176    'gc/Barrier.cpp',
177    'gc/GCTrace.cpp',
178    'gc/Iteration.cpp',
179    'gc/Marking.cpp',
180    'gc/Memory.cpp',
181    'gc/MemoryProfiler.cpp',
182    'gc/Nursery.cpp',
183    'gc/RootMarking.cpp',
184    'gc/Statistics.cpp',
185    'gc/Tracer.cpp',
186    'gc/Verifier.cpp',
187    'gc/Zone.cpp',
188    'irregexp/NativeRegExpMacroAssembler.cpp',
189    'irregexp/RegExpAST.cpp',
190    'irregexp/RegExpEngine.cpp',
191    'irregexp/RegExpInterpreter.cpp',
192    'irregexp/RegExpMacroAssembler.cpp',
193    'irregexp/RegExpParser.cpp',
194    'irregexp/RegExpStack.cpp',
195    'jit/AliasAnalysis.cpp',
196    'jit/AlignmentMaskAnalysis.cpp',
197    'jit/BacktrackingAllocator.cpp',
198    'jit/Bailouts.cpp',
199    'jit/BaselineBailouts.cpp',
200    'jit/BaselineCompiler.cpp',
201    'jit/BaselineDebugModeOSR.cpp',
202    'jit/BaselineFrame.cpp',
203    'jit/BaselineFrameInfo.cpp',
204    'jit/BaselineIC.cpp',
205    'jit/BaselineInspector.cpp',
206    'jit/BaselineJIT.cpp',
207    'jit/BitSet.cpp',
208    'jit/BytecodeAnalysis.cpp',
209    'jit/C1Spewer.cpp',
210    'jit/CodeGenerator.cpp',
211    'jit/CompileWrappers.cpp',
212    'jit/Disassembler.cpp',
213    'jit/EagerSimdUnbox.cpp',
214    'jit/EdgeCaseAnalysis.cpp',
215    'jit/EffectiveAddressAnalysis.cpp',
216    'jit/ExecutableAllocator.cpp',
217    'jit/InstructionReordering.cpp',
218    'jit/Ion.cpp',
219    'jit/IonAnalysis.cpp',
220    'jit/IonBuilder.cpp',
221    'jit/IonCaches.cpp',
222    'jit/IonOptimizationLevels.cpp',
223    'jit/JitcodeMap.cpp',
224    'jit/JitFrames.cpp',
225    'jit/JitOptions.cpp',
226    'jit/JitSpewer.cpp',
227    'jit/JSONSpewer.cpp',
228    'jit/LICM.cpp',
229    'jit/LIR.cpp',
230    'jit/LoopUnroller.cpp',
231    'jit/Lowering.cpp',
232    'jit/MacroAssembler.cpp',
233    'jit/MCallOptimize.cpp',
234    'jit/MIR.cpp',
235    'jit/MIRGraph.cpp',
236    'jit/MoveResolver.cpp',
237    'jit/OptimizationTracking.cpp',
238    'jit/PerfSpewer.cpp',
239    'jit/ProcessExecutableMemory.cpp',
240    'jit/RangeAnalysis.cpp',
241    'jit/Recover.cpp',
242    'jit/RegisterAllocator.cpp',
243    'jit/RematerializedFrame.cpp',
244    'jit/Safepoints.cpp',
245    'jit/ScalarReplacement.cpp',
246    'jit/shared/BaselineCompiler-shared.cpp',
247    'jit/shared/CodeGenerator-shared.cpp',
248    'jit/shared/Lowering-shared.cpp',
249    'jit/SharedIC.cpp',
250    'jit/Sink.cpp',
251    'jit/Snapshots.cpp',
252    'jit/StupidAllocator.cpp',
253    'jit/TypedObjectPrediction.cpp',
254    'jit/TypePolicy.cpp',
255    'jit/ValueNumbering.cpp',
256    'jit/VMFunctions.cpp',
257    'jsalloc.cpp',
258    'jsapi.cpp',
259    'jsbool.cpp',
260    'jscntxt.cpp',
261    'jscompartment.cpp',
262    'jsdate.cpp',
263    'jsdtoa.cpp',
264    'jsexn.cpp',
265    'jsfriendapi.cpp',
266    'jsfun.cpp',
267    'jsgc.cpp',
268    'jsiter.cpp',
269    'jsnativestack.cpp',
270    'jsnum.cpp',
271    'jsobj.cpp',
272    'json.cpp',
273    'jsopcode.cpp',
274    'jsprf.cpp',
275    'jspropertytree.cpp',
276    'jsscript.cpp',
277    'jsstr.cpp',
278    'jswatchpoint.cpp',
279    'jsweakmap.cpp',
280    'perf/jsperf.cpp',
281    'proxy/BaseProxyHandler.cpp',
282    'proxy/CrossCompartmentWrapper.cpp',
283    'proxy/DeadObjectProxy.cpp',
284    'proxy/DirectProxyHandler.cpp',
285    'proxy/OpaqueCrossCompartmentWrapper.cpp',
286    'proxy/Proxy.cpp',
287    'proxy/ScriptedDirectProxyHandler.cpp',
288    'proxy/ScriptedIndirectProxyHandler.cpp',
289    'proxy/SecurityWrapper.cpp',
290    'proxy/Wrapper.cpp',
291    'vm/ArgumentsObject.cpp',
292    'vm/ArrayBufferObject.cpp',
293    'vm/CallNonGenericMethod.cpp',
294    'vm/CharacterEncoding.cpp',
295    'vm/CodeCoverage.cpp',
296    'vm/Compression.cpp',
297    'vm/DateTime.cpp',
298    'vm/Debugger.cpp',
299    'vm/DebuggerMemory.cpp',
300    'vm/ErrorObject.cpp',
301    'vm/ForOfIterator.cpp',
302    'vm/GeneratorObject.cpp',
303    'vm/GlobalObject.cpp',
304    'vm/HelperThreads.cpp',
305    'vm/Id.cpp',
306    'vm/Interpreter.cpp',
307    'vm/JSONParser.cpp',
308    'vm/MemoryMetrics.cpp',
309    'vm/Monitor.cpp',
310    'vm/NativeObject.cpp',
311    'vm/ObjectGroup.cpp',
312    'vm/PIC.cpp',
313    'vm/Printer.cpp',
314    'vm/Probes.cpp',
315    'vm/ProxyObject.cpp',
316    'vm/ReceiverGuard.cpp',
317    'vm/RegExpObject.cpp',
318    'vm/RegExpStatics.cpp',
319    'vm/Runtime.cpp',
320    'vm/SavedStacks.cpp',
321    'vm/ScopeObject.cpp',
322    'vm/SelfHosting.cpp',
323    'vm/Shape.cpp',
324    'vm/SharedArrayObject.cpp',
325    'vm/SPSProfiler.cpp',
326    'vm/Stack.cpp',
327    'vm/Stopwatch.cpp',
328    'vm/String.cpp',
329    'vm/StringBuffer.cpp',
330    'vm/StructuredClone.cpp',
331    'vm/Symbol.cpp',
332    'vm/TaggedProto.cpp',
333    'vm/Time.cpp',
334    'vm/TypedArrayObject.cpp',
335    'vm/TypeInference.cpp',
336    'vm/UbiNode.cpp',
337    'vm/UbiNodeCensus.cpp',
338    'vm/UnboxedObject.cpp',
339    'vm/Unicode.cpp',
340    'vm/Value.cpp',
341    'vm/WeakMapPtr.cpp',
342    'vm/Xdr.cpp'
343]
344
345# jsarray.cpp and jsatom.cpp cannot be built in unified mode because
346# xpcshell is broken during packaging when compiled with gcc-4.8.2
347# builtin/RegExp.cpp cannot be built in unified mode because it is built
348# without PGO
349# frontend/Parser.cpp cannot be built in unified mode because of explicit
350# template instantiations.
351# jsmath.cpp cannot be built in unified mode because it needs to pull rand_s
352# from <stdlib.h> on Windows through a preprocessor define.
353# jsutil.cpp cannot be built in unified mode because it is needed for
354# check-vanilla-allocations.
355# StoreBuffer.cpp cannot be built in unified because its template
356# instantiations may or may not be needed depending on what it gets bundled
357# with.
358SOURCES += [
359    'builtin/RegExp.cpp',
360    'frontend/Parser.cpp',
361    'gc/StoreBuffer.cpp',
362    'jsarray.cpp',
363    'jsatom.cpp',
364    'jsmath.cpp',
365    'jsutil.cpp',
366    'vm/Initialization.cpp',
367]
368
369if CONFIG['JS_POSIX_NSPR']:
370    UNIFIED_SOURCES += [
371        'vm/PosixNSPR.cpp',
372    ]
373
374if CONFIG['MOZ_INSTRUMENTS']:
375    SOURCES += [
376        'devtools/Instruments.cpp',
377    ]
378
379if CONFIG['ENABLE_TRACE_LOGGING']:
380    SOURCES += [
381        'vm/TraceLogging.cpp',
382        'vm/TraceLoggingGraph.cpp',
383        'vm/TraceLoggingTypes.cpp',
384    ]
385
386if not CONFIG['ENABLE_ION']:
387    UNIFIED_SOURCES += [
388        'jit/none/Trampoline-none.cpp'
389    ]
390elif CONFIG['JS_CODEGEN_X86'] or CONFIG['JS_CODEGEN_X64']:
391    UNIFIED_SOURCES += [
392        'jit/x86-shared/Architecture-x86-shared.cpp',
393        'jit/x86-shared/Assembler-x86-shared.cpp',
394        'jit/x86-shared/AssemblerBuffer-x86-shared.cpp',
395        'jit/x86-shared/BaselineCompiler-x86-shared.cpp',
396        'jit/x86-shared/BaselineIC-x86-shared.cpp',
397        'jit/x86-shared/CodeGenerator-x86-shared.cpp',
398        'jit/x86-shared/Lowering-x86-shared.cpp',
399        'jit/x86-shared/MacroAssembler-x86-shared.cpp',
400        'jit/x86-shared/MoveEmitter-x86-shared.cpp',
401    ]
402    SOURCES += [
403        'jit/x86-shared/Disassembler-x86-shared.cpp',  # using namespace js::jit::X86Encoding;
404    ]
405    if CONFIG['JS_CODEGEN_X64']:
406        UNIFIED_SOURCES += [
407            'jit/x64/Assembler-x64.cpp',
408            'jit/x64/Bailouts-x64.cpp',
409            'jit/x64/BaselineCompiler-x64.cpp',
410            'jit/x64/BaselineIC-x64.cpp',
411            'jit/x64/CodeGenerator-x64.cpp',
412            'jit/x64/Lowering-x64.cpp',
413            'jit/x64/MacroAssembler-x64.cpp',
414            'jit/x64/SharedIC-x64.cpp',
415            'jit/x64/Trampoline-x64.cpp',
416        ]
417    else:
418        UNIFIED_SOURCES += [
419            'jit/x86/Assembler-x86.cpp',
420            'jit/x86/Bailouts-x86.cpp',
421            'jit/x86/BaselineCompiler-x86.cpp',
422            'jit/x86/BaselineIC-x86.cpp',
423            'jit/x86/CodeGenerator-x86.cpp',
424            'jit/x86/Lowering-x86.cpp',
425            'jit/x86/MacroAssembler-x86.cpp',
426            'jit/x86/SharedIC-x86.cpp',
427            'jit/x86/Trampoline-x86.cpp',
428        ]
429elif CONFIG['JS_CODEGEN_ARM']:
430    UNIFIED_SOURCES += [
431        'jit/arm/Architecture-arm.cpp',
432        'jit/arm/Assembler-arm.cpp',
433        'jit/arm/Bailouts-arm.cpp',
434        'jit/arm/BaselineCompiler-arm.cpp',
435        'jit/arm/BaselineIC-arm.cpp',
436        'jit/arm/CodeGenerator-arm.cpp',
437        'jit/arm/disasm/Constants-arm.cpp',
438        'jit/arm/disasm/Disasm-arm.cpp',
439        'jit/arm/Lowering-arm.cpp',
440        'jit/arm/MacroAssembler-arm.cpp',
441        'jit/arm/MoveEmitter-arm.cpp',
442        'jit/arm/SharedIC-arm.cpp',
443        'jit/arm/Trampoline-arm.cpp',
444    ]
445    if CONFIG['JS_SIMULATOR_ARM']:
446        UNIFIED_SOURCES += [
447            'jit/arm/Simulator-arm.cpp'
448        ]
449    elif CONFIG['OS_ARCH'] == 'Darwin':
450        SOURCES += [
451            'jit/arm/llvm-compiler-rt/arm/aeabi_idivmod.S',
452            'jit/arm/llvm-compiler-rt/arm/aeabi_uidivmod.S',
453        ]
454elif CONFIG['JS_CODEGEN_ARM64']:
455    UNIFIED_SOURCES += [
456        'jit/arm64/Architecture-arm64.cpp',
457        'jit/arm64/Assembler-arm64.cpp',
458        'jit/arm64/Bailouts-arm64.cpp',
459        'jit/arm64/BaselineIC-arm64.cpp',
460        'jit/arm64/CodeGenerator-arm64.cpp',
461        'jit/arm64/Lowering-arm64.cpp',
462        'jit/arm64/MacroAssembler-arm64.cpp',
463        'jit/arm64/MoveEmitter-arm64.cpp',
464        'jit/arm64/SharedIC-arm64.cpp',
465        'jit/arm64/Trampoline-arm64.cpp',
466        'jit/arm64/vixl/Assembler-vixl.cpp',
467        'jit/arm64/vixl/Cpu-vixl.cpp',
468        'jit/arm64/vixl/Decoder-vixl.cpp',
469        'jit/arm64/vixl/Disasm-vixl.cpp',
470        'jit/arm64/vixl/Instructions-vixl.cpp',
471        'jit/arm64/vixl/Instrument-vixl.cpp',
472        'jit/arm64/vixl/MacroAssembler-vixl.cpp',
473        'jit/arm64/vixl/MozAssembler-vixl.cpp',
474        'jit/arm64/vixl/MozInstructions-vixl.cpp',
475        'jit/arm64/vixl/Utils-vixl.cpp'
476    ]
477    if CONFIG['JS_SIMULATOR_ARM64']:
478        UNIFIED_SOURCES += [
479            'jit/arm64/vixl/Debugger-vixl.cpp',
480            'jit/arm64/vixl/Logic-vixl.cpp',
481            'jit/arm64/vixl/MozSimulator-vixl.cpp',
482            'jit/arm64/vixl/Simulator-vixl.cpp'
483        ]
484elif CONFIG['JS_CODEGEN_MIPS32'] or CONFIG['JS_CODEGEN_MIPS64']:
485    UNIFIED_SOURCES += [
486        'jit/mips-shared/Architecture-mips-shared.cpp',
487        'jit/mips-shared/Assembler-mips-shared.cpp',
488        'jit/mips-shared/Bailouts-mips-shared.cpp',
489        'jit/mips-shared/BaselineCompiler-mips-shared.cpp',
490        'jit/mips-shared/BaselineIC-mips-shared.cpp',
491        'jit/mips-shared/CodeGenerator-mips-shared.cpp',
492        'jit/mips-shared/Lowering-mips-shared.cpp',
493        'jit/mips-shared/MacroAssembler-mips-shared.cpp',
494        'jit/mips-shared/MoveEmitter-mips-shared.cpp',
495    ]
496    if CONFIG['JS_CODEGEN_MIPS32']:
497        UNIFIED_SOURCES += [
498            'jit/mips32/Architecture-mips32.cpp',
499            'jit/mips32/Assembler-mips32.cpp',
500            'jit/mips32/Bailouts-mips32.cpp',
501            'jit/mips32/BaselineCompiler-mips32.cpp',
502            'jit/mips32/BaselineIC-mips32.cpp',
503            'jit/mips32/CodeGenerator-mips32.cpp',
504            'jit/mips32/Lowering-mips32.cpp',
505            'jit/mips32/MacroAssembler-mips32.cpp',
506            'jit/mips32/MoveEmitter-mips32.cpp',
507            'jit/mips32/SharedIC-mips32.cpp',
508            'jit/mips32/Trampoline-mips32.cpp',
509        ]
510        if CONFIG['JS_SIMULATOR_MIPS32']:
511            UNIFIED_SOURCES += [
512                'jit/mips32/Simulator-mips32.cpp'
513            ]
514    elif CONFIG['JS_CODEGEN_MIPS64']:
515        UNIFIED_SOURCES += [
516            'jit/mips64/Architecture-mips64.cpp',
517            'jit/mips64/Assembler-mips64.cpp',
518            'jit/mips64/Bailouts-mips64.cpp',
519            'jit/mips64/BaselineCompiler-mips64.cpp',
520            'jit/mips64/BaselineIC-mips64.cpp',
521            'jit/mips64/CodeGenerator-mips64.cpp',
522            'jit/mips64/Lowering-mips64.cpp',
523            'jit/mips64/MacroAssembler-mips64.cpp',
524            'jit/mips64/MoveEmitter-mips64.cpp',
525            'jit/mips64/SharedIC-mips64.cpp',
526            'jit/mips64/Trampoline-mips64.cpp',
527        ]
528        if CONFIG['JS_SIMULATOR_MIPS64']:
529            UNIFIED_SOURCES += [
530                'jit/mips64/Simulator-mips64.cpp'
531            ]
532
533if CONFIG['OS_ARCH'] == 'WINNT':
534    # _CRT_RAND_S must be #defined before #including stdlib.h to get rand_s()
535    DEFINES['_CRT_RAND_S'] = True
536
537if CONFIG['JS_HAS_CTYPES']:
538    SOURCES += [
539        'ctypes/CTypes.cpp',
540        'ctypes/Library.cpp',
541    ]
542    if not CONFIG['MOZ_NATIVE_FFI']:
543        LOCAL_INCLUDES += [
544            '!ctypes/libffi/include',
545        ]
546
547if CONFIG['MOZ_VTUNE']:
548    SOURCES += [
549        'vtune/jitprofiling.c'
550    ]
551
552if CONFIG['HAVE_LINUX_PERF_EVENT_H']:
553    SOURCES += [
554        'perf/pm_linux.cpp'
555    ]
556    SOURCES['perf/pm_linux.cpp'].flags += [CONFIG['LINUX_HEADERS_INCLUDES']]
557else:
558    SOURCES += [
559        'perf/pm_stub.cpp'
560    ]
561
562HostSimplePrograms([
563    'host_jskwgen',
564])
565
566# JavaScript must be built shared, even for static builds, as it is used by
567# other modules which are always built shared. Failure to do so results in
568# the js code getting copied into xpinstall and jsd as well as mozilla-bin,
569# and then the static data cells used for locking no longer work.
570#
571# In fact, we now build both a static and a shared library, as the
572# JS shell would like to link to the static library.
573
574if CONFIG['JS_SHARED_LIBRARY']:
575    GeckoSharedLibrary('js', linkage=None)
576    SHARED_LIBRARY_NAME = CONFIG['JS_LIBRARY_NAME']
577    SDK_LIBRARY = True
578else:
579    Library('js')
580
581FORCE_STATIC_LIB = True
582STATIC_LIBRARY_NAME = 'js_static'
583
584if CONFIG['JS_HAS_CTYPES']:
585    USE_LIBS += [
586        'ffi',
587    ]
588
589if CONFIG['ENABLE_INTL_API']:
590    USE_LIBS += [
591        'icu',
592    ]
593
594USE_LIBS += [
595    'nspr',
596    'zlib',
597]
598
599if CONFIG['MOZ_ETW']:
600    GENERATED_FILES = [
601        'ETWProvider.h',
602    ]
603    # This will get the ETW provider resources into the library mozjs.dll
604    RESFILE = 'ETWProvider.res'
605
606if CONFIG['NIGHTLY_BUILD']:
607    DEFINES['ENABLE_BINARYDATA'] = True
608    DEFINES['ENABLE_SHARED_ARRAY_BUFFER'] = True
609
610DEFINES['EXPORT_JS_API'] = True
611
612if CONFIG['JS_HAS_CTYPES']:
613    DEFINES['JS_HAS_CTYPES'] = True
614    for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
615        DEFINES[var] = '"%s"' % CONFIG[var]
616
617if CONFIG['MOZ_LINKER']:
618    DEFINES['MOZ_LINKER'] = True
619
620if CONFIG['_MSC_VER']:
621    if CONFIG['CPU_ARCH'] == 'x86':
622        SOURCES['builtin/RegExp.cpp'].no_pgo = True # Bug 772303
623    elif CONFIG['CPU_ARCH'] == 'x86_64' and CONFIG['JS_HAS_CTYPES']:
624        SOURCES['ctypes/CTypes.cpp'].no_pgo = True # Bug 810661
625    # Prevent floating point errors caused by VC++ optimizations
626    # XXX We should add this to CXXFLAGS, too?
627    CFLAGS += ['-fp:precise']
628    # C4805 warns mixing bool with other integral types in computation.
629    # But given the conversion from bool is specified, and this is a
630    # pattern widely used in code in js/src, suppress this warning here.
631    CXXFLAGS += ['-wd4805']
632    # C4661 ("no suitable definition provided for explicit template
633    # instantiation request") is emitted for all Parser methods that
634    # have a Parser<FullParseHandler> definition but no
635    # Parser<SyntaxParseHandler> definition, see bug 1167030.
636    CXXFLAGS += ['-wd4661']
637    CXXFLAGS += ['-we4067', '-we4258', '-we4275']
638    CXXFLAGS += ['-wd4146'] # FIXME: unary minus operator applied to unsigned type (bug 1229189)
639    CXXFLAGS += ['-wd4273'] # FIXME: inconsistent dll linkage (bug 1229666)
640
641if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'):
642    OS_LIBS += [
643        'm',
644    ]
645
646if CONFIG['OS_ARCH'] == 'FreeBSD':
647    OS_LIBS += [
648        '-pthread',
649    ]
650
651if CONFIG['OS_ARCH'] == 'Linux':
652    OS_LIBS += [
653        'dl',
654    ]
655
656if CONFIG['OS_ARCH'] == 'SunOS':
657    OS_LIBS += [
658        'posix4',
659        'dl',
660        'nsl',
661        'socket',
662    ]
663
664CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
665CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
666LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
667
668NO_EXPAND_LIBS = True
669
670DIST_INSTALL = True
671
672# Prepare self-hosted JS code for embedding
673GENERATED_FILES += ['selfhosted.out.h']
674selfhosted = GENERATED_FILES['selfhosted.out.h']
675selfhosted.script = 'builtin/embedjs.py:generate_selfhosted'
676selfhosted.inputs = [
677    'js.msg',
678    'builtin/TypedObjectConstants.h',
679    'builtin/SelfHostingDefines.h',
680    'builtin/Utilities.js',
681    'builtin/Array.js',
682    'builtin/Date.js',
683    'builtin/Error.js',
684    'builtin/Generator.js',
685    'builtin/Intl.js',
686    'builtin/IntlData.js',
687    'builtin/Iterator.js',
688    'builtin/Map.js',
689    'builtin/Module.js',
690    'builtin/Number.js',
691    'builtin/Object.js',
692    'builtin/Reflect.js',
693    'builtin/RegExp.js',
694    'builtin/String.js',
695    'builtin/Set.js',
696    'builtin/TypedArray.js',
697    'builtin/TypedObject.js',
698    'builtin/WeakSet.js'
699]
700
701if CONFIG['JS_HAS_CTYPES']:
702    if CONFIG['MOZ_NATIVE_FFI']:
703        CXXFLAGS += CONFIG['MOZ_FFI_CFLAGS']
704    else:
705        # Windows needs this to be linked with a static library.
706        DEFINES['FFI_BUILDING'] = True
707