builtins directory causes name conflict on Python 3
[WebKit-https.git] / Source / JavaScriptCore / DerivedSources.make
1 # Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013, 2015 Apple Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 #
7 # 1.  Redistributions of source code must retain the above copyright
8 #     notice, this list of conditions and the following disclaimer.
9 # 2.  Redistributions in binary form must reproduce the above copyright
10 #     notice, this list of conditions and the following disclaimer in the
11 #     documentation and/or other materials provided with the distribution.
12 # 3.  Neither the name of Apple Inc. ("Apple") nor the names of
13 #     its contributors may be used to endorse or promote products derived
14 #     from this software without specific prior written permission.
15 #
16 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
17 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
20 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27 VPATH = \
28     $(JavaScriptCore) \
29     $(JavaScriptCore)/parser \
30     $(JavaScriptCore)/runtime \
31     $(JavaScriptCore)/interpreter \
32     $(JavaScriptCore)/jit \
33     $(JavaScriptCore)/builtins \
34     $(JavaScriptCore)/wasm/js \
35 #
36
37 PYTHON = python
38 PERL = perl
39 RUBY = ruby
40
41 JavaScriptCore_SCRIPTS_DIR = $(JavaScriptCore)/Scripts
42
43 ifeq ($(OS),Windows_NT)
44     DELETE = cmd //C del
45 else
46     DELETE = rm -f
47 endif
48
49 # --------
50
51 .PHONY : all
52 all : \
53     udis86_itab.h \
54     Bytecodes.h \
55     BytecodeStructs.h \
56     CombinedDomains.json \
57     InitBytecodes.asm \
58     InjectedScriptSource.h \
59     inspector/InspectorFrontendDispatchers.h \
60     IntlCanonicalizeLanguage.h \
61     JSCBuiltins.h \
62     Lexer.lut.h \
63     KeywordLookup.h \
64     RegExpJitTables.h \
65     AirOpcode.h \
66     UnicodePatternTables.h \
67     yarr/YarrCanonicalizeUnicode.cpp \
68     WasmOps.h \
69     WasmValidateInlines.h \
70     WasmB3IRGeneratorInlines.h \
71 #
72
73 # JavaScript builtins.
74
75 BUILTINS_GENERATOR_SCRIPTS = \
76     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/__init__.py \
77     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/wkbuiltins.py \
78     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/builtins_generator.py \
79     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/builtins_model.py \
80     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/builtins_templates.py \
81     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/builtins_generate_combined_header.py \
82     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/builtins_generate_combined_implementation.py \
83     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/builtins_generate_separate_header.py \
84     $(JavaScriptCore_SCRIPTS_DIR)/wkbuiltins/builtins_generate_separate_implementation.py \
85     ${JavaScriptCore_SCRIPTS_DIR}/wkbuiltins/builtins_generate_wrapper_header.py \
86     ${JavaScriptCore_SCRIPTS_DIR}/wkbuiltins/builtins_generate_wrapper_implementation.py \
87     ${JavaScriptCore_SCRIPTS_DIR}/wkbuiltins/builtins_generate_internals_wrapper_header.py \
88     ${JavaScriptCore_SCRIPTS_DIR}/wkbuiltins/builtins_generate_internals_wrapper_implementation.py \
89     $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py \
90     $(JavaScriptCore_SCRIPTS_DIR)/lazywriter.py \
91 #
92
93 JavaScriptCore_BUILTINS_SOURCES = \
94     $(JavaScriptCore)/builtins/AsyncFromSyncIteratorPrototype.js \
95     $(JavaScriptCore)/builtins/ArrayConstructor.js \
96     $(JavaScriptCore)/builtins/ArrayIteratorPrototype.js \
97     $(JavaScriptCore)/builtins/ArrayPrototype.js \
98     $(JavaScriptCore)/builtins/AsyncIteratorPrototype.js \
99     $(JavaScriptCore)/builtins/AsyncFunctionPrototype.js \
100     $(JavaScriptCore)/builtins/AsyncGeneratorPrototype.js \
101     $(JavaScriptCore)/builtins/DatePrototype.js \
102     $(JavaScriptCore)/builtins/FunctionPrototype.js \
103     $(JavaScriptCore)/builtins/GeneratorPrototype.js \
104     $(JavaScriptCore)/builtins/GlobalObject.js \
105     $(JavaScriptCore)/builtins/GlobalOperations.js \
106     $(JavaScriptCore)/builtins/InspectorInstrumentationObject.js \
107     $(JavaScriptCore)/builtins/InternalPromiseConstructor.js \
108     $(JavaScriptCore)/builtins/IteratorHelpers.js \
109     $(JavaScriptCore)/builtins/IteratorPrototype.js \
110     $(JavaScriptCore)/builtins/MapIteratorPrototype.js \
111     $(JavaScriptCore)/builtins/MapPrototype.js \
112     $(JavaScriptCore)/builtins/ModuleLoader.js \
113     $(JavaScriptCore)/builtins/NumberConstructor.js \
114     $(JavaScriptCore)/builtins/NumberPrototype.js \
115     $(JavaScriptCore)/builtins/ObjectConstructor.js \
116     $(JavaScriptCore)/builtins/PromiseConstructor.js \
117     $(JavaScriptCore)/builtins/PromiseOperations.js \
118     $(JavaScriptCore)/builtins/PromisePrototype.js \
119     $(JavaScriptCore)/builtins/ReflectObject.js \
120     $(JavaScriptCore)/builtins/RegExpPrototype.js \
121     $(JavaScriptCore)/builtins/SetIteratorPrototype.js \
122     $(JavaScriptCore)/builtins/SetPrototype.js \
123     $(JavaScriptCore)/builtins/StringConstructor.js \
124     $(JavaScriptCore)/builtins/StringIteratorPrototype.js \
125     $(JavaScriptCore)/builtins/StringPrototype.js \
126     $(JavaScriptCore)/builtins/TypedArrayConstructor.js \
127     $(JavaScriptCore)/builtins/TypedArrayPrototype.js \
128     $(JavaScriptCore)/builtins/WebAssemblyPrototype.js \
129 #
130
131 # The combined output file depends on the contents of builtins and generator scripts, so
132 # adding, modifying, or removing builtins or scripts will trigger regeneration of files.
133
134 JavaScriptCore_BUILTINS_DEPENDENCIES_LIST : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py DerivedSources.make
135         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(JavaScriptCore_BUILTINS_SOURCES) $(BUILTINS_GENERATOR_SCRIPTS)' $@
136
137 JSCBuiltins.h: $(BUILTINS_GENERATOR_SCRIPTS) $(JavaScriptCore_BUILTINS_SOURCES) JavaScriptCore_BUILTINS_DEPENDENCIES_LIST
138         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py --combined --output-directory . --framework JavaScriptCore $(JavaScriptCore_BUILTINS_SOURCES)
139
140 # Perfect hash lookup tables for JavaScript classes.
141
142 OBJECT_LUT_HEADERS = \
143     ArrayConstructor.lut.h \
144     ArrayIteratorPrototype.lut.h \
145     AsyncGeneratorPrototype.lut.h \
146     BigIntPrototype.lut.h \
147     BigIntConstructor.lut.h \
148     BooleanPrototype.lut.h \
149     DateConstructor.lut.h \
150     DatePrototype.lut.h \
151     ErrorPrototype.lut.h \
152     GeneratorPrototype.lut.h \
153     InspectorInstrumentationObject.lut.h \
154     IntlCollatorConstructor.lut.h \
155     IntlCollatorPrototype.lut.h \
156     IntlDateTimeFormatConstructor.lut.h \
157     IntlDateTimeFormatPrototype.lut.h \
158     IntlNumberFormatConstructor.lut.h \
159     IntlNumberFormatPrototype.lut.h \
160     IntlPluralRulesConstructor.lut.h \
161     IntlPluralRulesPrototype.lut.h \
162     JSDataViewPrototype.lut.h \
163     JSGlobalObject.lut.h \
164     JSInternalPromiseConstructor.lut.h \
165     JSModuleLoader.lut.h \
166     JSONObject.lut.h \
167     JSPromisePrototype.lut.h \
168     JSPromiseConstructor.lut.h \
169     MapPrototype.lut.h \
170     NumberConstructor.lut.h \
171     NumberPrototype.lut.h \
172     ObjectConstructor.lut.h \
173     ReflectObject.lut.h \
174     RegExpConstructor.lut.h \
175     SetPrototype.lut.h \
176     StringConstructor.lut.h \
177     StringIteratorPrototype.lut.h \
178     StringPrototype.lut.h \
179     SymbolConstructor.lut.h \
180     SymbolPrototype.lut.h \
181     WebAssemblyCompileErrorConstructor.lut.h \
182     WebAssemblyCompileErrorPrototype.lut.h \
183     WebAssemblyInstanceConstructor.lut.h \
184     WebAssemblyInstancePrototype.lut.h \
185     WebAssemblyLinkErrorConstructor.lut.h \
186     WebAssemblyLinkErrorPrototype.lut.h \
187     WebAssemblyMemoryConstructor.lut.h \
188     WebAssemblyMemoryPrototype.lut.h \
189     WebAssemblyModuleConstructor.lut.h \
190     WebAssemblyModulePrototype.lut.h \
191     WebAssemblyPrototype.lut.h \
192     WebAssemblyRuntimeErrorConstructor.lut.h \
193     WebAssemblyRuntimeErrorPrototype.lut.h \
194     WebAssemblyTableConstructor.lut.h \
195     WebAssemblyTablePrototype.lut.h \
196 #
197
198 $(OBJECT_LUT_HEADERS): %.lut.h : %.cpp $(JavaScriptCore)/create_hash_table
199         $(PERL) $(JavaScriptCore)/create_hash_table $< > $@
200
201 Lexer.lut.h: Keywords.table $(JavaScriptCore)/create_hash_table
202         $(PERL) $(JavaScriptCore)/create_hash_table $< > $@
203
204 # character tables for Yarr
205
206 RegExpJitTables.h: yarr/create_regex_tables
207         $(PYTHON) $^ > $@
208
209 KeywordLookup.h: KeywordLookupGenerator.py Keywords.table
210         $(PYTHON) $^ > $@
211
212 # udis86 instruction tables
213
214 udis86_itab.h: $(JavaScriptCore)/disassembler/udis86/ud_itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml
215         $(PYTHON) $(JavaScriptCore)/disassembler/udis86/ud_itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml .
216
217 # Bytecode files
218
219 Bytecodes.h: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
220         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --bytecodes_h Bytecodes.h $(JavaScriptCore)/bytecode/BytecodeList.json
221
222 BytecodeStructs.h: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
223         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --bytecode_structs_h BytecodeStructs.h $(JavaScriptCore)/bytecode/BytecodeList.json
224
225 InitBytecodes.asm: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
226         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --init_bytecodes_asm InitBytecodes.asm $(JavaScriptCore)/bytecode/BytecodeList.json
227
228 # Inspector interfaces
229
230 INSPECTOR_DOMAINS = \
231     $(JavaScriptCore)/inspector/protocol/ApplicationCache.json \
232     $(JavaScriptCore)/inspector/protocol/CSS.json \
233     $(JavaScriptCore)/inspector/protocol/Canvas.json \
234     $(JavaScriptCore)/inspector/protocol/Console.json \
235     $(JavaScriptCore)/inspector/protocol/DOM.json \
236     $(JavaScriptCore)/inspector/protocol/DOMDebugger.json \
237     $(JavaScriptCore)/inspector/protocol/DOMStorage.json \
238     $(JavaScriptCore)/inspector/protocol/Database.json \
239     $(JavaScriptCore)/inspector/protocol/Debugger.json \
240     $(JavaScriptCore)/inspector/protocol/GenericTypes.json \
241     $(JavaScriptCore)/inspector/protocol/Heap.json \
242     $(JavaScriptCore)/inspector/protocol/Inspector.json \
243     $(JavaScriptCore)/inspector/protocol/LayerTree.json \
244     $(JavaScriptCore)/inspector/protocol/Network.json \
245     $(JavaScriptCore)/inspector/protocol/OverlayTypes.json \
246     $(JavaScriptCore)/inspector/protocol/Page.json \
247     $(JavaScriptCore)/inspector/protocol/Recording.json \
248     $(JavaScriptCore)/inspector/protocol/Runtime.json \
249     $(JavaScriptCore)/inspector/protocol/ScriptProfiler.json \
250     $(JavaScriptCore)/inspector/protocol/Timeline.json \
251     $(JavaScriptCore)/inspector/protocol/Worker.json \
252 #
253
254 ifeq ($(findstring ENABLE_INDEXED_DATABASE,$(FEATURE_DEFINES)), ENABLE_INDEXED_DATABASE)
255     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/IndexedDB.json
256 endif
257
258 ifeq ($(findstring ENABLE_RESOURCE_USAGE,$(FEATURE_DEFINES)), ENABLE_RESOURCE_USAGE)
259     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/Memory.json
260 endif
261
262 ifeq ($(findstring ENABLE_SERVICE_WORKER,$(FEATURE_DEFINES)), ENABLE_SERVICE_WORKER)
263     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/ServiceWorker.json
264 endif
265
266 INSPECTOR_GENERATOR_SCRIPTS = \
267         $(JavaScriptCore)/inspector/scripts/codegen/__init__.py \
268         $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator_templates.py \
269         $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator.py \
270         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py \
271         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py \
272         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py \
273         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py \
274         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_protocol_types_header.py \
275         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py \
276         $(JavaScriptCore)/inspector/scripts/codegen/generate_js_backend_commands.py \
277         $(JavaScriptCore)/inspector/scripts/codegen/generator_templates.py \
278         $(JavaScriptCore)/inspector/scripts/codegen/generator.py \
279         $(JavaScriptCore)/inspector/scripts/codegen/models.py \
280         $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py \
281         $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py \
282 #
283
284 # The combined JSON file depends on the actual set of domains and their file contents, so that
285 # adding, modifying, or removing domains will trigger regeneration of inspector files.
286
287 .PHONY: force
288 EnabledInspectorDomains : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py force
289         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(INSPECTOR_DOMAINS)' $@
290
291 CombinedDomains.json : $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) EnabledInspectorDomains
292         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./CombinedDomains.json
293
294 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
295 inspector/InspectorFrontendDispatchers.h : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS) inspector
296         $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py --framework JavaScriptCore --outputDir inspector ./CombinedDomains.json
297
298 InjectedScriptSource.h : inspector/InjectedScriptSource.js $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl
299         echo "//# sourceURL=__InjectedScript_InjectedScriptSource.js" > ./InjectedScriptSource.min.js
300         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py < $(JavaScriptCore)/inspector/InjectedScriptSource.js >> ./InjectedScriptSource.min.js
301         $(PERL) $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl InjectedScriptSource_js ./InjectedScriptSource.min.js InjectedScriptSource.h
302         $(DELETE) InjectedScriptSource.min.js
303
304 AirOpcode.h: $(JavaScriptCore)/b3/air/opcode_generator.rb $(JavaScriptCore)/b3/air/AirOpcode.opcodes
305         $(RUBY) $^
306
307 UnicodePatternTables.h: $(JavaScriptCore)/yarr/generateYarrUnicodePropertyTables.py $(JavaScriptCore)/yarr/hasher.py $(JavaScriptCore)/ucd/DerivedBinaryProperties.txt $(JavaScriptCore)/ucd/DerivedCoreProperties.txt $(JavaScriptCore)/ucd/DerivedNormalizationProps.txt $(JavaScriptCore)/ucd/PropList.txt $(JavaScriptCore)/ucd/PropertyAliases.txt $(JavaScriptCore)/ucd/PropertyValueAliases.txt $(JavaScriptCore)/ucd/ScriptExtensions.txt $(JavaScriptCore)/ucd/Scripts.txt $(JavaScriptCore)/ucd/UnicodeData.txt $(JavaScriptCore)/ucd/emoji-data.txt
308         $(PYTHON) $(JavaScriptCore)/yarr/generateYarrUnicodePropertyTables.py $(JavaScriptCore)/ucd ./UnicodePatternTables.h
309
310 yarr/YarrCanonicalizeUnicode.cpp: $(JavaScriptCore)/yarr/generateYarrCanonicalizeUnicode $(JavaScriptCore)/ucd/CaseFolding.txt
311         $(PYTHON) $(JavaScriptCore)/yarr/generateYarrCanonicalizeUnicode $(JavaScriptCore)/ucd/CaseFolding.txt ./yarr/YarrCanonicalizeUnicode.cpp
312
313 IntlCanonicalizeLanguage.h: $(JavaScriptCore)/Scripts/generateIntlCanonicalizeLanguage.py $(JavaScriptCore)/ucd/language-subtag-registry.txt
314         $(PYTHON) $(JavaScriptCore)/Scripts/generateIntlCanonicalizeLanguage.py $(JavaScriptCore)/ucd/language-subtag-registry.txt ./IntlCanonicalizeLanguage.h
315
316 WasmOps.h: $(JavaScriptCore)/wasm/generateWasmOpsHeader.py $(JavaScriptCore)/wasm/generateWasm.py $(JavaScriptCore)/wasm/wasm.json
317         $(PYTHON) $(JavaScriptCore)/wasm/generateWasmOpsHeader.py $(JavaScriptCore)/wasm/wasm.json ./WasmOps.h
318
319 WasmValidateInlines.h: $(JavaScriptCore)/wasm/generateWasmValidateInlinesHeader.py $(JavaScriptCore)/wasm/generateWasm.py $(JavaScriptCore)/wasm/wasm.json
320         $(PYTHON) $(JavaScriptCore)/wasm/generateWasmValidateInlinesHeader.py $(JavaScriptCore)/wasm/wasm.json ./WasmValidateInlines.h
321
322 WasmB3IRGeneratorInlines.h: $(JavaScriptCore)/wasm/generateWasmB3IRGeneratorInlinesHeader.py $(JavaScriptCore)/wasm/generateWasm.py $(JavaScriptCore)/wasm/wasm.json
323         $(PYTHON) $(JavaScriptCore)/wasm/generateWasmB3IRGeneratorInlinesHeader.py $(JavaScriptCore)/wasm/wasm.json ./WasmB3IRGeneratorInlines.h
324
325 # Dynamically-defined targets are listed below. Static targets belong up top.
326
327 all : \
328     $(OBJECT_LUT_HEADERS) \
329 #