forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.shared
161 lines (135 loc) · 4.41 KB
/
Makefile.shared
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
SCRIPTS_PATH ?= ../Tools/Scripts
XCODE_OPTIONS = `perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print XcodeOptionString()' -- $(BUILD_WEBKIT_OPTIONS)` $${COLOR_DIAGNOSTICS_ARG} $(ARGS)
ifneq (,$(SDKROOT))
ifneq (,$(OVERRIDE_SDKROOT))
ifneq (default,$(OVERRIDE_SDKROOT))
XCODE_OPTIONS := $(XCODE_OPTIONS) SDKROOT=$(OVERRIDE_SDKROOT)
endif
OVERRIDE_SDKROOT =
else
XCODE_OPTIONS := $(XCODE_OPTIONS) SDKROOT=$(SDKROOT)
endif
endif
ifneq (,$(ARCHS))
ifneq (,$(OVERRIDE_ARCHS))
ifneq (default,$(OVERRIDE_ARCHS))
XCODE_OPTIONS := $(XCODE_OPTIONS) ARCHS="$(OVERRIDE_ARCHS)"
XCODE_OPTIONS += ONLY_ACTIVE_ARCH=NO
endif
OVERRIDE_ARCHS =
else
XCODE_OPTIONS := $(XCODE_OPTIONS) ARCHS="$(ARCHS)"
XCODE_OPTIONS += ONLY_ACTIVE_ARCH=NO
endif
endif
ifneq (,$(SDK_VARIANT))
XCODE_OPTIONS += SDK_VARIANT="$(SDK_VARIANT)"
endif
ifeq (, $(findstring WK_USE_CCACHE, $(ARGS)))
ifneq (, $(shell which ccache))
XCODE_OPTIONS += WK_USE_CCACHE=YES
endif
endif
ifeq ($(findstring UseNewBuildSystem,$(ARGS)),)
CAN_USE_XCBUILD = $(shell perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print canUseXCBuild()')
ifeq ($(CAN_USE_XCBUILD),1)
# Temporarily disable default use of XCBuild until issues with it are ironed out.
#XCODE_OPTIONS += -UseNewBuildSystem=YES
XCODE_OPTIONS += -UseNewBuildSystem=NO
else
XCODE_OPTIONS += -UseNewBuildSystem=NO
endif
endif
DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
VERBOSITY ?= $(DEFAULT_VERBOSITY)
ifeq ($(VERBOSITY),default)
OUTPUT_FILTER = cat
XCODE_OPTIONS += -hideShellScriptEnvironment
else
ifeq ($(VERBOSITY),noisy)
OUTPUT_FILTER = cat
else
OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
endif
endif
ifeq ($(ASAN),YES)
ASAN_OPTION=--asan
else
ifeq ($(ASAN),NO)
ASAN_OPTION=--no-asan
endif
endif
ifeq ($(TSAN),YES)
TSAN_OPTION=--tsan
else
ifeq ($(TSAN),NO)
TSAN_OPTION=--no-tsan
endif
endif
ifeq ($(UBSAN),YES)
UBSAN_OPTION=--ubsan
else
ifeq ($(UBSAN),NO)
UBSAN_OPTION=--no-ubsan
endif
endif
ifeq ($(WK_LTO_MODE),full)
WK_LTO_OPTION=--lto-mode=full
else ifeq ($(WK_LTO_MODE),thin)
WK_LTO_OPTION=--lto-mode=thin
else ifeq ($(WK_LTO_MODE),none)
WK_LTO_OPTION=--lto-mode=none
endif
export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
# Run xcodebuild with the same PATH with which the Xcode IDE runs, to mitigate unnecessary rebuilds due to PATH differences.
# See <rdar://problem/16466196>.
export PATH = $(shell getconf PATH)
define set_webkit_configuration
$(SCRIPTS_PATH)/set-webkit-configuration $1 $(ASAN_OPTION) $(TSAN_OPTION) $(UBSAN_OPTION) $(WK_LTO_OPTION)
endef
define invoke_xcode
( \
[[ -t 1 ]] && COLOR_DIAGNOSTICS_ARG="COLOR_DIAGNOSTICS=YES"; \
echo; \
echo "===== BUILDING $$(basename "$$(pwd)") ====="; \
echo; \
$1 xcodebuild $(OTHER_OPTIONS) $(XCODE_TARGET) $(XCODE_OPTIONS) $2 | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} \
)
endef
all:
ifneq (,$(strip $(ASAN_OPTION) $(TSAN_OPTION) $(UBSAN_OPTION) $(WK_LTO_OPTION)))
@$(call set_webkit_configuration,)
endif
@$(call invoke_xcode,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
debug d: force
@$(call set_webkit_configuration,--debug)
@$(call invoke_xcode,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
release r: force
@$(call set_webkit_configuration,--release)
@$(call invoke_xcode,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
release+assert ra: force
@$(call set_webkit_configuration,--release)
@$(call invoke_xcode,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) ASSERT_ENABLED=1 $$(inherited)')
testing t: force
@$(call set_webkit_configuration,--debug --force-optimization-level=O3)
@$(call invoke_xcode,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
analyze:
@$(call set_webkit_configuration,--debug)
ifndef PATH_TO_SCAN_BUILD
@$(call invoke_xcode,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)' RUN_CLANG_STATIC_ANALYZER=YES)
else
@$(call invoke_xcode,$(PATH_TO_SCAN_BUILD),GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
endif
clean:
ifndef XCODE_TARGET
@$(call invoke_xcode,,-alltargets clean)
else
@$(call invoke_xcode,,clean)
endif
installsrc:
ifndef XCODE_TARGET
@$(call invoke_xcode,,-alltargets installsrc SRCROOT="$(SRCROOT)$(PATH_FROM_ROOT)")
else
@$(call invoke_xcode,,installsrc SRCROOT="$(SRCROOT)$(PATH_FROM_ROOT)")
endif
force: ;