#
# Makefile for Yorick FFT and Matrix analysis packages
#
# $Id: Makefile,v 1.1 1993/08/06 23:08:27 munro Exp munro $
#

# NOTE: The LAPACK function DLAMC2 (in dgecon.f here) contains a
#       write statement and its format statement, which must be
#       commented out.  Their sole function is to print a warning
#       that the machine type has not been certainly determined.

# ---------------------------------------------------------------------------

# If you've played your cards right, this is the only line that you
# need to change in order to port your custom version of Yorick to a
# new platform.
exec_prefix = 
Y_HOME = $(exec_prefix)/yorhome

C_OPTIMIZE = -O
F_OPTIMIZE = -O

CODE_NAME = yorm
NON_SHARABLE = unused

OBJS = cfft2.o cfftb.o cfftf.o cffti.o roll2.o dlamc3.o dgyor.o dgtsv.o \
       dgesv.o dgecon.o dgels.o dgelss.o dbdsqr.o dlasr.o dgesvd.o dgesv2.o \
       dgblas.o

CODE_LIBRARY = libyorm.a

# PKG_LIBS =
# PKG_OBJS = $(OBJS) $(YWRAP_O)
PKG_LIBS = -lyorm
PKG_OBJS =

Y_INCLUDE = fft.i matrix.i
Y_OTHERS =

# Use
# Y_OTHERS = fft.i matrix.i
# PKG_LIBS = -lyorm
# to put the fft and matrix routines into another custom version of Yorick

# YWRAP_O =
YWRAP_O = ywrap.o

SYS_LIBS =

# Set any special files to be zapped by the clean and tidy targets.
# (make clean removes both TIDY_UP and CLEAN_UP)
CLEAN_UP = yorm
TIDY_UP=

# ---------------------------------------------------------------------------

# all:: $(NON_SHARABLE)
all:: $(CODE_LIBRARY) $(CODE_NAME) startup

startup::
	../install-sh 0 ../Yorick/startup
	cp $(Y_INCLUDE) ../Yorick/startup

check: all
	./yorm -batch check.i
	$(RM) junk*

install: $(CODE_LIBRARY) installdirs
	cp $(Y_INCLUDE) $(Y_SITE)/startup
	../install-sh 0 $(Y_BINDIR) yorm
	cp libyorm.a $(Y_LIBDIR)
	$(RANLIB) $(Y_LIBDIR)/libyorm.a

uninstall:
	cd $(Y_SITE)/startup; $(RM) $(Y_INCLUDE);
	$(RM) $(Y_LIBDIR)/libyorm.a

installdirs:
	../install-sh 0 $(Y_SITE)
	../install-sh 0 $(Y_SITE)/startup
	../install-sh 0 $(Y_BINDIR)
	../install-sh 0 $(Y_LIBDIR)

distclean: clean
	$(SED) -n -e "1,/^# --END-CODE/p" Makefile >M.1
	cat M.1 >Makefile
	$(RM) M.1

# Note: indirectly included headers separated by three spaces

# my_code1.o: my_code1.h   my_code.h
# my_code2.o: my_code2.c my_code.h
#	$(CC) $(CFLAGS) -DSPECIAL_SWITCH -c my_code2.c
# my_code1.o: my_code3.h   my_code1.h my_code.h

# Compile this one non-optimized
# The real problem may be in the dgecon.c routines which call this in
# an attempt to compute things like the smallest x such that 1.0+x!=1.0.
# This patch works for Linux, which was the only place I have had
# problems.
dlamc3.o: dlamc3.c
	$(CC) $(CPPFLAGS) -g -c dlamc3.c

# ---------------------------------------------------------------------------

# Do not modify or remove the following line.
# --END-CODE-SPECIFIC-SECTION-----------------END-CODE-SPECIFIC-SECTION--
