[macOS WK1] ASSERTION FAILED: formData in WebCore::ResourceRequest::doUpdateResourceH...
[WebKit-https.git] / Makefile.shared
1 SCRIPTS_PATH ?= ../Tools/Scripts
2
3 SET_COLOR_DIAGNOSTICS_ARG = if [[ -t 1 ]]; then COLOR_DIAGNOSTICS_ARG="COLOR_DIAGNOSTICS=YES"; fi
4 XCODE_OPTIONS = `perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print XcodeOptionString()' -- $(BUILD_WEBKIT_OPTIONS)` $${COLOR_DIAGNOSTICS_ARG} $(ARGS)
5
6 ifneq (,$(SDKROOT))
7         ifneq (,$(OVERRIDE_SDKROOT))
8                 ifneq (default,$(OVERRIDE_SDKROOT))
9                         XCODE_OPTIONS := $(XCODE_OPTIONS) SDKROOT=$(OVERRIDE_SDKROOT)
10                 endif
11                 OVERRIDE_SDKROOT =
12         else
13                 XCODE_OPTIONS := $(XCODE_OPTIONS) SDKROOT=$(SDKROOT)
14         endif
15 endif
16
17 ifneq (,$(ARCHS))
18         ifneq (,$(OVERRIDE_ARCHS))
19                 ifneq (default,$(OVERRIDE_ARCHS))
20                         XCODE_OPTIONS := $(XCODE_OPTIONS) ARCHS="$(OVERRIDE_ARCHS)"
21                         XCODE_OPTIONS += ONLY_ACTIVE_ARCH=NO
22                 endif
23                 OVERRIDE_ARCHS =
24         else
25                 XCODE_OPTIONS := $(XCODE_OPTIONS) ARCHS="$(ARCHS)"
26                 XCODE_OPTIONS += ONLY_ACTIVE_ARCH=NO
27                 # Make Plugin.32 and Plugin.64 build even when they can't be built for the specified architecture.
28                 ifeq ($(ARCHS),i386)
29                         XCODE_OPTIONS += VALID_ARCHS=i386
30                 endif
31                 ifeq ($(ARCHS),x86_64)
32                         XCODE_OPTIONS += VALID_ARCHS=x86_64
33                 endif
34         endif
35 endif
36
37 ifneq (,$(SDK_VARIANT))
38         XCODE_OPTIONS += SDK_VARIANT="$(SDK_VARIANT)"
39 endif
40
41 ifeq (, $(findstring WK_USE_CCACHE, $(ARGS)))
42         ifneq (, $(shell which ccache))
43                 XCODE_OPTIONS += WK_USE_CCACHE=YES
44         endif
45 endif
46
47 DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
48 VERBOSITY ?= $(DEFAULT_VERBOSITY)
49
50 ifeq ($(VERBOSITY),default)
51 OUTPUT_FILTER = cat
52 XCODE_OPTIONS += -hideShellScriptEnvironment
53 else
54 ifeq ($(VERBOSITY),noisy)
55 OUTPUT_FILTER = cat
56 else
57 OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
58 endif
59 endif
60
61 ifeq ($(ASAN),YES)
62 ASAN_OPTION=--asan
63 else
64 ifeq ($(ASAN),NO)
65 ASAN_OPTION=--no-asan
66 endif
67 endif
68
69 ifeq ($(WK_LTO_MODE),full)
70 WK_LTO_OPTION=--lto-mode=full
71 else ifeq ($(WK_LTO_MODE),thin)
72 WK_LTO_OPTION=--lto-mode=thin
73 else ifeq ($(WK_LTO_MODE),none)
74 WK_LTO_OPTION=--lto-mode=none
75 endif
76
77 export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
78
79 # Run xcodebuild with the same PATH with which the Xcode IDE runs, to mitigate unnecessary rebuilds due to PATH differences.
80 # See <rdar://problem/16466196>.
81 export PATH = $(shell getconf PATH)
82
83 all: set_asan_configuration
84         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
85
86 debug d development dev develop: force
87         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION) $(WK_LTO_OPTION)
88         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
89
90 release r deployment dep deploy: force
91         $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION) $(WK_LTO_OPTION)
92         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
93
94 analyze:
95         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION) $(WK_LTO_OPTION)
96 ifndef PATH_TO_SCAN_BUILD
97         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
98 else
99         ( $(SET_COLOR_DIAGNOSTICS_ARG); $(PATH_TO_SCAN_BUILD) xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
100 endif
101
102 set_asan_configuration:
103 ifneq (,$(ASAN_OPTION))
104         $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
105 endif
106
107 clean:
108         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
109
110 force: ;