###
#
# @file Makefile
#
#  PLASMA is a software package provided by Univ. of Tennessee,
#  Univ. of California Berkeley and Univ. of Colorado Denver
#
# @version 2.2.0
# @author Bilel Hadri
# @date 2009-11-15
#
###

PLASMA_DIR = ..
include ../Makefile.internal

NAMESC = gelqf  gels   geqrs  getrs  potrf  trsm   \
         gelqs  geqrf  gesv   posv   potrs  trsmpl

NAMESF = posv_f gesv_f gels_f

ZCSRC = $(NAMESC:%=example_z%.c) example_zunmqr.c example_zunmlq.c
CCSRC = $(NAMESC:%=example_c%.c) example_cunmqr.c example_cunmlq.c
DCSRC = $(NAMESC:%=example_d%.c) example_dormqr.c example_dormlq.c
SCSRC = $(NAMESC:%=example_s%.c) example_sormqr.c example_sormlq.c

ZFSRC = $(NAMESF:%=example_z%.f) 
CFSRC = $(NAMESF:%=example_c%.f) 
DFSRC = $(NAMESF:%=example_d%.f) 
SFSRC = $(NAMESF:%=example_s%.f) 

CSRC  = $(ZCSRC) $(CCSRC) $(DCSRC) $(SCSRC)
FSRC  = $(ZFSRC) $(CFSRC) $(DFSRC) $(SFSRC)
OBJ   = $(CSRC:.c=.o) $(FSRC:.f=.o)
EXE   = $(OBJ:.o=)

all: $(EXE)

clean:
	rm -f $(OBJ) 

cleanall: clean
	rm -f $(EXE)

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

.f.o:
	$(FC) $(FFLAGS) $(INC) -c $< -o $@

example_% : example_%.o $(LIBCOREBLAS) $(LIBPLASMA) $(QUARKDIR)/libquark.a
	$(LOADER) $(LDFLAGS) $< -o $@ $(LIB)

.PHONY: clean cleanall

