kusano 2b45e8
#
kusano 2b45e8
# Include user definition
kusano 2b45e8
#
kusano 2b45e8
kusano 2b45e8
# TO suppress recursive includes
kusano 2b45e8
INCLUDED = 1
kusano 2b45e8
kusano 2b45e8
ifndef TOPDIR
kusano 2b45e8
TOPDIR = .
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef NETLIB_LAPACK_DIR
kusano 2b45e8
NETLIB_LAPACK_DIR = $(TOPDIR)/lapack-3.4.1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
# Default C compiler
kusano 2b45e8
CC = gcc
kusano 2b45e8
kusano 2b45e8
ifndef MAKEFILE_RULE
kusano 2b45e8
include $(TOPDIR)/Makefile.rule
kusano 2b45e8
else
kusano 2b45e8
include $(TOPDIR)/$(MAKEFILE_RULE)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
#
kusano 2b45e8
#  Beginning of system configuration 
kusano 2b45e8
#
kusano 2b45e8
kusano 2b45e8
ifndef HOSTCC
kusano 2b45e8
HOSTCC	 = $(CC)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef TARGET
kusano 2b45e8
GETARCH_FLAGS := -DFORCE_$(TARGET)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
#TARGET_CORE will override TARGET which is used in DYNAMIC_ARCH=1.
kusano 2b45e8
#
kusano 2b45e8
ifdef TARGET_CORE
kusano 2b45e8
GETARCH_FLAGS := -DFORCE_$(TARGET_CORE)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef INTERFACE64
kusano 2b45e8
GETARCH_FLAGS	+= -DUSE64BITINT
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef GEMM_MULTITHREAD_THRESHOLD
kusano 2b45e8
GEMM_MULTITHREAD_THRESHOLD=4
kusano 2b45e8
endif
kusano 2b45e8
GETARCH_FLAGS	+= -DGEMM_MULTITHREAD_THRESHOLD=$(GEMM_MULTITHREAD_THRESHOLD) 
kusano 2b45e8
kusano 2b45e8
# This operation is expensive, so execution should be once.
kusano 2b45e8
ifndef GOTOBLAS_MAKEFILE
kusano 2b45e8
export GOTOBLAS_MAKEFILE = 1
kusano 2b45e8
kusano 2b45e8
# Generating Makefile.conf and config.h
kusano 2b45e8
DUMMY := $(shell $(MAKE) -C $(TOPDIR) -f Makefile.getarch CC="$(CC)" FC="$(FC)" HOSTCC="$(HOSTCC)" CFLAGS="$(GETARCH_FLAGS)" BINARY=$(BINARY) USE_OPENMP=$(USE_OPENMP) TARGET_CORE=$(TARGET_CORE) all)
kusano 2b45e8
kusano 2b45e8
ifndef TARGET_CORE
kusano 2b45e8
include $(TOPDIR)/Makefile.conf
kusano 2b45e8
else
kusano 2b45e8
include $(TOPDIR)/Makefile_kernel.conf
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef NUM_THREADS
kusano 2b45e8
NUM_THREADS = $(NUM_CORES)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(NUM_THREADS), 1)
kusano 2b45e8
override USE_THREAD = 0
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef USE_THREAD
kusano 2b45e8
ifeq ($(USE_THREAD), 0)
kusano 2b45e8
SMP =
kusano 2b45e8
else
kusano 2b45e8
SMP = 1
kusano 2b45e8
endif
kusano 2b45e8
else
kusano 2b45e8
ifeq ($(NUM_THREAD), 1)
kusano 2b45e8
SMP =
kusano 2b45e8
else
kusano 2b45e8
SMP = 1
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef NEED_PIC
kusano 2b45e8
NEED_PIC = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ARFLAGS	=
kusano 2b45e8
CPP	= $(COMPILER) -E
kusano 2b45e8
AR	= $(CROSS_SUFFIX)ar
kusano 2b45e8
AS	= $(CROSS_SUFFIX)as
kusano 2b45e8
LD	= $(CROSS_SUFFIX)ld
kusano 2b45e8
RANLIB	= $(CROSS_SUFFIX)ranlib
kusano 2b45e8
NM	= $(CROSS_SUFFIX)nm
kusano 2b45e8
DLLWRAP = $(CROSS_SUFFIX)dllwrap
kusano 2b45e8
kusano 2b45e8
#
kusano 2b45e8
#  OS dependent settings
kusano 2b45e8
#
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), Darwin)
kusano 2b45e8
export MACOSX_DEPLOYMENT_TARGET=10.2
kusano 2b45e8
MD5SUM = md5 -r
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), Linux)
kusano 2b45e8
EXTRALIB	+= -lm
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), AIX)
kusano 2b45e8
EXTRALIB	+= -lm
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), WINNT)
kusano 2b45e8
NEED_PIC = 0
kusano 2b45e8
NO_EXPRECISION = 1
kusano 2b45e8
kusano 2b45e8
EXTRALIB        += -defaultlib:advapi32
kusano 2b45e8
kusano 2b45e8
SUFFIX  = obj
kusano 2b45e8
PSUFFIX = pobj
kusano 2b45e8
LIBSUFFIX = lib
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), Interix)
kusano 2b45e8
NEED_PIC = 0
kusano 2b45e8
NO_EXPRECISION = 1
kusano 2b45e8
kusano 2b45e8
INTERIX_TOOL_DIR = /opt/gcc.3.3/i586-pc-interix3/bin
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), CYGWIN_NT)
kusano 2b45e8
NEED_PIC = 0
kusano 2b45e8
NO_EXPRECISION = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifneq ($(OSNAME), WINNT)
kusano 2b45e8
ifneq ($(OSNAME), CYGWIN_NT)
kusano 2b45e8
ifneq ($(OSNAME), Interix)
kusano 2b45e8
ifdef SMP
kusano 2b45e8
EXTRALIB   += -lpthread
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef QUAD_PRECISION
kusano 2b45e8
CCOMMON_OPT	+= -DQUAD_PRECISION
kusano 2b45e8
NO_EXPRECISION = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifneq ($(ARCH), x86)
kusano 2b45e8
ifneq ($(ARCH), x86_64)
kusano 2b45e8
NO_EXPRECISION = 1
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef UTEST_CHECK
kusano 2b45e8
CCOMMON_OPT	+= -DUTEST_CHECK
kusano 2b45e8
SANITY_CHECK = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef SANITY_CHECK
kusano 2b45e8
CCOMMON_OPT	+= -DSANITY_CHECK -DREFNAME=$(*F)f$(BU)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
#
kusano 2b45e8
#  Architecture dependent settings
kusano 2b45e8
#
kusano 2b45e8
kusano 2b45e8
ifeq ($(ARCH), x86)
kusano 2b45e8
ifndef BINARY
kusano 2b45e8
NO_BINARY_MODE	= 1
kusano 2b45e8
endif
kusano 2b45e8
ifndef NO_EXPRECISION
kusano 2b45e8
ifeq ($(F_COMPILER), GFORTRAN)
kusano 2b45e8
ifeq ($(C_COMPILER), GCC)
kusano 2b45e8
EXPRECISION	= 1
kusano 2b45e8
CCOMMON_OPT	+= -DEXPRECISION -m128bit-long-double
kusano 2b45e8
FCOMMON_OPT	+= -m128bit-long-double
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(ARCH), x86_64)
kusano 2b45e8
ifndef NO_EXPRECISION
kusano 2b45e8
ifeq ($(F_COMPILER), GFORTRAN)
kusano 2b45e8
ifeq ($(C_COMPILER), GCC)
kusano 2b45e8
EXPRECISION	= 1
kusano 2b45e8
CCOMMON_OPT	+= -DEXPRECISION -m128bit-long-double
kusano 2b45e8
FCOMMON_OPT	+= -m128bit-long-double
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), INTEL)
kusano 2b45e8
CCOMMON_OPT    += -wd981
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(USE_OPENMP), 1)
kusano 2b45e8
ifeq ($(C_COMPILER), GCC)
kusano 2b45e8
CCOMMON_OPT    += -fopenmp
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), INTEL)
kusano 2b45e8
CCOMMON_OPT    += -openmp
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), PGI)
kusano 2b45e8
CCOMMON_OPT    += -mp
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), OPEN64)
kusano 2b45e8
CCOMMON_OPT    += -mp
kusano 2b45e8
CEXTRALIB   += -lstdc++
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), PATHSCALE)
kusano 2b45e8
CCOMMON_OPT    += -mp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
ifdef DYNAMIC_ARCH
kusano 2b45e8
ifeq ($(ARCH), x86)
kusano 2b45e8
DYNAMIC_CORE = KATMAI COPPERMINE NORTHWOOD PRESCOTT BANIAS \
kusano 2b45e8
	       CORE2 PENRYN DUNNINGTON NEHALEM ATHLON OPTERON OPTERON_SSE3 BARCELONA ATOM NANO
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(ARCH), x86_64)
kusano 2b45e8
DYNAMIC_CORE = PRESCOTT CORE2 PENRYN DUNNINGTON NEHALEM OPTERON OPTERON_SSE3 BARCELONA ATOM NANO
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef DYNAMIC_CORE
kusano 2b45e8
DYNAMIC_ARCH =
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(ARCH), ia64)
kusano 2b45e8
NO_BINARY_MODE	= 1
kusano 2b45e8
BINARY_DEFINED	= 1
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), GFORTRAN)
kusano 2b45e8
ifeq ($(C_COMPILER), GCC)
kusano 2b45e8
# EXPRECISION	= 1
kusano 2b45e8
# CCOMMON_OPT	+= -DEXPRECISION
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(ARCH), mips64)
kusano 2b45e8
NO_BINARY_MODE	= 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(ARCH), alpha)
kusano 2b45e8
NO_BINARY_MODE	= 1
kusano 2b45e8
BINARY_DEFINED	= 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
#
kusano 2b45e8
#  C Compiler dependent settings
kusano 2b45e8
#
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), GCC)
kusano 2b45e8
CCOMMON_OPT += -Wall
kusano 2b45e8
COMMON_PROF += -fno-inline
kusano 2b45e8
NO_UNINITIALIZED_WARN =  -Wno-uninitialized
kusano 2b45e8
kusano 2b45e8
ifdef NO_BINARY_MODE
kusano 2b45e8
kusano 2b45e8
ifeq ($(ARCH), mips64)
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
CCOMMON_OPT += -mabi=64
kusano 2b45e8
else
kusano 2b45e8
CCOMMON_OPT += -mabi=n32
kusano 2b45e8
endif
kusano 2b45e8
BINARY_DEFINED = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(CORE), LOONGSON3A) 
kusano 2b45e8
CCOMMON_OPT += -march=mips64
kusano 2b45e8
FCOMMON_OPT += -march=mips64
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(CORE), LOONGSON3B) 
kusano 2b45e8
CCOMMON_OPT += -march=mips64
kusano 2b45e8
FCOMMON_OPT += -march=mips64
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), AIX)
kusano 2b45e8
BINARY_DEFINED = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef BINARY_DEFINED
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
CCOMMON_OPT += -m64
kusano 2b45e8
else
kusano 2b45e8
CCOMMON_OPT += -m32
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), PGI)
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
CCOMMON_OPT += -tp p7-64
kusano 2b45e8
else
kusano 2b45e8
CCOMMON_OPT += -tp p7
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), PATHSCALE)
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
CCOMMON_OPT += -m64
kusano 2b45e8
else
kusano 2b45e8
CCOMMON_OPT += -m32
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
#
kusano 2b45e8
#  Fortran Compiler dependent settings
kusano 2b45e8
#
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), G77)
kusano 2b45e8
CCOMMON_OPT += -DF_INTERFACE_G77
kusano 2b45e8
FCOMMON_OPT += -Wall
kusano 2b45e8
ifndef NO_BINARY_MODE
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
FCOMMON_OPT += -m64
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -m32
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), G95)
kusano 2b45e8
CCOMMON_OPT += -DF_INTERFACE_G95
kusano 2b45e8
FCOMMON_OPT += -Wall
kusano 2b45e8
ifndef NO_BINARY_MODE
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
FCOMMON_OPT += -m64
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -m32
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), GFORTRAN)
kusano 2b45e8
CCOMMON_OPT += -DF_INTERFACE_GFORT
kusano 2b45e8
FCOMMON_OPT += -Wall
kusano 2b45e8
EXTRALIB += -lgfortran 
kusano 2b45e8
ifdef NO_BINARY_MODE
kusano 2b45e8
ifeq ($(ARCH), mips64)
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
FCOMMON_OPT += -mabi=64
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -mabi=n32
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
else
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
FCOMMON_OPT += -m64
kusano 2b45e8
ifdef INTERFACE64
kusano 2b45e8
FCOMMON_OPT +=  -fdefault-integer-8
kusano 2b45e8
endif
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -m32
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FCOMMON_OPT += -fopenmp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), INTEL)
kusano 2b45e8
CCOMMON_OPT += -DF_INTERFACE_INTEL
kusano 2b45e8
ifdef INTERFACE64
kusano 2b45e8
FCOMMON_OPT += -i8
kusano 2b45e8
endif
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FCOMMON_OPT += -openmp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), FUJITSU)
kusano 2b45e8
CCOMMON_OPT += -DF_INTERFACE_FUJITSU
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FCOMMON_OPT += -openmp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), IBM)
kusano 2b45e8
CCOMMON_OPT += -DF_INTERFACE_IBM
kusano 2b45e8
# FCOMMON_OPT	+= -qarch=440
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
FCOMMON_OPT += -q64
kusano 2b45e8
ifdef INTERFACE64
kusano 2b45e8
FCOMMON_OPT += -qintsize=8
kusano 2b45e8
endif
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -q32
kusano 2b45e8
endif
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FCOMMON_OPT += -openmp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), PGI)
kusano 2b45e8
CCOMMON_OPT  += -DF_INTERFACE_PGI
kusano 2b45e8
COMMON_PROF +=  -DPGICOMPILER
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
ifdef INTERFACE64
kusano 2b45e8
FCOMMON_OPT += -i8
kusano 2b45e8
endif
kusano 2b45e8
FCOMMON_OPT += -tp p7-64
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -tp p7
kusano 2b45e8
endif
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FCOMMON_OPT += -mp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), PATHSCALE)
kusano 2b45e8
CCOMMON_OPT  += -DF_INTERFACE_PATHSCALE
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
ifdef INTERFACE64
kusano 2b45e8
FCOMMON_OPT += -i8
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifneq ($(ARCH), mips64)
kusano 2b45e8
ifndef BINARY64
kusano 2b45e8
FCOMMON_OPT += -m32
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -m64
kusano 2b45e8
endif
kusano 2b45e8
else
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
FCOMMON_OPT += -mabi=64
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -mabi=n32
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FCOMMON_OPT += -mp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), OPEN64)
kusano 2b45e8
CCOMMON_OPT  += -DF_INTERFACE_OPEN64
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
ifdef INTERFACE64
kusano 2b45e8
FCOMMON_OPT += -i8
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
ifndef BINARY64
kusano 2b45e8
FCOMMON_OPT += -m32
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -m64
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FEXTRALIB   += -lstdc++
kusano 2b45e8
FCOMMON_OPT += -mp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), OPEN64)
kusano 2b45e8
ifndef BINARY64
kusano 2b45e8
CCOMMON_OPT += -m32
kusano 2b45e8
else
kusano 2b45e8
CCOMMON_OPT += -m64
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(C_COMPILER), SUN)
kusano 2b45e8
CCOMMON_OPT  += -w
kusano 2b45e8
ifeq ($(ARCH), x86)
kusano 2b45e8
CCOMMON_OPT  += -m32
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT  += -m64
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), SUN)
kusano 2b45e8
CCOMMON_OPT  += -DF_INTERFACE_SUN
kusano 2b45e8
ifeq ($(ARCH), x86)
kusano 2b45e8
FCOMMON_OPT  += -m32
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT  += -m64
kusano 2b45e8
endif
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FCOMMON_OPT += -xopenmp=parallel
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(F_COMPILER), COMPAQ)
kusano 2b45e8
CCOMMON_OPT  += -DF_INTERFACE_COMPAQ
kusano 2b45e8
ifdef USE_OPENMP
kusano 2b45e8
FCOMMON_OPT += -openmp
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
ifdef INTERFACE64
kusano 2b45e8
CCOMMON_OPT	+= 
kusano 2b45e8
#-DUSE64BITINT
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(NEED_PIC), 1)
kusano 2b45e8
ifeq ($(C_COMPILER), IBM)
kusano 2b45e8
CCOMMON_OPT += -qpic=large 
kusano 2b45e8
else
kusano 2b45e8
CCOMMON_OPT += -fPIC 
kusano 2b45e8
endif
kusano 2b45e8
ifeq ($(F_COMPILER), SUN)
kusano 2b45e8
FCOMMON_OPT  += -pic
kusano 2b45e8
else
kusano 2b45e8
FCOMMON_OPT += -fPIC 
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(DYNAMIC_ARCH), 1)
kusano 2b45e8
CCOMMON_OPT	+= -DDYNAMIC_ARCH
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(NO_LAPACK), 1)
kusano 2b45e8
CCOMMON_OPT	+= -DNO_LAPACK
kusano 2b45e8
#Disable LAPACK C interface
kusano 2b45e8
NO_LAPACKE = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(NO_LAPACKE), 1)
kusano 2b45e8
CCOMMON_OPT	+= -DNO_LAPACKE
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef SMP
kusano 2b45e8
CCOMMON_OPT	+= -DSMP_SERVER
kusano 2b45e8
kusano 2b45e8
ifeq ($(ARCH), mips64)
kusano 2b45e8
ifneq ($(CORE), LOONGSON3B)
kusano 2b45e8
USE_SIMPLE_THREADED_LEVEL3 = 1
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(USE_OPENMP), 1)
kusano 2b45e8
# USE_SIMPLE_THREADED_LEVEL3 = 1
kusano 2b45e8
# NO_AFFINITY = 1
kusano 2b45e8
CCOMMON_OPT	+= -DUSE_OPENMP
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(NO_WARMUP), 1)
kusano 2b45e8
CCOMMON_OPT	+= -DNO_WARMUP
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(CONSISTENT_FPCSR), 1)
kusano 2b45e8
CCOMMON_OPT	+= -DCONSISTENT_FPCSR
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
# Only for development
kusano 2b45e8
# CCOMMON_OPT	 += -DPARAMTEST
kusano 2b45e8
# CCOMMON_OPT	 += -DPREFETCHTEST
kusano 2b45e8
# CCOMMON_OPT	 += -DNO_SWITCHING
kusano 2b45e8
# USE_PAPI = 1
kusano 2b45e8
kusano 2b45e8
ifdef USE_PAPI
kusano 2b45e8
CCOMMON_OPT	 += -DUSE_PAPI
kusano 2b45e8
EXTRALIB	 += -lpapi -lperfctr
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef DYNAMIC_THREADS
kusano 2b45e8
CCOMMON_OPT	 += -DDYNAMIC_THREADS
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
CCOMMON_OPT	+= -DMAX_CPU_NUMBER=$(NUM_THREADS)
kusano 2b45e8
kusano 2b45e8
ifdef USE_SIMPLE_THREADED_LEVEL3
kusano 2b45e8
CCOMMON_OPT	+= -DUSE_SIMPLE_THREADED_LEVEL3
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef LIBNAMESUFFIX
kusano 2b45e8
LIBPREFIX = libopenblas
kusano 2b45e8
else
kusano 2b45e8
LIBPREFIX = libopenblas_$(LIBNAMESUFFIX)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
KERNELDIR	= $(TOPDIR)/kernel/$(ARCH)
kusano 2b45e8
kusano 2b45e8
include $(TOPDIR)/Makefile.$(ARCH)
kusano 2b45e8
kusano 2b45e8
CCOMMON_OPT	+= -DASMNAME=$(FU)$(*F) -DASMFNAME=$(FU)$(*F)$(BU) -DNAME=$(*F)$(BU) -DCNAME=$(*F) -DCHAR_NAME=\"$(*F)$(BU)\" -DCHAR_CNAME=\"$(*F)\"
kusano 2b45e8
kusano 2b45e8
ifeq ($(CORE), PPC440)
kusano 2b45e8
CCOMMON_OPT	+= -DALLOC_QALLOC
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(CORE), PPC440FP2)
kusano 2b45e8
STATIC_ALLOCATION = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifneq ($(OSNAME), Linux)
kusano 2b45e8
NO_AFFINITY = 1
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifneq ($(ARCH), x86_64)
kusano 2b45e8
ifneq ($(ARCH), x86)
kusano 2b45e8
ifneq ($(CORE), LOONGSON3B)
kusano 2b45e8
NO_AFFINITY = 1
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef NO_AFFINITY
kusano 2b45e8
CCOMMON_OPT	+= -DNO_AFFINITY
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef FUNCTION_PROFILE
kusano 2b45e8
CCOMMON_OPT	+= -DFUNCTION_PROFILE
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef HUGETLB_ALLOCATION
kusano 2b45e8
CCOMMON_OPT	+= -DALLOC_HUGETLB
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef HUGETLBFILE_ALLOCATION
kusano 2b45e8
CCOMMON_OPT	+= -DALLOC_HUGETLBFILE -DHUGETLB_FILE_NAME=$(HUGETLBFILE_ALLOCATION)
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef STATIC_ALLOCATION
kusano 2b45e8
CCOMMON_OPT	+= -DALLOC_STATIC
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef DEVICEDRIVER_ALLOCATION
kusano 2b45e8
CCOMMON_OPT	+= -DALLOC_DEVICEDRIVER -DDEVICEDRIVER_NAME=\"/dev/mapper\"
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifdef MIXED_MEMORY_ALLOCATION
kusano 2b45e8
CCOMMON_OPT	+= -DMIXED_MEMORY_ALLOCATION
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifeq ($(OSNAME), SunOS)
kusano 2b45e8
TAR	= gtar
kusano 2b45e8
PATCH	= gpatch
kusano 2b45e8
GREP	= ggrep
kusano 2b45e8
else
kusano 2b45e8
TAR	= tar
kusano 2b45e8
PATCH	= patch
kusano 2b45e8
GREP	= grep
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef MD5SUM
kusano 2b45e8
MD5SUM	= md5sum
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
AWK	= awk
kusano 2b45e8
kusano 2b45e8
REVISION = -r$(VERSION)
kusano 2b45e8
MAJOR_VERSION = $(word 1,$(subst ., ,$(VERSION)))
kusano 2b45e8
kusano 2b45e8
CFLAGS     = $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR)
kusano 2b45e8
PFLAGS     = $(COMMON_OPT) $(CCOMMON_OPT) -I$(TOPDIR) -DPROFILE $(COMMON_PROF)
kusano 2b45e8
kusano 2b45e8
FFLAGS     = $(COMMON_OPT) $(FCOMMON_OPT)
kusano 2b45e8
FPFLAGS    = $(COMMON_OPT) $(FCOMMON_OPT) $(COMMON_PROF)
kusano 2b45e8
kusano 2b45e8
ifndef SUFFIX
kusano 2b45e8
SUFFIX  = o
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef PSUFFIX
kusano 2b45e8
PSUFFIX = po
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef LIBSUFFIX
kusano 2b45e8
LIBSUFFIX = a
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ifndef DYNAMIC_ARCH
kusano 2b45e8
ifndef SMP
kusano 2b45e8
LIBNAME		= $(LIBPREFIX)_$(LIBCORE)$(REVISION).$(LIBSUFFIX)
kusano 2b45e8
LIBNAME_P	= $(LIBPREFIX)_$(LIBCORE)$(REVISION)_p.$(LIBSUFFIX)
kusano 2b45e8
else
kusano 2b45e8
LIBNAME		= $(LIBPREFIX)_$(LIBCORE)p$(REVISION).$(LIBSUFFIX)
kusano 2b45e8
LIBNAME_P	= $(LIBPREFIX)_$(LIBCORE)p$(REVISION)_p.$(LIBSUFFIX)
kusano 2b45e8
endif
kusano 2b45e8
else
kusano 2b45e8
ifndef SMP
kusano 2b45e8
LIBNAME		= $(LIBPREFIX)$(REVISION).$(LIBSUFFIX)
kusano 2b45e8
LIBNAME_P	= $(LIBPREFIX)$(REVISION)_p.$(LIBSUFFIX)
kusano 2b45e8
else
kusano 2b45e8
LIBNAME		= $(LIBPREFIX)p$(REVISION).$(LIBSUFFIX)
kusano 2b45e8
LIBNAME_P	= $(LIBPREFIX)p$(REVISION)_p.$(LIBSUFFIX)
kusano 2b45e8
endif
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
LIBSONAME    = $(LIBNAME:.$(LIBSUFFIX)=.so)
kusano 2b45e8
LIBDLLNAME   = $(LIBNAME:.$(LIBSUFFIX)=.dll)
kusano 2b45e8
LIBDYNNAME   = $(LIBNAME:.$(LIBSUFFIX)=.dylib)
kusano 2b45e8
LIBDEFNAME   = $(LIBNAME:.$(LIBSUFFIX)=.def)
kusano 2b45e8
LIBEXPNAME   = $(LIBNAME:.$(LIBSUFFIX)=.exp)
kusano 2b45e8
LIBZIPNAME   = $(LIBNAME:.$(LIBSUFFIX)=.zip)
kusano 2b45e8
kusano 2b45e8
LIBS		= $(TOPDIR)/$(LIBNAME)
kusano 2b45e8
LIBS_P		= $(TOPDIR)/$(LIBNAME_P)
kusano 2b45e8
kusano 2b45e8
export OSNAME
kusano 2b45e8
export ARCH
kusano 2b45e8
export CORE
kusano 2b45e8
export LIBCORE
kusano 2b45e8
export PGCPATH
kusano 2b45e8
export CONFIG
kusano 2b45e8
export CC
kusano 2b45e8
export FC
kusano 2b45e8
export BU
kusano 2b45e8
export FU
kusano 2b45e8
export USE_THREAD
kusano 2b45e8
export NUM_THREADS
kusano 2b45e8
export NUM_CORES
kusano 2b45e8
export SMP
kusano 2b45e8
export MAKEFILE_RULE
kusano 2b45e8
export NEED_PIC
kusano 2b45e8
export BINARY
kusano 2b45e8
export BINARY32
kusano 2b45e8
export BINARY64
kusano 2b45e8
export F_COMPILER
kusano 2b45e8
export C_COMPILER
kusano 2b45e8
export USE_OPENMP
kusano 2b45e8
export CROSS
kusano 2b45e8
export CROSS_SUFFIX
kusano 2b45e8
export NOFORTRAN
kusano 2b45e8
export EXTRALIB
kusano 2b45e8
export CEXTRALIB
kusano 2b45e8
export FEXTRALIB
kusano 2b45e8
export HAVE_SSE
kusano 2b45e8
export HAVE_SSE2
kusano 2b45e8
export HAVE_SSE3
kusano 2b45e8
export HAVE_SSSE3
kusano 2b45e8
export HAVE_SSE4_1
kusano 2b45e8
export HAVE_SSE4_2
kusano 2b45e8
export HAVE_SSE4A
kusano 2b45e8
export HAVE_SSE5
kusano 2b45e8
export KERNELDIR
kusano 2b45e8
export FUNCTION_PROFILE
kusano 2b45e8
export TARGET_CORE
kusano 2b45e8
kusano 2b45e8
export SGEMM_UNROLL_M
kusano 2b45e8
export SGEMM_UNROLL_N
kusano 2b45e8
export DGEMM_UNROLL_M
kusano 2b45e8
export DGEMM_UNROLL_N
kusano 2b45e8
export QGEMM_UNROLL_M
kusano 2b45e8
export QGEMM_UNROLL_N
kusano 2b45e8
export CGEMM_UNROLL_M
kusano 2b45e8
export CGEMM_UNROLL_N
kusano 2b45e8
export ZGEMM_UNROLL_M
kusano 2b45e8
export ZGEMM_UNROLL_N
kusano 2b45e8
export XGEMM_UNROLL_M
kusano 2b45e8
export XGEMM_UNROLL_N
kusano 2b45e8
kusano 2b45e8
ifdef USE_CUDA
kusano 2b45e8
export CUDADIR
kusano 2b45e8
export CUCC
kusano 2b45e8
export CUFLAGS
kusano 2b45e8
export CULIB
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
.SUFFIXES: .$(PSUFFIX) .$(SUFFIX) .f
kusano 2b45e8
kusano 2b45e8
.f.$(SUFFIX):
kusano 2b45e8
	$(FC) $(FFLAGS) -c $<  -o $(@F)
kusano 2b45e8
kusano 2b45e8
.f.$(PSUFFIX):
kusano 2b45e8
	$(FC) $(FPFLAGS) -pg -c $<  -o $(@F)
kusano 2b45e8
kusano 2b45e8
kusano 2b45e8
ifdef BINARY64
kusano 2b45e8
PATHSCALEPATH	= /opt/pathscale/lib/3.1
kusano 2b45e8
PGIPATH		= /opt/pgi/linux86-64/7.1-5/lib
kusano 2b45e8
else
kusano 2b45e8
PATHSCALEPATH	= /opt/pathscale/lib/3.1/32
kusano 2b45e8
PGIPATH		= /opt/pgi/linux86/7.1-5/lib
kusano 2b45e8
endif
kusano 2b45e8
kusano 2b45e8
ACMLPATH	= /opt/acml/4.3.0
kusano 2b45e8
ifneq ($(OSNAME), Darwin)
kusano 2b45e8
MKLPATH         = /opt/intel/mkl/10.2.2.025/lib
kusano 2b45e8
else
kusano 2b45e8
MKLPATH         = /Library/Frameworks/Intel_MKL.framework/Versions/10.0.1.014/lib
kusano 2b45e8
endif
kusano 2b45e8
ATLASPATH	= /opt/atlas/3.9.17/opteron
kusano 2b45e8
FLAMEPATH	= $(HOME)/flame/lib
kusano 2b45e8
ifneq ($(OSNAME), SunOS)
kusano 2b45e8
SUNPATH		= /opt/sunstudio12.1
kusano 2b45e8
else
kusano 2b45e8
SUNPATH		= /opt/SUNWspro
kusano 2b45e8
endif
kusano 2b45e8