[Xcode] With default verbosity, make(1) output no longer hides environment variable...
[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 = cat
35 XCODE_OPTIONS += -hideShellScriptEnvironment
36 else
37 ifeq ($(VERBOSITY),noisy)
38 OUTPUT_FILTER = cat
39 else
40 OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
41 endif
42 endif
43
44 ifeq ($(ASAN),YES)
45 ASAN_OPTION=--asan
46 else
47 ifeq ($(ASAN),NO)
48 ASAN_OPTION=--no-asan
49 endif
50 endif
51
52 export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
53
54 # Run xcodebuild with the same PATH with which the Xcode IDE runs, to mitigate unnecessary rebuilds due to PATH differences.
55 # See <rdar://problem/16466196>.
56 export PATH = $(shell getconf PATH)
57
58 all: set_asan_configuration
59         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
60
61 debug d development dev develop: force
62         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
63         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
64
65 release r deployment dep deploy: force
66         $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
67         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
68
69 analyze:
70         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
71 ifndef PATH_TO_SCAN_BUILD
72         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
73 else
74         ( $(SET_COLOR_DIAGNOSTICS_ARG); $(PATH_TO_SCAN_BUILD) xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
75 endif
76
77 set_asan_configuration:
78 ifneq (,$(ASAN_OPTION))
79         $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
80 endif
81
82 clean:
83         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
84
85 force: ;