#                  Make file for the double precision maths
#                  part of the FORTRAM from occam library
#
# The macros OUTNAMEA and OUTNAME8 must be supplied from the command line.
#
# This file is cribbed from the make file for dblmath, without DRAN.
#
# FORTRAN routines must not have vector space.
#
#                           5-Feb-91 SRH
#
# This makefile is presently set up for UNIX.


# these two macros must be supplied from the command line
OUTNAMEA=
OUTNAME8=


# UNIX specific macros
SWITCH=-
DELETE=rm
CONCATENATE=cat
INTO=>


# for the flexibility to pass something in from the command line 
OCCEXTRAS=

# tools and global options
PREPROCESSOR=preocc
PREOPT=$(SWITCH)d FORTRAN
LIBRARIAN=ilibr
LIBOPT=
OCCAM=oc
# see bug report TS/744 for reason for 'u' option in OCCOPT
OCCOPT=$(SWITCH)d $(SWITCH)x $(SWITCH)v $(SWITCH)u $(SWITCH)g $(SWITCH)zlcp %f $(SWITCH)zlcs %  $(OCCEXTRAS)


# TA and TB class modules
DBLTA=dalogfl.tax dexpfl.tax \
	dpowfl.tax dsinfl.tax \
	dcosfl.tax dtanfl.tax \
	dasinfl.tax dacosfl.tax \
	datanfl.tax dhyperfl.tax \
	dpowfl.tbx

# T8 class modules
DBLT8=dalogfl.t8x dexpfl.t8x \
	dpowfl.t8x dsinfl.t8x \
	dcosfl.t8x dtanfl.t8x \
	dasinfl.t8x dacosfl.t8x \
	datanfl.t8x dhyperfl.t8x


#
############################## target and rules ##############################
#
all: $(OUTNAMEA) $(OUTNAME8) mathhdr.inc


$(OUTNAMEA): $(DBLTA)
	$(CONCATENATE) $(DBLTA) $(INTO) $(OUTNAMEA)

$(OUTNAME8): $(DBLT8)
	$(CONCATENATE) $(DBLT8) $(INTO) $(OUTNAME8)


# Pattern matching rules.
#
# All object files except dranfl.xxx actually depend on mathhdr.inc also.
# Most, if not all, also depend on occama.lib and occam8.lib
# an explicit rule is chosen before a pattern matching rule
# $< is a dynamic macro which means the current dependency file
# $* is a dynamic macro which means the base name of the current target
%.tax: %.occ
	$(PREPROCESSOR) $< $(PREOPT) $(SWITCH)o $*.pax
	$(OCCAM) $*.pax $(SWITCH)x $(SWITCH)ta $(OCCOPT) $(SWITCH)o $*.tax
	$(DELETE) $*.pax


%.tbx: %.occ
	$(PREPROCESSOR) $< $(PREOPT) $(SWITCH)o $*.pbx
	$(OCCAM) $*.pbx $(SWITCH)x $(SWITCH)tb $(OCCOPT) $(SWITCH)o $*.tbx
	$(DELETE) $*.pbx


%.t8x: %.occ
	$(PREPROCESSOR) $< $(PREOPT) $(SWITCH)d FPU $(SWITCH)o $*.p8x
	$(OCCAM) $*.p8x $(SWITCH)x $(SWITCH)t8 $(OCCOPT) $(SWITCH)o $*.t8x
	$(DELETE) $*.p8x
