1 SCRIPTS_PATH ?= ../Tools/Scripts
3 XCODE_OPTIONS = `perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print XcodeOptionString()' -- $(BUILD_WEBKIT_OPTIONS)` $${COLOR_DIAGNOSTICS_ARG} $(ARGS)
4 ifeq (ON,$(ENABLE_LLVM_PROFILE_GENERATION))
5 XCODE_OPTIONS += ENABLE_LLVM_PROFILE_GENERATION=ENABLE_LLVM_PROFILE_GENERATION
8 ifeq ($(USE_WORKSPACE),YES)
9 SCHEME ?= $(notdir $(CURDIR))
10 WORKSPACE_PATH ?= $(dir $(lastword $(MAKEFILE_LIST)))WebKit.xcworkspace
11 XCODE_TARGET = -workspace $(WORKSPACE_PATH) -scheme "$(SCHEME)"
12 XCODE_OPTIONS += WK_VALIDATE_DEPENDENCIES=YES_ERROR
18 ifneq (,$(OVERRIDE_SDKROOT))
19 ifneq (default,$(OVERRIDE_SDKROOT))
20 XCODE_OPTIONS := $(XCODE_OPTIONS) SDKROOT=$(OVERRIDE_SDKROOT)
24 XCODE_OPTIONS := $(XCODE_OPTIONS) SDKROOT=$(SDKROOT)
29 ifneq (,$(OVERRIDE_ARCHS))
30 ifneq (default,$(OVERRIDE_ARCHS))
31 XCODE_OPTIONS := $(XCODE_OPTIONS) ARCHS="$(OVERRIDE_ARCHS)"
32 XCODE_OPTIONS += ONLY_ACTIVE_ARCH=NO
36 XCODE_OPTIONS := $(XCODE_OPTIONS) ARCHS="$(ARCHS)"
37 XCODE_OPTIONS += ONLY_ACTIVE_ARCH=NO
41 ifneq (,$(SDK_VARIANT))
42 XCODE_OPTIONS += SDK_VARIANT="$(SDK_VARIANT)"
45 ifeq (, $(findstring WK_USE_CCACHE, $(ARGS)))
46 ifneq (, $(shell which ccache))
47 XCODE_OPTIONS += WK_USE_CCACHE=YES
51 ifneq (,$(EXPORT_COMPILE_COMMANDS))
52 XCODE_OPTIONS += OTHER_CFLAGS='$$(inherited) -gen-cdb-fragment-path $$(BUILT_PRODUCTS_DIR)/compile_commands'
53 XCODE_OPTIONS += GCC_PRECOMPILE_PREFIX_HEADER=NO
54 XCODE_OPTIONS += CLANG_ENABLE_MODULE_DEBUGGING=NO
55 XCODE_OPTIONS += COMPILER_INDEX_STORE_ENABLE=NO
58 DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
59 VERBOSITY ?= $(DEFAULT_VERBOSITY)
61 ifeq ($(VERBOSITY),default)
63 XCODE_OPTIONS += -hideShellScriptEnvironment
65 ifeq ($(VERBOSITY),noisy)
68 OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
73 CONFIG_OPTIONS += --asan
76 CONFIG_OPTIONS += --no-asan
81 CONFIG_OPTIONS += --tsan
84 CONFIG_OPTIONS += --no-tsan
89 CONFIG_OPTIONS += --ubsan
92 CONFIG_OPTIONS += --no-ubsan
96 ifeq ($(WK_LTO_MODE),full)
97 CONFIG_OPTIONS += --lto-mode=full
98 else ifeq ($(WK_LTO_MODE),thin)
99 CONFIG_OPTIONS += --lto-mode=thin
100 else ifeq ($(WK_LTO_MODE),none)
101 CONFIG_OPTIONS += --lto-mode=none
104 export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
106 # Run xcodebuild with the same PATH with which the Xcode IDE runs, to mitigate unnecessary rebuilds due to PATH differences.
107 # See <rdar://problem/16466196>.
108 export PATH = $(shell getconf PATH)
111 define set_webkit_configuration
112 $(SCRIPTS_PATH)/set-webkit-configuration $1 $(CONFIG_OPTIONS)
117 [[ -t 1 ]] && COLOR_DIAGNOSTICS_ARG="COLOR_DIAGNOSTICS=YES"; \
119 echo "===== BUILDING $(if $(USE_WORKSPACE),$(SCHEME),$(notdir $(CURDIR))) ====="; \
121 $1 xcodebuild $2 $(OTHER_OPTIONS) $(XCODE_TARGET) $(XCODE_OPTIONS) $3 | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} \
126 @$(call set_webkit_configuration,)
127 @$(call invoke_xcode,,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
130 @$(call set_webkit_configuration,--debug)
131 @$(call invoke_xcode,,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
134 @$(call set_webkit_configuration,--release)
135 @$(call invoke_xcode,,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
137 release+assert ra: force
138 @$(call set_webkit_configuration,--release)
139 @$(call invoke_xcode,,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) ASSERT_ENABLED=1 $$(inherited)')
142 @$(call set_webkit_configuration,--debug --force-optimization-level=O3)
143 @$(call invoke_xcode,,,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
146 @$(call set_webkit_configuration,--debug)
147 @$(call invoke_xcode,$(PATH_TO_SCAN_BUILD),build analyze,GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)')
151 @$(call invoke_xcode,,,-alltargets clean)
153 @$(call invoke_xcode,,,clean)
158 @$(call invoke_xcode,,,-alltargets installsrc SRCROOT="$(SRCROOT)$(PATH_FROM_ROOT)")
160 @$(call invoke_xcode,,,installsrc SRCROOT="$(SRCROOT)$(PATH_FROM_ROOT)")