################################################################################
#
#  Copyright (C) 2007      University of Toronto
#
#  author     : lessig@dgp.toronto.edu
#  
#  project    : MRRR
#  
################################################################################

# Add source files here
EXECUTABLE	:= mrrr
# Cuda source files (compiled with cudacc)
CUFILES		:= \
	mrrr.cu \
	result_data.cu \
	input_data.cu \
	exec.cu \
	check_ortho_evecs.cu 

# C/C++ source files (compiled with gcc / c++)
CCFILES		:= \
	gerschgorin.cpp \
	sturm_count.cpp \
	ldl.cpp \
	post_process.cpp \
	pre_process.cpp \
	split_matrix.cpp \
	matlab.cpp \
	check_eigenvalues.cpp \
	inc/check_eigen_decomp.cpp 

# dependencies
C_DEPS := \
	inc/config.h \
	inc/util.h \
	inc/gerschgorin.h \
	inc/sturm_count.h \
	inc/ldl.h \
	inc/matlab.h \
	inc/cuda_array_2d.h \
	inc/mrrr_cpu.h \
	inc/post_process.h \
	inc/pre_process.h \
	inc/split_matrix.h \
	inc/check_eigenvalues.h \
	inc/check_eigen_decomp.h \
	inc/check_ortho_evecs.h 

CU_DEPS := \
	inc/input_data.h \
	inc/result_data.h \
	inc/exec.h \
	kernel/shared_mem.cu \
	kernel/sturm_count_kernel.cu \
	kernel/bisect_kernel.cu \
	kernel/bisect_kernel_util.cu \
	kernel/mrrr_kernel.cu \
	kernel/mrrr_kernel_util.cu \
	kernel/qds_kernel.cu \
	kernel/eigenvector_kernel.cu \
	kernel/check_ortho_kernel.cu \
	$(C_DEPS) 

# additional include directories
INCLUDES += -I./inc  -I./kernel

ifeq ($(noclapack), 1)
	LIB :=
	COMMONFLAGS := -DNOLAPACK
else
	LAPACK_LIB_DIR := ./clapack/
	LIB := $(LAPACK_LIB_DIR)/lapack_LINUX.a \
				$(LAPACK_LIB_DIR)/blas_LINUX.a \
				$(LAPACK_LIB_DIR)/tmglib_LINUX.a \
				$(LAPACK_LIB_DIR)/libF77.a \
			 	$(LAPACK_LIB_DIR)/libI77.a \
				$(LAPACK_LIB_DIR)/libf2c.a
	
	CCFILES += \
		mrrr_cpu.cpp 
endif

LIB += -lm

MAKEFLAGS = -e
maxregisters=16
fastmath=1
dbg=1
emu=1
verbose=1

ifeq ($(dbg),1)
	COMMONFLAGS += -DDEBUG
endif


################################################################################
# Rules and targets

include ../../common/common.mk

