[Cocoa] Migrate from CTFontTransformGlyphsWithLanguage() to CTFontShapeGlyphs()
[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 ifneq (,$(SDK_VARIANT))
31         XCODE_OPTIONS += SDK_VARIANT="$(SDK_VARIANT)"
32 endif
33
34 ifeq (, $(findstring WK_USE_CCACHE, $(ARGS)))
35         ifneq (, $(shell which ccache))
36                 XCODE_OPTIONS += WK_USE_CCACHE=YES
37         endif
38 endif
39
40 ifeq ($(findstring UseNewBuildSystem,$(ARGS)),)
41         CAN_USE_XCBUILD = $(shell perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print canUseXCBuild()')
42         ifeq ($(CAN_USE_XCBUILD),1)
43                 # Temporarily disable default use of XCBuild until issues with it are ironed out.
44                 #XCODE_OPTIONS += -UseNewBuildSystem=YES
45                 #XCODE_OPTIONS += USE_NEW_BUILD_SYSTEM=YES
46                 XCODE_OPTIONS += -UseNewBuildSystem=NO
47                 XCODE_OPTIONS += USE_NEW_BUILD_SYSTEM=NO
48         else
49                 XCODE_OPTIONS += -UseNewBuildSystem=NO
50                 XCODE_OPTIONS += USE_NEW_BUILD_SYSTEM=NO
51         endif
52 endif
53
54 DEFAULT_VERBOSITY := $(shell defaults read org.webkit.BuildConfiguration BuildTranscriptVerbosity 2>/dev/null || echo "default")
55 VERBOSITY ?= $(DEFAULT_VERBOSITY)
56
57 ifeq ($(VERBOSITY),default)
58 OUTPUT_FILTER = cat
59 XCODE_OPTIONS += -hideShellScriptEnvironment
60 else
61 ifeq ($(VERBOSITY),noisy)
62 OUTPUT_FILTER = cat
63 else
64 OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
65 endif
66 endif
67
68 ifeq ($(ASAN),YES)
69 ASAN_OPTION=--asan
70 else
71 ifeq ($(ASAN),NO)
72 ASAN_OPTION=--no-asan
73 endif
74 endif
75
76 ifeq ($(WK_LTO_MODE),full)
77 WK_LTO_OPTION=--lto-mode=full
78 else ifeq ($(WK_LTO_MODE),thin)
79 WK_LTO_OPTION=--lto-mode=thin
80 else ifeq ($(WK_LTO_MODE),none)
81 WK_LTO_OPTION=--lto-mode=none
82 endif
83
84 export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
85
86 # Run xcodebuild with the same PATH with which the Xcode IDE runs, to mitigate unnecessary rebuilds due to PATH differences.
87 # See <rdar://problem/16466196>.
88 export PATH = $(shell getconf PATH)
89
90 all: set_asan_configuration
91         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)' | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
92
93 debug d development dev develop: force
94         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION) $(WK_LTO_OPTION)
95         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)' | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
96
97 release r deployment dep deploy: force
98         $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION) $(WK_LTO_OPTION)
99         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)' | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
100
101 release+assert ra: force
102         $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION) $(WK_LTO_OPTION)
103         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) ASSERT_ENABLED=1 $$(inherited)' | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
104
105 testing t: force
106         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION) $(WK_LTO_OPTION) --force-optimization-level=O3
107         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)' | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
108
109 analyze:
110         $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION) $(WK_LTO_OPTION)
111 ifndef PATH_TO_SCAN_BUILD
112         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)' RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
113 else
114         ( $(SET_COLOR_DIAGNOSTICS_ARG); $(PATH_TO_SCAN_BUILD) xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) GCC_PREPROCESSOR_DEFINITIONS='$(GCC_PREPROCESSOR_ADDITIONS) $$(inherited)' | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
115 endif
116
117 set_asan_configuration:
118 ifneq (,$(ASAN_OPTION))
119         $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
120 endif
121
122 clean:
123         ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
124
125 force: ;