#######################################################################
# This makefile is part of the package for solving rank deficient
# least squares problems. 
# ==================================================================
#     L. Foster                   and   R. Kommu
#     Department of Mathematics         Department of Physics
#     San Jose State University         San Jose State University
#     San Jose, CA 95192                San Jose, CA 95192
#     foster@math.sjsu.edu              rkommu@email.sjsu.edu
# ==================================================================
# 03/05/2004
#
#  This is the makefile to create a library of the least squares
#  routines from LAPACK and xGELSZ that have been instrumented to time
#  specific parts of the code and count operations. 
#  The files are organized as follows:
#
#     SLINSRC -- Single precision real instrumented routines
#     CLINSRC -- Single precision complex instrumented routines
#     DLINSRC -- Double precision real instrumented routines
#     ZLINSRC -- Double precision complex instrumented routines
#
#  The library can be set up to include routines for any combination
#  of the four precisions.  To create or add to the library, enter
#  make -f makeunix followed by one or more of the precisions desired.
#  Some examples:
#       make -f makeunix single
#       make -f makeunix single complex
#       make -f makeunix single double complex complex16
#  Alternatively, the command
#       make -f makeunix
#  without any arguments creates a library of all four precisions.
#  The library is called
#       linsrc.a
#  and is created at the next higher directory level.
#
#  To remove the object files after the library is created, enter
#       make -f makeunix clean
#
# Please refer to the readme file in XGELSZ/INSTALL for 
# further documentation on the use of makefiles in the package.
#######################################################################
include ../../../make.inc

TIMLINSRC = $(LAPACK)/TIMING/LIN/LINSRC

SCAUX = sopla.o sopla2.o

DZAUX = dopla.o dopla2.o
 
SLINSRC = \
   sgels.o  sgelsd.o sgelss.o sgelsx.o sgelsy.o sgelsz.o slaic1.o slals0.o \
   slalsa.o slalsd.o

CLINSRC = \
   cgels.o  cgelsd.o cgelss.o cgelsx.o cgelsy.o cgelsz.o claic1.o clals0.o \
   clalsa.o clalsd.o

DLINSRC = \
   dgels.o  dgelsd.o dgelss.o dgelsx.o dgelsy.o dgelsz.o dlaic1.o dlals0.o \
   dlalsa.o dlalsd.o

ZLINSRC = \
   zgels.o  zgelsd.o zgelss.o zgelsx.o zgelsy.o zgelsz.o zlaic1.o zlals0.o \
   zlalsa.o zlalsd.o

all: single complex double complex16

single: $(SLINSRC) $(SCAUX)
	$(ARCH) $(ARCHFLAGS) ../$(LINSRCLIB) $(SLINSRC) $(SCAUX)
	$(RANLIB) ../$(LINSRCLIB)

complex: $(CLINSRC) $(SCAUX)
	$(ARCH) $(ARCHFLAGS) ../$(LINSRCLIB) $(CLINSRC) $(SCAUX)
	$(RANLIB) ../$(LINSRCLIB)

double: $(DLINSRC) $(DZAUX)
	$(ARCH) $(ARCHFLAGS) ../$(LINSRCLIB) $(DLINSRC) $(DZAUX)
	$(RANLIB) ../$(LINSRCLIB)

complex16: $(ZLINSRC) $(DZAUX)
	$(ARCH) $(ARCHFLAGS) ../$(LINSRCLIB) $(ZLINSRC) $(DZAUX)
	$(RANLIB) ../$(LINSRCLIB)

clean:
	rm -f *.o
	
sgelsz.o: sgelsz.f
	$(FORTRAN) $(OPTS) -c $?
sopla.o: sopla.f
	$(FORTRAN) $(OPTS) -c $?
cgelsz.o: cgelsz.f
	$(FORTRAN) $(OPTS) -c $?
dgelsz.o: dgelsz.f
	$(FORTRAN) $(OPTS) -c $?
dopla.o: dopla.f
	$(FORTRAN) $(OPTS) -c $?
zgelsz.o: zgelsz.f
	$(FORTRAN) $(OPTS) -c $?

.SUFFIXES: .f .o
%.o: $(TIMLINSRC)/%.f
	$(FORTRAN) $(OPTS) -c $< 
