Unreviewed, rolling out r194328.
[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 #
35
36 PYTHON = python
37 PERL = perl
38 RUBY = ruby
39
40 JavaScriptCore_SCRIPTS_DIR = $(JavaScriptCore)/Scripts
41
42 ifeq ($(OS),Windows_NT)
43     DELETE = cmd //C del
44 else
45     DELETE = rm -f
46 endif
47
48 # --------
49
50 .PHONY : all
51 all : \
52     udis86_itab.h \
53     Bytecodes.h \
54     CombinedDomains.json \
55     InitBytecodes.asm \
56     InjectedScriptSource.h \
57     InspectorFrontendDispatchers.h \
58     JSReplayInputs.h \
59     JSCBuiltins.h \
60     Lexer.lut.h \
61     KeywordLookup.h \
62     RegExpJitTables.h \
63     AirOpcode.h \
64 #
65
66 # JavaScript builtins.
67
68 BUILTINS_GENERATOR_SCRIPTS = \
69     $(JavaScriptCore_SCRIPTS_DIR)/builtins/__init__.py \
70     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins.py \
71     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generator.py \
72     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_model.py \
73     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_templates.py \
74     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_combined_header.py \
75     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_combined_implementation.py \
76     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_separate_header.py \
77     $(JavaScriptCore_SCRIPTS_DIR)/builtins/builtins_generate_separate_implementation.py \
78     $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py \
79     $(JavaScriptCore_SCRIPTS_DIR)/lazywriter.py \
80 #
81
82 JavaScriptCore_BUILTINS_SOURCES = \
83     $(JavaScriptCore)/builtins/ArrayConstructor.js \
84     $(JavaScriptCore)/builtins/ArrayIteratorPrototype.js \
85     $(JavaScriptCore)/builtins/ArrayPrototype.js \
86     $(JavaScriptCore)/builtins/FunctionPrototype.js \
87     $(JavaScriptCore)/builtins/GeneratorPrototype.js \
88     $(JavaScriptCore)/builtins/GlobalObject.js \
89     $(JavaScriptCore)/builtins/InspectorInstrumentationObject.js \
90     $(JavaScriptCore)/builtins/InternalPromiseConstructor.js \
91     $(JavaScriptCore)/builtins/IteratorPrototype.js \
92     $(JavaScriptCore)/builtins/ModuleLoaderObject.js \
93     $(JavaScriptCore)/builtins/NumberPrototype.js \
94     $(JavaScriptCore)/builtins/ObjectConstructor.js \
95     $(JavaScriptCore)/builtins/PromiseConstructor.js \
96     $(JavaScriptCore)/builtins/PromiseOperations.js \
97     $(JavaScriptCore)/builtins/PromisePrototype.js \
98     $(JavaScriptCore)/builtins/ReflectObject.js \
99     $(JavaScriptCore)/builtins/StringConstructor.js \
100     $(JavaScriptCore)/builtins/StringIteratorPrototype.js \
101     $(JavaScriptCore)/builtins/TypedArrayConstructor.js \
102     $(JavaScriptCore)/builtins/TypedArrayPrototype.js \
103 #
104
105 # The combined output file depends on the contents of builtins and generator scripts, so
106 # adding, modifying, or removing builtins or scripts will trigger regeneration of files.
107
108 .PHONY: force
109 JavaScriptCore_BUILTINS_DEPENDENCIES_LIST : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py force
110         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(JavaScriptCore_BUILTINS_SOURCES) $(BUILTINS_GENERATOR_SCRIPTS)' $@
111
112 JSCBuiltins.h: $(BUILTINS_GENERATOR_SCRIPTS) $(JavaScriptCore_BUILTINS_SOURCES) JavaScriptCore_BUILTINS_DEPENDENCIES_LIST
113         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-js-builtins.py --combined --output-directory . --framework JavaScriptCore $(JavaScriptCore_BUILTINS_SOURCES)
114
115 # Perfect hash lookup tables for JavaScript classes.
116
117 OBJECT_LUT_HEADERS = \
118     ArrayConstructor.lut.h \
119     ArrayIteratorPrototype.lut.h \
120     BooleanPrototype.lut.h \
121     DateConstructor.lut.h \
122     DatePrototype.lut.h \
123     ErrorPrototype.lut.h \
124     GeneratorPrototype.lut.h \
125     InspectorInstrumentationObject.lut.h \
126     IntlCollatorConstructor.lut.h \
127     IntlCollatorPrototype.lut.h \
128     IntlDateTimeFormatConstructor.lut.h \
129     IntlDateTimeFormatPrototype.lut.h \
130     IntlNumberFormatConstructor.lut.h \
131     IntlNumberFormatPrototype.lut.h \
132     JSDataViewPrototype.lut.h \
133     JSGlobalObject.lut.h \
134     JSInternalPromiseConstructor.lut.h \
135     JSONObject.lut.h \
136     JSPromisePrototype.lut.h \
137     JSPromiseConstructor.lut.h \
138     ModuleLoaderObject.lut.h \
139     NumberConstructor.lut.h \
140     NumberPrototype.lut.h \
141     ObjectConstructor.lut.h \
142     ReflectObject.lut.h \
143     RegExpConstructor.lut.h \
144     RegExpPrototype.lut.h \
145     StringConstructor.lut.h \
146     StringIteratorPrototype.lut.h \
147     SymbolConstructor.lut.h \
148     SymbolPrototype.lut.h \
149 #
150
151 $(OBJECT_LUT_HEADERS): %.lut.h : %.cpp $(JavaScriptCore)/create_hash_table
152         $(PERL) $(JavaScriptCore)/create_hash_table $< > $@
153
154 Lexer.lut.h: Keywords.table $(JavaScriptCore)/create_hash_table
155         $(PERL) $(JavaScriptCore)/create_hash_table $< > $@
156
157 # character tables for Yarr
158
159 RegExpJitTables.h: create_regex_tables
160         $(PYTHON) $^ > $@
161
162 KeywordLookup.h: KeywordLookupGenerator.py Keywords.table
163         $(PYTHON) $^ > $@
164
165 # udis86 instruction tables
166
167 udis86_itab.h: $(JavaScriptCore)/disassembler/udis86/itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml
168         $(PYTHON) $(JavaScriptCore)/disassembler/udis86/itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml
169
170 # Bytecode files
171
172 Bytecodes.h: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
173         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --bytecodes_h Bytecodes.h $(JavaScriptCore)/bytecode/BytecodeList.json
174
175 InitBytecodes.asm: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
176         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --init_bytecodes_asm InitBytecodes.asm $(JavaScriptCore)/bytecode/BytecodeList.json
177
178 # Inspector interfaces
179
180 INSPECTOR_DOMAINS = \
181     $(JavaScriptCore)/inspector/protocol/ApplicationCache.json \
182     $(JavaScriptCore)/inspector/protocol/CSS.json \
183     $(JavaScriptCore)/inspector/protocol/Console.json \
184     $(JavaScriptCore)/inspector/protocol/DOM.json \
185     $(JavaScriptCore)/inspector/protocol/DOMDebugger.json \
186     $(JavaScriptCore)/inspector/protocol/DOMStorage.json \
187     $(JavaScriptCore)/inspector/protocol/Database.json \
188     $(JavaScriptCore)/inspector/protocol/Debugger.json \
189     $(JavaScriptCore)/inspector/protocol/GenericTypes.json \
190     $(JavaScriptCore)/inspector/protocol/Heap.json \
191     $(JavaScriptCore)/inspector/protocol/Inspector.json \
192     $(JavaScriptCore)/inspector/protocol/LayerTree.json \
193     $(JavaScriptCore)/inspector/protocol/Network.json \
194     $(JavaScriptCore)/inspector/protocol/OverlayTypes.json \
195     $(JavaScriptCore)/inspector/protocol/Page.json \
196     $(JavaScriptCore)/inspector/protocol/Runtime.json \
197     $(JavaScriptCore)/inspector/protocol/ScriptProfiler.json \
198     $(JavaScriptCore)/inspector/protocol/Timeline.json \
199 #
200
201 ifeq ($(findstring ENABLE_INDEXED_DATABASE,$(FEATURE_DEFINES)), ENABLE_INDEXED_DATABASE)
202     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/IndexedDB.json
203 endif
204
205 ifeq ($(findstring ENABLE_WEB_REPLAY,$(FEATURE_DEFINES)), ENABLE_WEB_REPLAY)
206     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/Replay.json
207 endif
208
209 INSPECTOR_GENERATOR_SCRIPTS = \
210         $(JavaScriptCore)/inspector/scripts/codegen/__init__.py \
211         $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator_templates.py \
212         $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator.py \
213         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py \
214         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py \
215         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py \
216         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py \
217         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_protocol_types_header.py \
218         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py \
219         $(JavaScriptCore)/inspector/scripts/codegen/generate_js_backend_commands.py \
220         $(JavaScriptCore)/inspector/scripts/codegen/generator_templates.py \
221         $(JavaScriptCore)/inspector/scripts/codegen/generator.py \
222         $(JavaScriptCore)/inspector/scripts/codegen/models.py \
223         $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py \
224         $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py \
225 #
226
227 # The combined JSON file depends on the actual set of domains and their file contents, so that
228 # adding, modifying, or removing domains will trigger regeneration of inspector files.
229
230 .PHONY: force
231 EnabledInspectorDomains : $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py force
232         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/UpdateContents.py '$(INSPECTOR_DOMAINS)' $@
233
234 CombinedDomains.json : $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) EnabledInspectorDomains
235         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./CombinedDomains.json
236
237 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
238 InspectorFrontendDispatchers.h : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS)
239         $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py --framework JavaScriptCore --outputDir . ./CombinedDomains.json
240
241 InjectedScriptSource.h : inspector/InjectedScriptSource.js $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl
242         echo "//# sourceURL=__WebInspectorInjectedScript__" > ./InjectedScriptSource.min.js
243         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py < $(JavaScriptCore)/inspector/InjectedScriptSource.js >> ./InjectedScriptSource.min.js
244         $(PERL) $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl InjectedScriptSource_js ./InjectedScriptSource.min.js InjectedScriptSource.h
245         $(DELETE) InjectedScriptSource.min.js
246
247 # Web Replay inputs generator
248
249 INPUT_GENERATOR_SCRIPTS = \
250     $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py \
251     $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputsTemplates.py \
252 #
253
254 INPUT_GENERATOR_SPECIFICATIONS = \
255     $(JavaScriptCore)/replay/JSInputs.json \
256 #
257
258 JSReplayInputs.h : $(INPUT_GENERATOR_SPECIFICATIONS) $(INPUT_GENERATOR_SCRIPTS)
259         $(PYTHON) $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py --outputDir . --framework JavaScriptCore $(INPUT_GENERATOR_SPECIFICATIONS)
260
261 AirOpcode.h: $(JavaScriptCore)/b3/air/opcode_generator.rb $(JavaScriptCore)/b3/air/AirOpcode.opcodes
262         $(RUBY) $^
263
264 # Dynamically-defined targets are listed below. Static targets belong up top.
265
266 all : \
267     $(OBJECT_LUT_HEADERS) \
268 #