#=======================================================================
# Makefile for files in /u/sy/beebe/jim-ball/toms/dist/common/
#
# Current target list:
#	all			make everything
#	check			dummy target
#	clean			remove unneeded intermediate files
#	clobber			same as distclean
#	distclean		remove almost everything make can rebuild
#				(paring back to the original distribution)
#	install			install files on local system
#	lib			make object library
#	maintainer-clean	remove absolutely everything make can rebuild
#				at the author's site (do NOT use this target)
#	mostlyclean		same as clean
#	uninstall		remove files installed by "make install"
#	dlog2.o
#	qlog2.o
#
# [13-May-2000]
#=======================================================================

#=======================================================================
# Macro definitions

AUTOCONF	= autoconf

AR		= ar

CC		= gcc

CHMOD		= chmod

CMP		= cmp

FC		= f77

MV		= mv

RANLIB		= ranlib

RM		= rm -f

SED		= sed

SHELL		= /bin/sh

#=======================================================================
# Compiler flags and source files

CDEFS		=

CEXTRA		= 

CFLAGS		=  $(COPT) $(CINC) $(CWARN) $(CDEFS) $(CEXTRA)

CINC		=

COMMON		= .

COPT		= -O

CWARN		=

FEXTRA		= 

FFLAGS		= -u $(FOPT) $(FINC) $(FWARN) $(FEXTRA)

FINC		=

FOPT		= -O

FWARN		=

DLIBOBJS	= $(DLIBSRCS:.f=.o)

# These are the routines that are installed in the load library.
# There are other source files in this directory, but they are
# used only during testing.
DLIBSRCS        = d2norm.f dcopy.f deps.f derbit.f dfloat.f dfpmax.f \
		  dgamma.f dinf.f diran.f dlgam.f dlog2.f dnan.f dpsi.f \
		  dpsiln.f dran.f dstore.f dstorf.f dvsum.f ffalse.f ftrue.f \
		  getnan.f idceil.f isdinf.f isdnan.f pythag.f tql1.f

LDFLAGS		= 

LIBNAME		= libgjl

LIBRARY		= ../$(LIBNAME).a

QLIBOBJS	= $(QLIBSRCS:.f=.o)

QLIBSRCS        = iqceil.f isqinf.f isqnan.f q2norm.f qcopy.f qeps.f \
		  qepsln.f qerbit.f qfloat.f qfpmax.f qgamma.f qinf.f \
		  qiran.f qlgam.f qlog2.f qnan.f qpsi.f qpsiln.f qpythg.f \
		  qstore.f qstorf.f qtql1.f qvsum.f

SLIBOBJS	= $(SLIBSRCS:.f=.o)

SLIBSRCS        = aeps.f afpmax.f ainf.f airan.f algam.f alog2.f anan.f \
		  astore.f astorf.f avsum.f gamma.f iceil.f isainf.f \
		  isanan.f psi.f psiln.f ran.f

#=======================================================================
# Suffixes and extra rule(s)

.SUFFIXES:	.s .i .c .f

# Preprocessor output:
.c.i:
	$(CC) $(CFLAGS) -E $< > $@

# Assembly code:
.c.s:
	$(CC) $(CFLAGS) -S $<

# Assembly code:
.f.s:
	$(FC) $(FFLAGS) -S $<

#=======================================================================
# Targets:

all:	all-dp all-sp

all-dp:	lib-dp

all-qp:	lib-qp

all-sp:	lib-sp

check:	check-dp

check-dp:	all
	@echo 'There is no validation suite in this directory'

check-qp:	all
	@echo 'There is no validation suite in this directory'

clean:
	-$(RM) *.dcl
	-$(RM) *.i
	-$(RM) *.lst
	-$(RM) *.o
	-$(RM) *.s
	-$(RM) *.stb
	-$(RM) *.stx
	-$(RM) *.u
	-$(RM) *~
	-$(RM) \#*
	-$(RM) core
	-$(RM) core.*
	-$(RM) tg_[0-9][0-9][0-9][0-9][0-9].*

clean-exe:
	-$(RM) a.out
	-$(RM) tepsln tqepsln

clobber:	distclean

# We need to reverse the search order for Fortran compilers, because g77
# on IBM and HP systems adds trailing underscores to names, while the
# native Fortran compilers do not.
configure:	configure.in FRC
	$(AUTOCONF)
	$(SED) -e 's/for ac_prog in g77 f77 f2c/for ac_prog in f77 g77 f90 f95/' < $@ >$@.tmp
	$(CHMOD) 775 $@.tmp
	$(CMP) -s $@.tmp $@ || $(MV) $@.tmp $@
	-$(RM) $@.tmp

demo:	demo-dp

demo-dp:
	@echo There are no demonstration programs in this directory

demo-qp:
	@echo There are no demonstration programs in this directory

distclean:	mostlyclean
	-$(RM) config.cache config.status config.log Makefile

FRC:

install:
	@echo There is nothing to install from this directory

lib:	lib-dp lib-sp

lib-dp:	$(DLIBOBJS)
	$(AR) -r $(LIBRARY) $(DLIBOBJS)
	$(RANLIB) $(LIBRARY) || true

lib-qp:	$(QLIBOBJS)
	$(AR) -r $(LIBRARY) $(QLIBOBJS)
	$(RANLIB) $(LIBRARY) || true

lib-sp:	$(SLIBOBJS)
	$(AR) -r $(LIBRARY) $(SLIBOBJS)
	$(RANLIB) $(LIBRARY) || true

maintainer-clean:	distclean
	@echo "This command is intended for maintainers to use;"
	@echo "it deletes files that may require special tools to rebuild."

mostlyclean:	clean clean-exe
	-$(RM) *.d
	-$(RM) *.tcov

tepsln:	tepsln.o deps.o depsln.o dstore.o
	$(FC) $(FFLAGS) -o $@ tepsln.o deps.o depsln.o dstore.o $(LDFLAGS) $(LIBS)

tqepsln:	tqepsln.o qeps.o qepsln.o qstore.o
	$(FC) $(FFLAGS) -o $@ tqepsln.o qeps.o qepsln.o qstore.o $(LDFLAGS) $(LIBS)

uninstall:

#=======================================================================
# Fortran/SFTRAN3 header file dependencies (generated by
# ../makedepends.sh)


algam.o:       	$(COMMON)/acgam.inc
algam.o:       	$(COMMON)/al2pi2.inc
algam.o:       	$(COMMON)/axbig.inc

alog2.o:       	$(COMMON)/algtwo.inc

chkdgam.o:     	$(COMMON)/stdio.inc

chkiran.o:     	$(COMMON)/stdio.inc

chkqgam.o:     	$(COMMON)/stdio.inc

chkqpsi.o:     	$(COMMON)/stdio.inc

chkran.o:      	$(COMMON)/stdio.inc

dgamma.o:      	$(COMMON)/deps.inc
dgamma.o:      	$(COMMON)/dl2pi2.inc
dgamma.o:      	$(COMMON)/dxbig.inc
dgamma.o:      	$(COMMON)/dxinf.inc
dgamma.o:      	$(COMMON)/dxmin.inc

dlgam.o:       	$(COMMON)/dcgam.inc
dlgam.o:       	$(COMMON)/dl2pi2.inc
dlgam.o:       	$(COMMON)/dxbig.inc

dlog2.o:       	$(COMMON)/dlgtwo.inc

dpsi.o:        	$(COMMON)/dxinf.inc
dpsi.o:        	$(COMMON)/dxmin.inc

dpsiln.o:      	$(COMMON)/dcpsi.inc

gamma.o:       	$(COMMON)/acgam.inc
gamma.o:       	$(COMMON)/aeps.inc
gamma.o:       	$(COMMON)/al2pi2.inc
gamma.o:       	$(COMMON)/axbig.inc
gamma.o:       	$(COMMON)/axinf.inc
gamma.o:       	$(COMMON)/axmin.inc

psi.o:         	$(COMMON)/axinf.inc
psi.o:         	$(COMMON)/axlarg.inc
psi.o:         	$(COMMON)/axmax1.inc
psi.o:         	$(COMMON)/axmin.inc
psi.o:         	$(COMMON)/axsmal.inc
psi.o:         	$(COMMON)/cpsi.inc

psiln.o:       	$(COMMON)/dcpsi.inc

qgamma.o:      	$(COMMON)/qcgam.inc
qgamma.o:      	$(COMMON)/qeps.inc
qgamma.o:      	$(COMMON)/ql2pi2.inc
qgamma.o:      	$(COMMON)/qxbig.inc
qgamma.o:      	$(COMMON)/qxinf.inc
qgamma.o:      	$(COMMON)/qxmin.inc

qlgam.o:       	$(COMMON)/qcgam.inc
qlgam.o:       	$(COMMON)/ql2pi2.inc
qlgam.o:       	$(COMMON)/qxbig.inc

qlog2.o:       	$(COMMON)/qlgtwo.inc

qpsi.o:        	$(COMMON)/qcpsi.inc
qpsi.o:        	$(COMMON)/qxinf.inc
qpsi.o:        	$(COMMON)/qxlarg.inc
qpsi.o:        	$(COMMON)/qxmax1.inc
qpsi.o:        	$(COMMON)/qxmin.inc
qpsi.o:        	$(COMMON)/qxsmal.inc

qpsiln.o:      	$(COMMON)/qcpsi.inc

tepsln.o:      	$(COMMON)/stdio.inc

tqepsln.o:     	$(COMMON)/stdio.inc
