Speculative GTK build fix after r188553
[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         XCODE_OPTIONS += SDKROOT=$(SDKROOT)
8 endif
9
10 ifneq (,$(ARCHS))
11         XCODE_OPTIONS += ARCHS="$(ARCHS)"
12         XCODE_OPTIONS += ONLY_ACTIVE_ARCH=NO
13 endif
14
15 DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
16 VERBOSITY ?= $(DEFAULT_VERBOSITY)
17
18 ifeq ($(VERBOSITY),default)
19 OUTPUT_FILTER = grep -v setenv
20 else
21 ifeq ($(VERBOSITY),noisy)
22 OUTPUT_FILTER = cat
23 else
24 OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
25 endif
26 endif
27
28 ifeq ($(ASAN),YES)
29 ASAN_OPTION=--asan
30 else
31 ifeq ($(ASAN),NO)
32 ASAN_OPTION=--no-asan
33 endif
34 endif
35
36 export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
37
38 # Run xcodebuild with the same PATH with which the Xcode IDE runs, to mitigate unnecessary rebuilds due to PATH differences.
39 # See <rdar://problem/16466196>.
40 export PATH = $(shell getconf PATH)
41
42 all: set_asan_configuration
43         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
44
45 debug d development dev develop: force
46         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
47         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
48
49 release r deployment dep deploy: force
50         $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
51         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
52
53 analyze:
54         $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
55 ifndef PATH_TO_SCAN_BUILD
56         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
57 else
58         ( $(SET_COLOR_DIAGNOSTICS_ARG); $(PATH_TO_SCAN_BUILD) xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
59 endif
60
61 set_asan_configuration:
62 ifneq (,$(ASAN_OPTION))
63         $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
64 endif
65
66 clean:
67         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
68
69 force: ;