.SUFFIXES: .pdf .html


#----------------------------------------------------------------------------
# Set up the compiler options.  Define INC to be the include files that are
# part of this application only.  Do not list include files from ADAPSINCLUDE
# or LASINCLUDE.
#----------------------------------------------------------------------------
OPTS	= $(CFLAGS) -I$(LASINCLUDE) -I$(TAEINC)
INC	= 


#-------------------------------------------------------
# Define the executable(s), the pdf(s), and the html(s).
#-------------------------------------------------------
EXECS	= edipsout
HTMLS	= edipsout.html
PDFS	= $(HTMLS:.html=.pdf)


#---------------------------------------------------------
# Define the source code object files for each executable.
#---------------------------------------------------------
CSRC	= sysdat.c
COBJ	= $(CSRC:.c=.o)

FSRC	= \
	bilmss.f \
	bsqmss.f \
	btcpy.f \
	edipsout.f \
	fclean.f \
	getpar.f \
	inter.f \
	nxtvol.f \
	rbv.f \
	seq.f \
	wrtant.f \
	wrtdir.f \
	wrthd.f \
	wrttra.f
FOBJ	= $(FSRC:.f=.o)


#--------------------------------------------------------
# Standard list of object libraries.  Delete those that
# are not necessary and add additional ones if necessary.
#--------------------------------------------------------
OBJLIB	= \
	$(LASLIB)/las.a \
	$(LASLIB)/geolib.a \
	$(TPLIB) \
	$(LASLIB)/world.a \
	$(LASLIB)/tae.a \
	$(TAELIB)/clib.a \
	$(TAELIB)/lib.a


#------------------------------------------------------------------------------
# Targets for each executable.  You should have two targets for each executable
# that is created.  One to create the executable and one to load it into the
# CenterLine debugger.
#------------------------------------------------------------------------------
all: $(EXECS) $(HTMLS)

edipsout: $(COBJ) $(FOBJ) $(OBJLIB) $(INC)
	$(FC) $(OPTS) -o edipsout $(COBJ) $(FOBJ) $(OBJLIB) $(TRLIB) -lm

xcenter:
	#load $(OPTS) $(SRC) $(OBJLIB) $(INC) $(TRLIB) -lm
	#link


#--------------------------------------------------
# Target to distribute the executable(s) and pdf(s)
#--------------------------------------------------
las: $(EXECS)
	cp $(PDFS) $(DSTDIR)
	mv $(EXECS) $(DSTDIR)


#-----------------------------------------------------------------------------
# Rules for compiling the object files.  If you have multiple groups of object
# files, add one dependency of the form "$(OBJS): $(INC)" for each group of
# object files.
#-----------------------------------------------------------------------------
.c.o:
	$(CC) $(OPTS) -c $<

.f.o:
	faim $(LASSYS) $* | fpp > $*.tmp.f
	$(FC) $(OPTS) $(FOPTS) -c $*.tmp.f
	mv $*.tmp.o $*.o


#------------------------------
# Make all of the documentation
#------------------------------
doc: $(HTMLS)
	mv $(HTMLS) $(DSTDIR)

.pdf.html:
	pdfhtml $*


#--------------------------------------
# Clean up objects and other misc files
#--------------------------------------
clean:
	/bin/rm -f $(EXECS) $(HTMLS) core make.log
	/bin/rm -f *.o *.a *.tmp.f
