############################################################################
#
#  Program:         ScaLAPACK
#
#  Module:          Makefile
#
#  Purpose:         PBLAS Sources Makefile
#
#  Creation date:   March 20, 1995
#
#  Modified:
#
#  Send bug reports, comments or suggestions to scalapack@cs.utk.edu
#
############################################################################

include ../../SLmake.inc

############################################################################
#  This is the makefile to create a library for the PBLAS.
#  The files are grouped as follows:
#
#      PSBLAS1 -- Single precision real PBLAS1 routines
#      PCBLAS1 -- Single precision complex PBLAS1 routines
#      PDBLAS1 -- Double precision real PBLAS1 routines
#      PZBLAS1 -- Double precision complex PBLAS1 routines
#
#      PSBLAS2 -- Single precision real PBLAS2 routines
#      PCBLAS2 -- Single precision complex PBLAS2 routines
#      PDBLAS2 -- Double precision real PBLAS2 routines
#      PZBLAS2 -- Double precision complex PBLAS2 routines
#
#      PSBLAS3 -- Single precision real PBLAS3 routines
#      PCBLAS3 -- Single precision complex PBLAS3 routines
#      PDBLAS3 -- Double precision real PBLAS3 routines
#      PZBLAS3 -- Double precision complex PBLAS3 routines
#
#  The library can be set up to include routines for any combination
#  of the four precisions.  First, modify the ../../SLmake.inc file
#  definitions to match your compiler and the options to be used.
#  Then to create or add to the library, enter make followed by one or
#  more of the precisions desired.  Some examples:
#       make single
#       make single complex
#       make single double complex complex16
#  Alternatively, the command
#       make
#  without any arguments creates a library of all four precisions.
#  The library is called
#       pblas_$(plat).a 
#  (see ../../SLmake.inc for the definition of $(plat)).
#
#  To remove the object files after the library is created, enter
#       make clean
#  To force the source files to be recompiled, enter, for example,
#       make single FRC=FRC
#
############################################################################

all: single double complex complex16

#---------------------------------------------------------------------------
#  Comment out the next 4 definitions if you already have the Level 1 PBLAS.
#---------------------------------------------------------------------------

PSBLAS1 = psswap_.o psscal_.o  pscopy_.o  psaxpy_.o psdot_.o  psnrm2_.o \
          psasum_.o psamax_.o
$(PSBLAS1): $(FRC)

PCBLAS1 = pcswap_.o pcscal_.o  pcsscal_.o pccopy_.o pcaxpy_.o pcdotu_.o \
          pcdotc_.o pscnrm2_.o pscasum_.o pcamax_.o
$(PCBLAS1): $(FRC)

PDBLAS1 = pdswap_.o pdscal_.o  pdcopy_.o  pdaxpy_.o pddot_.o  pdnrm2_.o \
          pdasum_.o pdamax_.o
$(PDBLAS1): $(FRC)

PZBLAS1 = pzswap_.o pzscal_.o  pzdscal_.o pzcopy_.o pzaxpy_.o pzdotu_.o \
          pzdotc_.o pdznrm2_.o pdzasum_.o pzamax_.o
$(PZBLAS1): $(FRC)

#---------------------------------------------------------------------------
#  Comment out the next 4 definitions if you already have the Level 2 PBLAS.
#---------------------------------------------------------------------------

PSBLAS2 = psgemv_.o psger_.o  pssymv_.o pssyr_.o  pssyr2_.o pstrmv_.o \
          pstrsv_.o
$(PSBLAS2): $(FRC)

PCBLAS2 = pcgemv_.o pcgerc_.o pcgeru_.o pchemv_.o pcher_.o  pcher2_.o \
          pctrmv_.o pctrsv_.o
$(PCBLAS2): $(FRC)

PDBLAS2 = pdgemv_.o pdger_.o  pdsymv_.o pdsyr_.o  pdsyr2_.o pdtrmv_.o \
          pdtrsv_.o
$(PDBLAS2): $(FRC)

PZBLAS2 = pzgemv_.o pzgerc_.o pzgeru_.o pzhemv_.o pzher_.o  pzher2_.o \
          pztrmv_.o pztrsv_.o
$(PZBLAS2): $(FRC)

#---------------------------------------------------------------------------
#  Comment out the next 4 definitions if you already have the Level 3 PBLAS.
#---------------------------------------------------------------------------

PSBLAS3 = psgemm_.o pssymm_.o  pssyr2k_.o pssyrk_.o pstran_.o pstrmm_.o  \
          pstrsm_.o
$(PSBLAS3): $(FRC)

PCBLAS3 = pcgemm_.o pchemm_.o  pcher2k_.o pcherk_.o pcsymm_.o pcsyr2k_.o \
          pcsyrk_.o pctranc_.o pctranu_.o pctrmm_.o pctrsm_.o
$(PCBLAS3): $(FRC)

PDBLAS3 = pdgemm_.o pdsymm_.o  pdsyr2k_.o pdsyrk_.o pdtran_.o pdtrmm_.o  \
          pdtrsm_.o
$(PDBLAS3): $(FRC)

PZBLAS3 = pzgemm_.o pzhemm_.o  pzher2k_.o pzherk_.o pzsymm_.o pzsyr2k_.o \
          pzsyrk_.o pztranc_.o pztranu_.o pztrmm_.o pztrsm_.o
$(PZBLAS3): $(FRC)

PSBLAS = $(PSBLASAUX) $(PSBLAS1) $(PSBLAS2) $(PSBLAS3)
PCBLAS = $(PCBLASAUX) $(PCBLAS1) $(PCBLAS2) $(PCBLAS3)
PDBLAS = $(PDBLASAUX) $(PDBLAS1) $(PDBLAS2) $(PDBLAS3)
PZBLAS = $(PZBLASAUX) $(PZBLAS1) $(PZBLAS2) $(PZBLAS3)

pbbsblas:
	( cd INTERNAL/PBBLAS; $(MAKE) single FRC=$(FRC) )

pbbdblas:
	( cd INTERNAL/PBBLAS; $(MAKE) double FRC=$(FRC) )

pbbcblas:
	( cd INTERNAL/PBBLAS; $(MAKE) complex FRC=$(FRC) )

pbbzblas:
	( cd INTERNAL/PBBLAS; $(MAKE) complex16 FRC=$(FRC) )

sptools:
	( cd INTERNAL/PTOOLS; $(MAKE) single )

dptools:
	( cd INTERNAL/PTOOLS; $(MAKE) double )

cptools:
	( cd INTERNAL/PTOOLS; $(MAKE) complex )

zptools:
	( cd INTERNAL/PTOOLS; $(MAKE) complex16 )

single: sptools pbbsblas $(PSBLAS)
	$(ARCH) $(ARCHFLAGS) $(PBLASLIB) $(PSBLAS)
	$(RANLIB) $(PBLASLIB)

double: dptools pbbdblas $(PDBLAS)
	$(ARCH) $(ARCHFLAGS) $(PBLASLIB) $(PDBLAS)
	$(RANLIB) $(PBLASLIB)

complex: cptools pbbcblas $(PCBLAS)
	$(ARCH) $(ARCHFLAGS) $(PBLASLIB) $(PCBLAS)
	$(RANLIB) $(PBLASLIB)

complex16: zptools pbbzblas $(PZBLAS)
	$(ARCH) $(ARCHFLAGS) $(PBLASLIB) $(PZBLAS)
	$(RANLIB) $(PBLASLIB)

FRC:
	@FRC=$(FRC)

clean :
	( cd INTERNAL/PTOOLS; $(MAKE) clean )
	( cd INTERNAL/PBBLAS; $(MAKE) clean )
	rm -f *.o

.c.o : ; $(CC) -c $(CCFLAGS) $(CDEFS) $*.c
