Cleanup: Remove AlternativeTextInfo and use Variant to represent alternative text...
[WebKit.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 DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
38 VERBOSITY ?= $(DEFAULT_VERBOSITY)
39
40 ifeq ($(VERBOSITY),default)
41 OUTPUT_FILTER = cat
42 XCODE_OPTIONS += -hideShellScriptEnvironment
43 else
44 ifeq ($(VERBOSITY),noisy)
45 OUTPUT_FILTER = cat
46 else
47 OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
48 endif
49 endif
50
51 ifeq ($(ASAN),YES)
52 ASAN_OPTION=--asan
53 else
54 ifeq ($(ASAN),NO)
55 ASAN_OPTION=--no-asan
56 endif
57 endif
58
59 export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
60
61 # Run xcodebuild with the same PATH with which the Xcode IDE runs, to mitigate unnecessary rebuilds due to PATH differences.
62 # See <rdar://problem/16466196>.
63 export PATH = $(shell getconf PATH)
64
65 all: set_asan_configuration
66         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
67
68 debug d development dev develop: force
69         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
70         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
71
72 release r deployment dep deploy: force
73         $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
74         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
75
76 analyze:
77         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
78 ifndef PATH_TO_SCAN_BUILD
79         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
80 else
81         ( $(SET_COLOR_DIAGNOSTICS_ARG); $(PATH_TO_SCAN_BUILD) xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
82 endif
83
84 set_asan_configuration:
85 ifneq (,$(ASAN_OPTION))
86         $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
87 endif
88
89 clean:
90         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
91
92 force: ;