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