# - Default value is 'cc' which is not always a valid command (e.g. MinGW).
ifeq ($(origin CC),default)
CC = gcc
+# Change the default compile to clang on Mac OSX.
+# http://stackoverflow.com/questions/714100/os-detecting-makefile
+UNAME_S := $(shell uname -s)
+ifeq ($(UNAME_S),Darwin)
+ CC = clang
+endif
endif
# Default Fortran compiler (FC) is selected by f_check.
endif
ifndef GEMM_MULTITHREAD_THRESHOLD
-GEMM_MULTITHREAD_THRESHOLD=50
+GEMM_MULTITHREAD_THRESHOLD=4
endif
GETARCH_FLAGS += -DGEMM_MULTITHREAD_THRESHOLD=$(GEMM_MULTITHREAD_THRESHOLD)
GETARCH_FLAGS += -g
endif
+ifndef NO_PARALLEL_MAKE
+NO_PARALLEL_MAKE=0
+endif
+GETARCH_FLAGS += -DNO_PARALLEL_MAKE=$(NO_PARALLEL_MAKE)
# This operation is expensive, so execution should be once.
ifndef GOTOBLAS_MAKEFILE
export GOTOBLAS_MAKEFILE = 1
SUFFIX = obj
PSUFFIX = pobj
-LIBSUFFIX = lib
+LIBSUFFIX = a
+
+ifeq ($(C_COMPILER), CLANG)
+CCOMMON_OPT += -DMS_ABI
+endif
+
ifeq ($(C_COMPILER), GCC)
#Test for supporting MS_ABI
GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4)
CCOMMON_OPT += -DEXPRECISION -m128bit-long-double
FCOMMON_OPT += -m128bit-long-double
endif
+ifeq ($(C_COMPILER), CLANG)
+EXPRECISION = 1
+CCOMMON_OPT += -DEXPRECISION
+FCOMMON_OPT += -m128bit-long-double
+endif
endif
endif
endif
CCOMMON_OPT += -DEXPRECISION -m128bit-long-double
FCOMMON_OPT += -m128bit-long-double
endif
+ifeq ($(C_COMPILER), CLANG)
+EXPRECISION = 1
+CCOMMON_OPT += -DEXPRECISION
+FCOMMON_OPT += -m128bit-long-double
+endif
endif
endif
endif
CCOMMON_OPT += -fopenmp
endif
+ifeq ($(C_COMPILER), CLANG)
+$(error OpenBLAS: Clang didn't support OpenMP yet.)
+CCOMMON_OPT += -fopenmp
+endif
+
ifeq ($(C_COMPILER), INTEL)
CCOMMON_OPT += -openmp
endif
# C Compiler dependent settings
#
-ifeq ($(C_COMPILER), GCC)
+# ifeq logical or. GCC or CLANG
+# http://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or
+ifeq ($(C_COMPILER), $(filter $(C_COMPILER),GCC CLANG))
CCOMMON_OPT += -Wall
COMMON_PROF += -fno-inline
NO_UNINITIALIZED_WARN = -Wno-uninitialized