Bring back SWContextManager abstraction in WebCore
[WebKit-https.git] / Source / WebKit / DerivedSources.make
1 # Copyright (C) 2010-2017 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 # 1.  Redistributions of source code must retain the above copyright
7 #     notice, this list of conditions and the following disclaimer.
8 # 2.  Redistributions in binary form must reproduce the above copyright
9 #     notice, this list of conditions and the following disclaimer in the
10 #     documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
13 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
16 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
21 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23 VPATH = \
24     $(WebKit2) \
25     $(WebKit2)/NetworkProcess \
26     $(WebKit2)/NetworkProcess/cache \
27     $(WebKit2)/NetworkProcess/CustomProtocols \
28     $(WebKit2)/NetworkProcess/mac \
29     $(WebKit2)/NetworkProcess/webrtc \
30     $(WebKit2)/PluginProcess \
31     $(WebKit2)/PluginProcess/mac \
32     $(WebKit2)/Shared/Plugins \
33     $(WebKit2)/Shared \
34     $(WebKit2)/Shared/API/Cocoa \
35     $(WebKit2)/Shared/Authentication \
36     $(WebKit2)/Shared/mac \
37     $(WebKit2)/StorageProcess \
38     $(WebKit2)/StorageProcess/IndexedDB \
39     $(WebKit2)/StorageProcess/ServiceWorker \
40     $(WebKit2)/StorageProcess/mac \
41     $(WebKit2)/WebProcess/ApplePay \
42     $(WebKit2)/WebProcess/ApplicationCache \
43     $(WebKit2)/WebProcess/Automation \
44     $(WebKit2)/WebProcess/Cache \
45     $(WebKit2)/WebProcess/Cookies \
46     $(WebKit2)/WebProcess/Databases/IndexedDB \
47     $(WebKit2)/WebProcess/FullScreen \
48     $(WebKit2)/WebProcess/Geolocation \
49     $(WebKit2)/WebProcess/IconDatabase \
50     $(WebKit2)/WebProcess/MediaCache \
51     $(WebKit2)/WebProcess/MediaStream \
52     $(WebKit2)/WebProcess/Network \
53     $(WebKit2)/WebProcess/Network/webrtc \
54     $(WebKit2)/WebProcess/Notifications \
55     $(WebKit2)/WebProcess/OriginData \
56     $(WebKit2)/WebProcess/Plugins \
57     $(WebKit2)/WebProcess/ResourceCache \
58     $(WebKit2)/WebProcess/Storage \
59     $(WebKit2)/WebProcess/UserContent \
60     $(WebKit2)/WebProcess/WebCoreSupport \
61     $(WebKit2)/WebProcess/WebPage \
62     $(WebKit2)/WebProcess/WebPage/RemoteLayerTree \
63     $(WebKit2)/WebProcess/WebStorage \
64     $(WebKit2)/WebProcess/cocoa \
65     $(WebKit2)/WebProcess/ios \
66     $(WebKit2)/WebProcess \
67     $(WebKit2)/UIProcess \
68     $(WebKit2)/UIProcess/ApplePay \
69     $(WebKit2)/UIProcess/Automation \
70     $(WebKit2)/UIProcess/Cocoa \
71     $(WebKit2)/UIProcess/Databases \
72     $(WebKit2)/UIProcess/Downloads \
73     $(WebKit2)/UIProcess/MediaStream \
74     $(WebKit2)/UIProcess/Network \
75     $(WebKit2)/UIProcess/Network/CustomProtocols \
76     $(WebKit2)/UIProcess/Notifications \
77     $(WebKit2)/UIProcess/Plugins \
78     $(WebKit2)/UIProcess/RemoteLayerTree \
79     $(WebKit2)/UIProcess/Storage \
80     $(WebKit2)/UIProcess/UserContent \
81     $(WebKit2)/UIProcess/WebStorage \
82     $(WebKit2)/UIProcess/mac \
83     $(WebKit2)/UIProcess/ios \
84     $(WEBKITADDITIONS_HEADER_SEARCH_PATHS) \
85 #
86
87 PYTHON = python
88 PERL = perl
89
90 ifeq ($(OS),Windows_NT)
91     DELETE = cmd //C del
92 else
93     DELETE = rm -f
94 endif
95
96 MESSAGE_RECEIVERS = \
97     AuthenticationManager \
98     CacheStorageEngineConnection \
99     ChildProcess \
100     DownloadProxy \
101     DrawingArea \
102     DrawingAreaProxy \
103     EventDispatcher \
104     LegacyCustomProtocolManager \
105     LegacyCustomProtocolManagerProxy \
106     NPObjectMessageReceiver \
107     NetworkConnectionToWebProcess \
108     NetworkProcess \
109     NetworkProcessConnection \
110     NetworkProcessProxy \
111     NetworkRTCMonitor \
112     NetworkRTCProvider \
113     NetworkRTCSocket \
114     NetworkResourceLoader \
115     NetworkSocketStream \
116     PluginControllerProxy \
117     PluginProcess \
118     PluginProcessConnection \
119     PluginProcessConnectionManager \
120     PluginProcessProxy \
121     PluginProxy \
122     RemoteLayerTreeDrawingAreaProxy \
123     RemoteObjectRegistry \
124     RemoteScrollingCoordinator \
125     RemoteWebInspectorProxy \
126     RemoteWebInspectorUI \
127     SecItemShimProxy \
128     ServiceWorkerClientFetch \
129     SmartMagnificationController \
130     StorageAreaMap \
131     StorageManager \
132     StorageProcess \
133     StorageProcessProxy \
134     StorageToWebProcessConnection \
135     UserMediaCaptureManager \
136     UserMediaCaptureManagerProxy \
137     ViewGestureController \
138     ViewGestureGeometryCollector \
139     ViewUpdateDispatcher \
140     VisitedLinkStore \
141     VisitedLinkTableController \
142     WebAutomationSession \
143     WebAutomationSessionProxy \
144     WebCacheStorageConnection \
145     WebConnection \
146     WebCookieManager \
147     WebCookieManagerProxy \
148     WebFullScreenManager \
149     WebFullScreenManagerProxy \
150     WebGeolocationManager \
151     WebGeolocationManagerProxy \
152     WebIDBConnectionToClient \
153     WebIDBConnectionToServer \
154     WebInspector \
155     WebInspectorInterruptDispatcher \
156     WebInspectorProxy \
157     WebInspectorUI \
158     WebNotificationManager \
159     WebPage \
160     WebPageProxy \
161     WebPasteboardProxy \
162     WebPaymentCoordinator \
163     WebPaymentCoordinatorProxy \
164     WebSWClientConnection \
165     WebSWContextManagerConnection \
166     WebSWServerConnection \
167     PlaybackSessionManager \
168     PlaybackSessionManagerProxy \
169     WebProcess \
170     WebProcessConnection \
171     WebProcessPool \
172     WebProcessProxy \
173     WebRTCMonitor \
174     WebRTCResolver \
175     WebRTCSocket \
176     WebResourceLoader \
177     WebResourceLoadStatisticsStore \
178     WebSocketStream \
179     WebUserContentController \
180     WebUserContentControllerProxy \
181     VideoFullscreenManager \
182     VideoFullscreenManagerProxy \
183 #
184
185 SCRIPTS = \
186     $(WebKit2)/Scripts/generate-message-receiver.py \
187     $(WebKit2)/Scripts/generate-messages-header.py \
188     $(WebKit2)/Scripts/webkit/__init__.py \
189     $(WebKit2)/Scripts/webkit/messages.py \
190     $(WebKit2)/Scripts/webkit/model.py \
191     $(WebKit2)/Scripts/webkit/parser.py \
192 #
193
194 FRAMEWORK_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", <>));')
195 HEADER_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(HEADER_SEARCH_PATHS) | perl -e 'print "-I" . join(" -I", split(" ", <>));')
196
197 -include WebKitDerivedSourcesAdditions.make
198
199 .PHONY : all
200
201 all : \
202     $(MESSAGE_RECEIVERS:%=%MessageReceiver.cpp) \
203     $(MESSAGE_RECEIVERS:%=%Messages.h) \
204 #
205
206 %MessageReceiver.cpp : %.messages.in $(SCRIPTS)
207         @echo Generating messages header for $*...
208         @python $(WebKit2)/Scripts/generate-message-receiver.py $< > $@
209
210 %Messages.h : %.messages.in $(SCRIPTS)
211         @echo Generating message receiver for $*...
212         @python $(WebKit2)/Scripts/generate-messages-header.py $< > $@
213
214
215 # Some versions of clang incorrectly strip out // comments in c89 code.
216 # Use -traditional as a workaround, but only when needed since that causes
217 # other problems with later versions of clang.
218 ifeq ($(shell echo '//x' | $(CC) -E -P -x c -std=c89 - | grep x),)
219 TEXT_PREPROCESSOR_FLAGS=-E -P -x c -traditional -w
220 else
221 TEXT_PREPROCESSOR_FLAGS=-E -P -x c -std=c89 -w
222 endif
223
224 ifneq ($(SDKROOT),)
225         SDK_FLAGS=-isysroot $(SDKROOT)
226 endif
227
228 SANDBOX_PROFILES = \
229         com.apple.WebProcess.sb \
230         com.apple.WebKit.Databases.sb \
231         com.apple.WebKit.plugin-common.sb \
232         com.apple.WebKit.NetworkProcess.sb
233
234 all: $(SANDBOX_PROFILES)
235
236 %.sb : %.sb.in
237         @echo Pre-processing $* sandbox profile...
238         $(CC) $(SDK_FLAGS) $(TEXT_PREPROCESSOR_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" $< > $@
239
240 AUTOMATION_PROTOCOL_GENERATOR_SCRIPTS = \
241         $(JavaScriptCore_SCRIPTS_DIR)/cpp_generator_templates.py \
242         $(JavaScriptCore_SCRIPTS_DIR)/cpp_generator.py \
243         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_backend_dispatcher_header.py \
244         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_backend_dispatcher_implementation.py \
245         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_frontend_dispatcher_header.py \
246         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_frontend_dispatcher_implementation.py \
247         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_protocol_types_header.py \
248         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_protocol_types_implementation.py \
249         $(JavaScriptCore_SCRIPTS_DIR)/generator_templates.py \
250         $(JavaScriptCore_SCRIPTS_DIR)/generator.py \
251         $(JavaScriptCore_SCRIPTS_DIR)/models.py \
252         $(JavaScriptCore_SCRIPTS_DIR)/generate-inspector-protocol-bindings.py \
253 #
254
255 AUTOMATION_PROTOCOL_INPUT_FILES = \
256     $(WebKit2)/UIProcess/Automation/Automation.json \
257 #
258
259 AUTOMATION_PROTOCOL_OUTPUT_FILES = \
260     AutomationBackendDispatchers.h \
261     AutomationBackendDispatchers.cpp \
262     AutomationFrontendDispatchers.h \
263     AutomationFrontendDispatchers.cpp \
264 #
265
266 ifeq ($(OS),MACOS)
267 ifeq ($(shell $(CC) -std=gnu++14 -x c++ -E -P -dM $(SDK_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS ' | cut -d' ' -f3), 1)
268         AUTOMATION_BACKEND_PLATFORM_ARGUMENTS = --platform iOS
269 else
270         AUTOMATION_BACKEND_PLATFORM_ARGUMENTS = --platform macOS
271 endif
272 endif # MACOS
273
274 # JSON-RPC Frontend Dispatchers, Backend Dispatchers, Type Builders
275 $(firstword $(AUTOMATION_PROTOCOL_OUTPUT_FILES)) : $(AUTOMATION_PROTOCOL_INPUT_FILES) $(AUTOMATION_PROTOCOL_GENERATOR_SCRIPTS)
276         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-inspector-protocol-bindings.py --framework WebKit $(AUTOMATION_BACKEND_PLATFORM_ARGUMENTS) --backend --outputDir . $(AUTOMATION_PROTOCOL_INPUT_FILES)
277
278 all : $(firstword $(AUTOMATION_PROTOCOL_OUTPUT_FILES))
279
280 %ScriptSource.h : %.js $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl
281         echo "//# sourceURL=__InjectedScript_$(notdir $<)" > $(basename $(notdir $<)).min.js
282         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py < $< >> $(basename $(notdir $<)).min.js
283         $(PERL) $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl $(basename $(notdir $<))ScriptSource $(basename $(notdir $<)).min.js $@
284         $(DELETE) $(basename $(notdir $<)).min.js
285
286 all : WebAutomationSessionProxyScriptSource.h
287
288 # WebPreferences generation
289
290 WEB_PREFERENCES_TEMPLATES = \
291     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb \
292 #
293
294 all : WebPreferencesDefinitions.h
295
296 WebPreferencesDefinitions%h : $(WebKit2)/Scripts/GeneratePreferences.rb $(WEB_PREFERENCES_TEMPLATES) $(WebKit2)/Shared/WebPreferences.yaml
297         $(RUBY) $< --input $(WebKit2)/Shared/WebPreferences.yaml
298