Use more C++17
[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/Cookies \
27     $(WebKit2)/NetworkProcess/cache \
28     $(WebKit2)/NetworkProcess/CustomProtocols \
29     $(WebKit2)/NetworkProcess/mac \
30     $(WebKit2)/NetworkProcess/webrtc \
31     $(WebKit2)/PluginProcess \
32     $(WebKit2)/PluginProcess/mac \
33     $(WebKit2)/Shared/Plugins \
34     $(WebKit2)/Shared \
35     $(WebKit2)/Shared/API/Cocoa \
36     $(WebKit2)/Shared/Authentication \
37     $(WebKit2)/Shared/mac \
38     $(WebKit2)/StorageProcess \
39     $(WebKit2)/StorageProcess/IndexedDB \
40     $(WebKit2)/StorageProcess/ServiceWorker \
41     $(WebKit2)/StorageProcess/mac \
42     $(WebKit2)/WebProcess/ApplePay \
43     $(WebKit2)/WebProcess/ApplicationCache \
44     $(WebKit2)/WebProcess/Automation \
45     $(WebKit2)/WebProcess/Cache \
46     $(WebKit2)/WebProcess/CredentialManagement \
47     $(WebKit2)/WebProcess/Databases/IndexedDB \
48     $(WebKit2)/WebProcess/FullScreen \
49     $(WebKit2)/WebProcess/Geolocation \
50     $(WebKit2)/WebProcess/IconDatabase \
51     $(WebKit2)/WebProcess/MediaCache \
52     $(WebKit2)/WebProcess/MediaStream \
53     $(WebKit2)/WebProcess/Network \
54     $(WebKit2)/WebProcess/Network/webrtc \
55     $(WebKit2)/WebProcess/Notifications \
56     $(WebKit2)/WebProcess/OriginData \
57     $(WebKit2)/WebProcess/Plugins \
58     $(WebKit2)/WebProcess/ResourceCache \
59     $(WebKit2)/WebProcess/Storage \
60     $(WebKit2)/WebProcess/UserContent \
61     $(WebKit2)/WebProcess/WebCoreSupport \
62     $(WebKit2)/WebProcess/WebPage \
63     $(WebKit2)/WebProcess/WebPage/RemoteLayerTree \
64     $(WebKit2)/WebProcess/WebStorage \
65     $(WebKit2)/WebProcess/cocoa \
66     $(WebKit2)/WebProcess/ios \
67     $(WebKit2)/WebProcess \
68     $(WebKit2)/UIProcess \
69     $(WebKit2)/UIProcess/ApplePay \
70     $(WebKit2)/UIProcess/Automation \
71     $(WebKit2)/UIProcess/Cocoa \
72     $(WebKit2)/UIProcess/CredentialManagement \
73     $(WebKit2)/UIProcess/Databases \
74     $(WebKit2)/UIProcess/Downloads \
75     $(WebKit2)/UIProcess/MediaStream \
76     $(WebKit2)/UIProcess/Network \
77     $(WebKit2)/UIProcess/Network/CustomProtocols \
78     $(WebKit2)/UIProcess/Notifications \
79     $(WebKit2)/UIProcess/Plugins \
80     $(WebKit2)/UIProcess/RemoteLayerTree \
81     $(WebKit2)/UIProcess/Storage \
82     $(WebKit2)/UIProcess/UserContent \
83     $(WebKit2)/UIProcess/WebStorage \
84     $(WebKit2)/UIProcess/mac \
85     $(WebKit2)/UIProcess/ios \
86     $(WEBKITADDITIONS_HEADER_SEARCH_PATHS) \
87 #
88
89 PYTHON = python
90 PERL = perl
91
92 ifeq ($(OS),Windows_NT)
93     DELETE = cmd //C del
94 else
95     DELETE = rm -f
96 endif
97
98 MESSAGE_RECEIVERS = \
99     AuthenticationManager \
100     CacheStorageEngineConnection \
101     ChildProcess \
102     DownloadProxy \
103     DrawingArea \
104     DrawingAreaProxy \
105     EventDispatcher \
106     LegacyCustomProtocolManager \
107     LegacyCustomProtocolManagerProxy \
108     NPObjectMessageReceiver \
109     NetworkConnectionToWebProcess \
110     NetworkMDNSRegister\
111     NetworkProcess \
112     NetworkProcessConnection \
113     NetworkProcessProxy \
114     NetworkRTCMonitor \
115     NetworkRTCProvider \
116     NetworkRTCSocket \
117     NetworkResourceLoader \
118     NetworkSocketStream \
119     NetworkContentRuleListManager \
120     PluginControllerProxy \
121     PluginProcess \
122     PluginProcessConnection \
123     PluginProcessConnectionManager \
124     PluginProcessProxy \
125     PluginProxy \
126     RemoteLayerTreeDrawingAreaProxy \
127     RemoteObjectRegistry \
128     RemoteScrollingCoordinator \
129     RemoteWebInspectorProxy \
130     RemoteWebInspectorUI \
131     SecItemShimProxy \
132     ServiceWorkerClientFetch \
133     SmartMagnificationController \
134     StorageAreaMap \
135     StorageManager \
136     StorageProcess \
137     StorageProcessProxy \
138     StorageToWebProcessConnection \
139     UserMediaCaptureManager \
140     UserMediaCaptureManagerProxy \
141     ViewGestureController \
142     ViewGestureGeometryCollector \
143     ViewUpdateDispatcher \
144     VisitedLinkStore \
145     VisitedLinkTableController \
146     WebAutomationSession \
147     WebAutomationSessionProxy \
148     WebCacheStorageConnection \
149     WebConnection \
150     WebCookieManager \
151     WebCookieManagerProxy \
152     WebCredentialsMessenger \
153     WebCredentialsMessengerProxy \
154     WebFullScreenManager \
155     WebFullScreenManagerProxy \
156     WebGeolocationManager \
157     WebGeolocationManagerProxy \
158     WebIDBConnectionToClient \
159     WebIDBConnectionToServer \
160     WebInspector \
161     WebInspectorInterruptDispatcher \
162     WebInspectorProxy \
163     WebInspectorUI \
164     WebMDNSRegister\
165     WebNotificationManager \
166     WebPage \
167     WebPageProxy \
168     WebPasteboardProxy \
169     WebPaymentCoordinator \
170     WebPaymentCoordinatorProxy \
171     WebSWClientConnection \
172     WebSWContextManagerConnection \
173     WebSWServerConnection \
174     WebSWServerToContextConnection \
175     PlaybackSessionManager \
176     PlaybackSessionManagerProxy \
177     WebProcess \
178     WebProcessConnection \
179     WebProcessPool \
180     WebProcessProxy \
181     WebRTCMonitor \
182     WebRTCResolver \
183     WebRTCSocket \
184     WebResourceLoader \
185     WebResourceLoadStatisticsStore \
186     WebSocketStream \
187     WebUserContentController \
188     WebUserContentControllerProxy \
189     VideoFullscreenManager \
190     VideoFullscreenManagerProxy \
191 #
192
193 SCRIPTS = \
194     $(WebKit2)/Scripts/generate-message-receiver.py \
195     $(WebKit2)/Scripts/generate-messages-header.py \
196     $(WebKit2)/Scripts/webkit/__init__.py \
197     $(WebKit2)/Scripts/webkit/messages.py \
198     $(WebKit2)/Scripts/webkit/model.py \
199     $(WebKit2)/Scripts/webkit/parser.py \
200 #
201
202 FRAMEWORK_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(FRAMEWORK_SEARCH_PATHS) $(SYSTEM_FRAMEWORK_SEARCH_PATHS) | perl -e 'print "-F " . join(" -F ", split(" ", <>));')
203 HEADER_FLAGS = $(shell echo $(BUILT_PRODUCTS_DIR) $(HEADER_SEARCH_PATHS) $(SYSTEM_HEADER_SEARCH_PATHS) | perl -e 'print "-I" . join(" -I", split(" ", <>));')
204
205 -include WebKitDerivedSourcesAdditions.make
206
207 .PHONY : all
208
209 all : \
210     $(MESSAGE_RECEIVERS:%=%MessageReceiver.cpp) \
211     $(MESSAGE_RECEIVERS:%=%Messages.h) \
212 #
213
214 %MessageReceiver.cpp : %.messages.in $(SCRIPTS)
215         @echo Generating messages header for $*...
216         @python $(WebKit2)/Scripts/generate-message-receiver.py $< > $@
217
218 %Messages.h : %.messages.in $(SCRIPTS)
219         @echo Generating message receiver for $*...
220         @python $(WebKit2)/Scripts/generate-messages-header.py $< > $@
221
222 TEXT_PREPROCESSOR_FLAGS=-E -P -w
223
224 ifneq ($(SDKROOT),)
225         SDK_FLAGS=-isysroot $(SDKROOT)
226 endif
227
228 ifeq ($(USE_LLVM_TARGET_TRIPLES_FOR_CLANG),YES)
229         TARGET_TRIPLE_FLAGS=-target $(CURRENT_ARCH)-$(LLVM_TARGET_TRIPLE_VENDOR)-$(LLVM_TARGET_TRIPLE_OS_VERSION)$(LLVM_TARGET_TRIPLE_SUFFIX)
230 endif
231
232 SANDBOX_PROFILES = \
233         com.apple.WebProcess.sb \
234         com.apple.WebKit.Storage.sb \
235         com.apple.WebKit.plugin-common.sb \
236         com.apple.WebKit.NetworkProcess.sb
237
238 all: $(SANDBOX_PROFILES)
239
240 %.sb : %.sb.in
241         @echo Pre-processing $* sandbox profile...
242         grep -o '^[^;]*' $< | $(CC) $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(TEXT_PREPROCESSOR_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" - > $@
243
244 AUTOMATION_PROTOCOL_GENERATOR_SCRIPTS = \
245         $(JavaScriptCore_SCRIPTS_DIR)/cpp_generator_templates.py \
246         $(JavaScriptCore_SCRIPTS_DIR)/cpp_generator.py \
247         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_backend_dispatcher_header.py \
248         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_backend_dispatcher_implementation.py \
249         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_frontend_dispatcher_header.py \
250         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_frontend_dispatcher_implementation.py \
251         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_protocol_types_header.py \
252         $(JavaScriptCore_SCRIPTS_DIR)/generate_cpp_protocol_types_implementation.py \
253         $(JavaScriptCore_SCRIPTS_DIR)/generator_templates.py \
254         $(JavaScriptCore_SCRIPTS_DIR)/generator.py \
255         $(JavaScriptCore_SCRIPTS_DIR)/models.py \
256         $(JavaScriptCore_SCRIPTS_DIR)/generate-inspector-protocol-bindings.py \
257 #
258
259 AUTOMATION_PROTOCOL_INPUT_FILES = \
260     $(WebKit2)/UIProcess/Automation/Automation.json \
261 #
262
263 AUTOMATION_PROTOCOL_OUTPUT_FILES = \
264     AutomationBackendDispatchers.h \
265     AutomationBackendDispatchers.cpp \
266     AutomationFrontendDispatchers.h \
267     AutomationFrontendDispatchers.cpp \
268 #
269
270 ifeq ($(OS),MACOS)
271 ifeq ($(shell $(CC) -std=gnu++1z -x c++ -E -P -dM $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) -include "wtf/Platform.h" /dev/null | grep ' WTF_PLATFORM_IOS ' | cut -d' ' -f3), 1)
272         AUTOMATION_BACKEND_PLATFORM_ARGUMENTS = --platform iOS
273 else
274         AUTOMATION_BACKEND_PLATFORM_ARGUMENTS = --platform macOS
275 endif
276 endif # MACOS
277
278 # JSON-RPC Frontend Dispatchers, Backend Dispatchers, Type Builders
279 $(firstword $(AUTOMATION_PROTOCOL_OUTPUT_FILES)) : $(AUTOMATION_PROTOCOL_INPUT_FILES) $(AUTOMATION_PROTOCOL_GENERATOR_SCRIPTS)
280         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/generate-inspector-protocol-bindings.py --framework WebKit $(AUTOMATION_BACKEND_PLATFORM_ARGUMENTS) --backend --outputDir . $(AUTOMATION_PROTOCOL_INPUT_FILES)
281
282 all : $(firstword $(AUTOMATION_PROTOCOL_OUTPUT_FILES))
283
284 %ScriptSource.h : %.js $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl
285         echo "//# sourceURL=__InjectedScript_$(notdir $<)" > $(basename $(notdir $<)).min.js
286         $(PYTHON) $(JavaScriptCore_SCRIPTS_DIR)/jsmin.py < $< >> $(basename $(notdir $<)).min.js
287         $(PERL) $(JavaScriptCore_SCRIPTS_DIR)/xxd.pl $(basename $(notdir $<))ScriptSource $(basename $(notdir $<)).min.js $@
288         $(DELETE) $(basename $(notdir $<)).min.js
289
290 all : WebAutomationSessionProxyScriptSource.h
291
292 # WebPreferences generation
293
294 WEB_PREFERENCES_TEMPLATES = \
295     $(WebKit2)/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb \
296     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb \
297     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb \
298     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb \
299     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb \
300     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb \
301
302 #
303
304 all : WebPageUpdatePreferences.cpp WebPreferencesDefinitions.h WebPreferencesExperimentalFeatures.cpp WebPreferencesKeys.h WebPreferencesKeys.cpp WebPreferencesStoreDefaultsMap.cpp
305
306 WebPageUpdatePreferences%cpp WebPreferencesDefinitions%h WebPreferencesExperimentalFeatures%cpp WebPreferencesKeys%h WebPreferencesKeys%cpp WebPreferencesStoreDefaultsMap%cpp : $(WebKit2)/Scripts/GeneratePreferences.rb $(WEB_PREFERENCES_TEMPLATES) $(WebKit2)/Shared/WebPreferences.yaml
307         $(RUBY) $< --input $(WebKit2)/Shared/WebPreferences.yaml
308