677f4cee693560459e80787a608656822a5f475a
[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 .PHONY : all
37 all : \
38     ArrayConstructor.lut.h \
39     ArrayIteratorPrototype.lut.h \
40     BooleanPrototype.lut.h \
41     DateConstructor.lut.h \
42     DatePrototype.lut.h \
43     ErrorPrototype.lut.h \
44     JSDataViewPrototype.lut.h \
45     JSONObject.lut.h \
46     JSGlobalObject.lut.h \
47     JSPromisePrototype.lut.h \
48     JSPromiseConstructor.lut.h \
49     KeywordLookup.h \
50     Lexer.lut.h \
51     NumberConstructor.lut.h \
52     NumberPrototype.lut.h \
53     ObjectConstructor.lut.h \
54     RegExpConstructor.lut.h \
55     RegExpPrototype.lut.h \
56     RegExpJitTables.h \
57     StringConstructor.lut.h \
58     StringIteratorPrototype.lut.h \
59     SymbolConstructor.lut.h \
60     SymbolPrototype.lut.h \
61     udis86_itab.h \
62     Bytecodes.h \
63     InitBytecodes.asm \
64     JSCBuiltins \
65 #
66
67 # builtin functions
68 .PHONY: JSCBuiltins
69
70 PYTHON = python
71 PERL = perl
72
73 ifeq ($(OS),Windows_NT)
74     DELETE = cmd //C del
75 else
76     DELETE = rm -f
77 endif
78 # --------
79
80 JSCBuiltins: $(JavaScriptCore)/generate-js-builtins JSCBuiltins.h JSCBuiltins.cpp
81 JSCBuiltins.h: $(JavaScriptCore)/generate-js-builtins $(JavaScriptCore)/builtins
82         $(PYTHON) $(JavaScriptCore)/generate-js-builtins --input-directory $(JavaScriptCore)/builtins --output $@
83                                                                                                                                                                  
84 JSCBuiltins.cpp: JSCBuiltins.h
85
86 # lookup tables for classes
87
88 %.lut.h: create_hash_table %.cpp
89         $(PERL) $^ -i > $@
90 Lexer.lut.h: create_hash_table Keywords.table
91         $(PERL) $^ > $@
92
93 # character tables for Yarr
94
95 RegExpJitTables.h: create_regex_tables
96         $(PYTHON) $^ > $@
97
98 KeywordLookup.h: KeywordLookupGenerator.py Keywords.table
99         $(PYTHON) $^ > $@
100
101 # udis86 instruction tables
102
103 udis86_itab.h: $(JavaScriptCore)/disassembler/udis86/itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml
104         $(PYTHON) $(JavaScriptCore)/disassembler/udis86/itab.py $(JavaScriptCore)/disassembler/udis86/optable.xml
105
106 # Bytecode files
107
108 Bytecodes.h: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
109         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --bytecodes_h Bytecodes.h $(JavaScriptCore)/bytecode/BytecodeList.json
110
111 InitBytecodes.asm: $(JavaScriptCore)/generate-bytecode-files $(JavaScriptCore)/bytecode/BytecodeList.json
112         $(PYTHON) $(JavaScriptCore)/generate-bytecode-files --init_bytecodes_asm InitBytecodes.asm $(JavaScriptCore)/bytecode/BytecodeList.json
113
114 # Inspector interfaces
115
116 INSPECTOR_DOMAINS = \
117     $(JavaScriptCore)/inspector/protocol/ApplicationCache.json \
118     $(JavaScriptCore)/inspector/protocol/CSS.json \
119     $(JavaScriptCore)/inspector/protocol/Console.json \
120     $(JavaScriptCore)/inspector/protocol/DOM.json \
121     $(JavaScriptCore)/inspector/protocol/DOMDebugger.json \
122     $(JavaScriptCore)/inspector/protocol/DOMStorage.json \
123     $(JavaScriptCore)/inspector/protocol/Database.json \
124     $(JavaScriptCore)/inspector/protocol/Debugger.json \
125     $(JavaScriptCore)/inspector/protocol/GenericTypes.json \
126     $(JavaScriptCore)/inspector/protocol/Inspector.json \
127     $(JavaScriptCore)/inspector/protocol/LayerTree.json \
128     $(JavaScriptCore)/inspector/protocol/Network.json \
129     $(JavaScriptCore)/inspector/protocol/OverlayTypes.json \
130     $(JavaScriptCore)/inspector/protocol/Page.json \
131     $(JavaScriptCore)/inspector/protocol/Runtime.json \
132     $(JavaScriptCore)/inspector/protocol/Timeline.json \
133     $(JavaScriptCore)/inspector/protocol/Worker.json \
134 #
135
136 ifeq ($(findstring ENABLE_INDEXED_DATABASE,$(FEATURE_DEFINES)), ENABLE_INDEXED_DATABASE)
137     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/IndexedDB.json
138 endif
139
140 ifeq ($(findstring ENABLE_WEB_REPLAY,$(FEATURE_DEFINES)), ENABLE_WEB_REPLAY)
141     INSPECTOR_DOMAINS := $(INSPECTOR_DOMAINS) $(JavaScriptCore)/inspector/protocol/Replay.json
142 endif
143
144 INSPECTOR_GENERATOR_SCRIPTS = \
145         $(JavaScriptCore)/inspector/scripts/codegen/__init__.py \
146         $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator_templates.py \
147         $(JavaScriptCore)/inspector/scripts/codegen/cpp_generator.py \
148         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py \
149         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py \
150         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py \
151         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py \
152         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_protocol_types_header.py \
153         $(JavaScriptCore)/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py \
154         $(JavaScriptCore)/inspector/scripts/codegen/generate_js_backend_commands.py \
155         $(JavaScriptCore)/inspector/scripts/codegen/generator_templates.py \
156         $(JavaScriptCore)/inspector/scripts/codegen/generator.py \
157         $(JavaScriptCore)/inspector/scripts/codegen/models.py \
158         $(JavaScriptCore)/inspector/scripts/generate-combined-inspector-json.py \
159         $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py \
160 #
161
162 all : \
163     CombinedDomains.json \
164     InspectorFrontendDispatchers.h \
165     InjectedScriptSource.h \
166 #
167
168 # The combined JSON file depends on the actual set of domains and their file contents, so that
169 # adding, modifying, or removing domains will trigger regeneration of inspector files.
170
171 .PHONY: force
172 EnabledInspectorDomains : $(JavaScriptCore)/UpdateContents.py force
173         $(PYTHON) $(JavaScriptCore)/UpdateContents.py '$(INSPECTOR_DOMAINS)' $@
174
175 CombinedDomains.json : inspector/scripts/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) EnabledInspectorDomains
176         $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-combined-inspector-json.py $(INSPECTOR_DOMAINS) > ./CombinedDomains.json
177
178 # Inspector Backend Dispatchers, Frontend Dispatchers, Type Builders
179 InspectorFrontendDispatchers.h : CombinedDomains.json $(INSPECTOR_GENERATOR_SCRIPTS)
180         $(PYTHON) $(JavaScriptCore)/inspector/scripts/generate-inspector-protocol-bindings.py --framework JavaScriptCore --outputDir . ./CombinedDomains.json
181
182 InjectedScriptSource.h : inspector/InjectedScriptSource.js $(JavaScriptCore)/inspector/scripts/jsmin.py $(JavaScriptCore)/inspector/scripts/xxd.pl
183         echo "//# sourceURL=__WebInspectorInjectedScript__" > ./InjectedScriptSource.min.js
184         $(PYTHON) $(JavaScriptCore)/inspector/scripts/jsmin.py < $(JavaScriptCore)/inspector/InjectedScriptSource.js >> ./InjectedScriptSource.min.js
185         $(PERL) $(JavaScriptCore)/inspector/scripts/xxd.pl InjectedScriptSource_js ./InjectedScriptSource.min.js InjectedScriptSource.h
186         $(DELETE) InjectedScriptSource.min.js
187
188 # Web Replay inputs generator
189
190 INPUT_GENERATOR_SCRIPTS = \
191     $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py \
192     $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputsTemplates.py \
193 #
194
195 INPUT_GENERATOR_SPECIFICATIONS = \
196     $(JavaScriptCore)/replay/JSInputs.json \
197 #
198
199 all : JSReplayInputs.h
200
201 JSReplayInputs.h : $(INPUT_GENERATOR_SPECIFICATIONS) $(INPUT_GENERATOR_SCRIPTS)
202         $(PYTHON) $(JavaScriptCore)/replay/scripts/CodeGeneratorReplayInputs.py --outputDir . --framework JavaScriptCore $(INPUT_GENERATOR_SPECIFICATIONS)