Revision control

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