Simplify building with ASan
[WebKit-https.git] / Makefile.shared
index cf6fe35e4b6536623630e87a00a4fdddde41a0d5..600635048090d8678179a3ac5290ad952f018ce8 100644 (file)
@@ -25,27 +25,40 @@ OUTPUT_FILTER = $(SCRIPTS_PATH)/filter-build-webkit
 endif
 endif
 
+ifeq ($(ASAN),YES)
+ASAN_OPTION=--asan
+else
+ifeq ($(ASAN),NO)
+ASAN_OPTION=--no-asan
+endif
+endif
+
 export DSYMUTIL_NUM_THREADS = $(shell sysctl -n hw.activecpu)
 
-all:
+all: set_asan_configuration
        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
 
 debug d development dev develop: force
-       $(SCRIPTS_PATH)/set-webkit-configuration --debug
+       $(SCRIPTS_PATH)/set-webkit-configuration --debug $(ASAN_OPTION)
        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
 
 release r deployment dep deploy: force
-       $(SCRIPTS_PATH)/set-webkit-configuration --release
+       $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
 
 analyze:
-       $(SCRIPTS_PATH)/set-webkit-configuration --release
+       $(SCRIPTS_PATH)/set-webkit-configuration --release $(ASAN_OPTION)
 ifndef PATH_TO_SCAN_BUILD
        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) RUN_CLANG_STATIC_ANALYZER=YES | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
 else
        ( $(SET_COLOR_DIAGNOSTICS_ARG); $(PATH_TO_SCAN_BUILD) xcodebuild $(OTHER_OPTIONS) $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )
 endif
 
+set_asan_configuration:
+ifneq (,$(ASAN_OPTION))
+       $(SCRIPTS_PATH)/set-webkit-configuration $(ASAN_OPTION)
+endif
+
 clean:
        ( $(SET_COLOR_DIAGNOSTICS_ARG); xcodebuild $(OTHER_OPTIONS) -alltargets clean $(XCODE_OPTIONS) | $(OUTPUT_FILTER) && exit $${PIPESTATUS[0]} )