libweave: Add clang support to Makefile.
To use: "CLANG=1 make all -j"
BUG: 26508278
Change-Id: I6b09e6574634d8e07ce2438c31907466e953eb0f
Reviewed-on: https://weave-review.googlesource.com/2185
Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/Makefile b/Makefile
index 0eb4e12..c49462f 100644
--- a/Makefile
+++ b/Makefile
@@ -49,6 +49,23 @@
CFLAGS_CC := \
-std=c++11
+comma := ,
+ifeq (1, $(CLANG))
+ CC = $(shell which clang-3.6)
+ CXX = $(shell which clang++-3.6)
+ CFLAGS := $(filter-out -Wl$(comma)--exclude-libs$(comma)ALL,$(CFLAGS))
+ CFLAGS += \
+ -fno-omit-frame-pointer \
+ -Wno-deprecated-register \
+ -Wno-inconsistent-missing-override
+ ifeq (Debug, $(BUILD_MODE))
+ CFLAGS += \
+ -fsanitize=address
+ LDFLAGS += \
+ -fsanitize=address
+ endif
+endif
+
include file_lists.mk third_party.mk examples.mk tests.mk
###