make: support building with clang (on Linux)
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 9 Dec 2015 09:32:03 +0000 (10:32 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 9 Dec 2015 10:12:27 +0000 (11:12 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Makefile.inc

index b41ca36..64264d7 100644 (file)
@@ -119,14 +119,18 @@ WARNINGS +=       -Wformat-y2k
 WARNINGS +=     -Werror=format-security
 WARNINGS +=    -Winit-self
 WARNINGS +=    -Wswitch-default
-WARNINGS +=    -Wsync-nand
 WARNINGS +=    -Wundef
+ifneq ($(CC),clang)
+WARNINGS +=    -Wsync-nand
 WARNINGS +=    -Wlogical-op
+endif
 ifneq ($(OS),android)
+ifneq ($(CC),clang)
 WARNINGS +=    -Wdouble-promotion
 WARNINGS +=    -Wjump-misses-init
 WARNINGS +=    -Wtrampolines
 endif
+endif
 WARNINGS +=    -Wunused-parameter
 # the following 2 do not work yet and need more work on it
 #WARNINGS +=   -Wconversion
@@ -140,14 +144,18 @@ endif
 WARNINGS +=    -Winline
 WARNINGS +=    -Wdisabled-optimization
 # WARNINGS +=  -Werror
-WARNINGS +=    -finline-functions-called-once
 WARNINGS +=    -funit-at-a-time
+ifneq ($(CC),clang)
+WARNINGS +=    -finline-functions-called-once
 WARNINGS +=    -fearly-inlining
+endif
 ifeq ($(DEBUG),0)
 WARNINGS +=    -fomit-frame-pointer
 endif
 # we have small inline functions in src/lq_route.h which should always be inlined
+ifneq ($(CC),clang)
 WARNINGS +=    -finline-limit=350
+endif
 # These tell gcc to put each function and global variable in a separate section.
 # The linker can than remove all unreferenced section. But in the olsrd binary
 # unused doesn't imply unused at all since the function may be used by plugins,