#//////////////////////////////////////////////////////////////////////////////
#   -- micMAGMA (version 0.1) --
#      Univ. of Tennessee, Knoxville
#      Univ. of California, Berkeley
#      Univ. of Colorado, Denver
#      April 2012
#//////////////////////////////////////////////////////////////////////////////

MAGMA_DIR = ..
include ../Makefile.internal

INC += -I$(MAGMA_DIR)/control

# ------------------------------------------------------------
# Loosely, the order is alphabetic in each section, but mixed precision,
# driver, and multi-MIC routines are separated where it made sense.
# Double precision "d" files that generate "s" files must also be listed
# in ZSRC, despite the name.

# ----------
# Cholesky, MIC interface
ZSRC += \
	zposv_mic.cpp      \
	zpotrf10_mic.cpp   \
	zpotrf8_mmic.cpp   \
	zpotrs_mic.cpp     \

# Cholesky, CPU interface
ZSRC += \
	zposv.cpp          \
	zpotrf.cpp         \
	zpotrf3.cpp        \

# ----------
# LU, MIC interface
ZSRC += \
	zcgesv_mic.cpp     \
	zgesv_mic.cpp      \
	zgetri_mic.cpp    \
	ztrtri_mic.cpp    \
	zgetrf7_mic.cpp    \
	zgetrf4_mmic.cpp   \
	zgetrs_mic.cpp     \

# LU, CPU interface
ZSRC += \
	zcgesv.cpp         \
	zgesv.cpp          \
	zgetrf1.cpp        \
	zgetrf2.cpp        \
	zgetrf3.cpp        \

# ----------
# QR and least squares, MIC interface
ZSRC += \
	zgels_mic.cpp      \
	zgeqrs_mic.cpp     \
	zgeqrf_mic.cpp     \
	zgeqrf10_mic.cpp   \
	zgeqrf6_mmic.cpp   \
	zlarfb_mic.cpp     \
	zunmqr_mic.cpp     \

# QR, CPU interface
ZSRC += \
	zgeqrf.cpp         \
	zgeqrf3.cpp        \
	zungqr.cpp         \
	zungqr2.cpp        \
	zunmql.cpp         \
	zunmqr.cpp         \

# ---------- 
# Auxiliary BLAS
ZSRC += \
	zher2k_mmic.cpp    \
	zherk_mmic.cpp     \

# ----------  
# non-symmetric eigenvalues
ZSRC += \
	dgeev.cpp          \
	zgeev.cpp          \
	zgehrd.cpp         \
	zlahru.cpp         \
	zlahr2.cpp         \
	zunghr.cpp         \

# ----------
# symmetric eigenvalues
ZSRC += \
	dsyevd.cpp         \
	zheevd.cpp         \
	zhetrd.cpp         \
	zlatrd.cpp         \
	zhetrd_he2hb.cpp   \
	\
	dlaex0.cpp         \
	dlaex1.cpp         \
	dlaex3.cpp         \
	dstedx.cpp         \
	zstedx.cpp         \
	zunmtr.cpp         \

# ----------
# SVD
ZSRC += \
	dgesvd.cpp         \
	zgesvd.cpp         \
	zgebrd.cpp         \
	zlabrd_mic.cpp     \


-include Makefile.src

ALLSRC = $(ZSRC) $(CSRC) $(DSRC) $(SSRC)
ALLOBJ = $(ALLSRC:.cpp=.o) $(ALLSRC:.f=.o)

all: $(LIBMAGMA)

$(LIBMAGMA): $(ALLOBJ)
	$(ARCH) $(ARCHFLAGS) $@ $(ALLOBJ)
	$(RANLIB) $@

.cpp.o:
	$(CC) $(OPTS) $(INC) -c $< -o $@

.f.o:
	$(FORT) $(OPTS) $(INC) -c $< -o $@

clean:
	rm -f *.o *~ *.linkinfo

cleanall: clean
	rm -f *.a
	rm -f $(LIBMAGMA)
