#######################################################################
# 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 makefile creates programs that generate the data for the
#  examples in the figures in the paper by Foster and Kommu.
#  To run the makefile:
#       make -f makeunix
#  The executable files are called:
#       cfig12, dfig12, sfig12, zfig12, cfig3, dfig3, sfig3 and zfig3
#  and exist in the current directory level.
#
#  The makefile does not run these executable but they can be run
#  by typing, for example,
#       xfig12 < fig12.in (where x is c, d, s or z) or
#       xfig3  < fig3.in  (where x is c, d, s or z).
#
#  To remove the executable, object and output files after the examples
#  have been run, type:
#       make -f makeunix clean
# 
# Please refer to the readme file in XGELSZ/INSTALL for 
# further documentation on the use of this makefile.
#######################################################################

include ../make.inc

all : single complex double complex16 

single : sfig12 sfig3

complex : cfig12 cfig3

double : dfig12 dfig3 

complex16: zfig12 zfig3

sfig12 : sfig12.o sqrt25.o slaord.o slarnd.o slaror.o slaran.o \
sqrt12.o sqrt14.o sqrt16.o sqrt17.o
	$(LOADER) ${LOADOPTS} sfig12.o sqrt25.o slaord.o slarnd.o slaror.o slaran.o \
	sqrt12.o sqrt14.o sqrt16.o sqrt17.o \
	../${LAPACKLIB} ${BLASLIB} -o $@
  
sfig3 : sfig3.o sqrt25.o slaord.o slarnd.o slaror.o slaran.o \
sqrt12.o sqrt14.o sqrt16.o sqrt17.o
	$(LOADER) ${LOADOPTS} sfig3.o sqrt25.o slaord.o slarnd.o slaror.o slaran.o \
	sqrt12.o sqrt14.o sqrt16.o sqrt17.o \
	../${LAPACKLIB} ${BLASLIB} -o $@
  
cfig12 : cfig12.o cqrt25.o slaord.o slarnd.o clarnd.o claror.o slaran.o \
cqrt12.o cqrt14.o cqrt16.o cqrt17.o
	$(LOADER) ${LOADOPTS} cfig12.o cqrt25.o slaord.o slarnd.o clarnd.o claror.o \
	slaran.o cqrt12.o cqrt14.o cqrt16.o cqrt17.o \
	../${LAPACKLIB} ${BLASLIB} -o $@
  
cfig3 : cfig3.o cqrt25.o slaord.o slarnd.o clarnd.o claror.o slaran.o \
cqrt12.o cqrt14.o cqrt16.o cqrt17.o
	$(LOADER) ${LOADOPTS} cfig3.o cqrt25.o slaord.o slarnd.o clarnd.o claror.o \
	slaran.o cqrt12.o cqrt14.o cqrt16.o cqrt17.o \
	../${LAPACKLIB} ${BLASLIB} -o $@

dfig12 : dfig12.o dqrt25.o dlaord.o dlarnd.o dlaror.o dlaran.o \
dqrt12.o dqrt14.o dqrt16.o dqrt17.o
	$(LOADER) ${LOADOPTS} dfig12.o dqrt25.o dlaord.o dlarnd.o dlaror.o dlaran.o \
	dqrt12.o dqrt14.o dqrt16.o dqrt17.o \
	../${LAPACKLIB} ${BLASLIB} -o $@
  
dfig3 : dfig3.o dqrt25.o dlaord.o dlarnd.o dlaror.o dlaran.o \
dqrt12.o dqrt14.o dqrt16.o dqrt17.o
	$(LOADER) ${LOADOPTS} dfig3.o dqrt25.o dlaord.o dlarnd.o dlaror.o dlaran.o \
	dqrt12.o dqrt14.o dqrt16.o dqrt17.o \
	../${LAPACKLIB} ${BLASLIB} -o $@
  
zfig12 : zfig12.o zqrt25.o dlaord.o dlarnd.o zlarnd.o zlaror.o dlaran.o \
zqrt12.o zqrt14.o zqrt16.o zqrt17.o
	$(LOADER) ${LOADOPTS} zfig12.o zqrt25.o dlaord.o dlarnd.o zlarnd.o zlaror.o \
	dlaran.o zqrt12.o zqrt14.o zqrt16.o zqrt17.o \
	../${LAPACKLIB} ${BLASLIB} -o $@
  
zfig3 : zfig3.o zqrt25.o dlaord.o dlarnd.o zlarnd.o zlaror.o dlaran.o \
zqrt12.o zqrt14.o zqrt16.o zqrt17.o
	$(LOADER) ${LOADOPTS} zfig3.o zqrt25.o dlaord.o dlarnd.o zlarnd.o zlaror.o \
	dlaran.o zqrt12.o zqrt14.o zqrt16.o zqrt17.o \
	../${LAPACKLIB} ${BLASLIB} -o $@

sfig12.o : sfig12.f
	${FORTRAN} ${OPTS} -c $?
  
sfig3.o : sfig3.f
	${FORTRAN} ${OPTS} -c $?

sqrt25.o : sqrt25.f
	${FORTRAN} ${OPTS} -c $?

cfig12.o : cfig12.f
	${FORTRAN} ${OPTS} -c $?

cfig3.o : cfig3.f
	${FORTRAN} ${OPTS} -c $?

cqrt25.o : cqrt25.f
	${FORTRAN} ${OPTS} -c $?

dfig12.o : dfig12.f
	${FORTRAN} ${OPTS} -c $?

dfig3.o : dfig3.f
	${FORTRAN} ${OPTS} -c $?
	
dqrt25.o : dqrt25.f
	${FORTRAN} ${OPTS} -c $?

zfig12.o : zfig12.f
	${FORTRAN} ${OPTS} -c $?

zfig3.o : zfig3.f
	${FORTRAN} ${OPTS} -c $?

zqrt25.o : zqrt25.f
	${FORTRAN} ${OPTS} -c $?

.SUFFIXES: .f .o
%.o: $(LAPACK)/TESTING/LIN/%.f
	$(FORTRAN) $(OPTS) -c $<
%.o: $(LAPACK)/TESTING/MATGEN/%.f
	$(FORTRAN) $(OPTS) -c $<

clean:
	rm -f sfig12 sfig3 cfig12 cfig3 dfig12 dfig3 zfig12 zfig3
	rm -f *.o *.out
