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