summaryrefslogtreecommitdiff
path: root/makefiles
diff options
context:
space:
mode:
Diffstat (limited to 'makefiles')
-rw-r--r--makefiles/gmake/compiler.mk10
-rwxr-xr-xmakefiles/gmake/guess_env25
2 files changed, 32 insertions, 3 deletions
diff --git a/makefiles/gmake/compiler.mk b/makefiles/gmake/compiler.mk
index bde55a0..c2183d8 100644
--- a/makefiles/gmake/compiler.mk
+++ b/makefiles/gmake/compiler.mk
@@ -251,6 +251,12 @@ PTHREADS_LIBS =
endif
endif
+ifeq "$(COMPILER)" "clang"
+PTHREADS_CFLAGS = -D_REENTRANT -pthread
+PTHREADS_LDFLAGS = -pthread
+PTHREADS_LIBS =
+endif
+
endif
# set flags for position independend code (as required for shared libraries
@@ -298,6 +304,10 @@ endif
#endif
#endif
+ifeq "$(COMPILER)" "clang"
+SO_COMPILE_FLAGS =
+endif
+
ALL_CFLAGS = $(CFLAGS) $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(INCLUDE_CFLAGS) $(PTHREADS_CFLAGS)
ALL_LDFLAGS = $(LDFLAGS) $(INCLUDE_LDFLAGS) $(PTHREADS_LDFLAGS) $(LDFLAGS_NET) $(LDFLAGS_LT) $(LDFLAGS_DL)
diff --git a/makefiles/gmake/guess_env b/makefiles/gmake/guess_env
index 697d160..dc07d5b 100755
--- a/makefiles/gmake/guess_env
+++ b/makefiles/gmake/guess_env
@@ -122,15 +122,20 @@ else
if test $? = 0; then
COMPILER='icc'
else
- ( $CC -xhelp=readme | head -n 1 | grep 'Sun Studio' ) >/dev/null
+ ( $CC -xhelp=readme 2>&1 | head -n 1 | grep 'Sun Studio' ) >/dev/null
if test $? = 0; then
COMPILER='spro'
else
- ( $CC -v | head -n 1 | grep 'pcc' ) >/dev/null
+ ( $CC -v 2>&1 | head -n 1 | grep 'pcc' ) >/dev/null
if test $? = 0; then
COMPILER='pcc'
else
- COMPILER='unknown'
+ ( $CC --version 2>&1 | head -n 1 | grep 'clang' ) >/dev/null
+ if test $? = 0; then
+ COMPILER='clang'
+ else
+ COMPILER='unknown'
+ fi
fi
fi
fi
@@ -176,6 +181,14 @@ if test $COMPILER = "pcc"; then
PCC_MINOR_VERSION=`echo $PCC_VERSION | cut -d . -f 2`
fi
+# version of clang (LLVM C frontend)
+
+if test $COMPILER = "clang"; then
+ CLANG_VERSION=`$CC --version | head -n 1 | cut -d ' ' -f 3`
+ CLANG_MAJOR_VERSION=`echo $CLANG_VERSION | cut -d . -f 1`
+ CLANG_MINOR_VERSION=`echo $CLANG_VERSION | cut -d . -f 2`
+fi
+
case "$1" in
--platform) echo $PLATFORM
;;
@@ -218,6 +231,12 @@ case "$1" in
--pcc-minor-version) echo $PCC_MINOR_VERSION
;;
+
+ --clang-major-version) echo $CLANG_MAJOR_VERSION
+ ;;
+
+ --clang-minor-version) echo $CLANG_MINOR_VERSION
+ ;;
esac
MAKEFILE_DIR="$3/$4"