REGRESSION(r200208): It made 2 JSC stress tests fail on x86
[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         endif
28 endif
29
30 DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
31 VERBOSITY ?= $(DEFAULT_VERBOSITY)
32
33 ifeq ($(VERBOSITY),default)
34 OUTPUT_FILTER = grep -v setenv
35 else
36 ifeq ($(VERBOSITY),noisy)
37 OUTPUT_FILTER = cat
38 else
39 OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
40 endif
41 endif
42
43 ifeq ($(ASAN),YES)
44 ASAN_OPTION=--asan
45 else
46 ifeq ($(ASAN),NO)
47 ASAN_OPTION=--no-asan
48 endif
49 endif
50
51 export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
52
53 # Run xcodebuild with the same PATH with which the Xcode IDE runs, to mitigate unnecessary rebuilds due to PATH differences.
54 # See <rdar://problem/16466196>.
55 export PATH = $(shell getconf PATH)
56
57 all: set_asan_configuration
58         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
59
60 debug d development dev develop: force
61         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
62         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
63
64 release r deployment dep deploy: force
65         $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
66         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
67
68 analyze:
69         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
70 ifndef PATH_TO_SCAN_BUILD
71         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
72 else
73         ( $(SET_COLOR_DIAGNOSTICS_ARG); $(PATH_TO_SCAN_BUILD) xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
74 endif
75
76 set_asan_configuration:
77 ifneq (,$(ASAN_OPTION))
78         $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
79 endif
80
81 clean:
82         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
83
84 force: ;