
#/bin/sh

###########################################################################
###									###
###   			Makefile for IRISPLOT				###
###									###
### Instructions:							###
###									###
### A. To compile:							###
###      Edit a few things in this file described below, then just type ###
###      'make'.  This will create the executables irisplot1, irisdraw  ###
###      irishelp1 in the ./bin directory				###
###									###
### B. To install:							###
###      Make the changes indicated in this makefile below, and then	###
###      type 'make install'. This will create all the executables,     ###
###	 all the shell scripts and the documentations.	                ###
###	 They will be installed to the specified directory.     	###
###									###
### C. To clean up the directory:					###
###      Type 'make clean'; this deletes the .o files and the		###
### 	 exectables.							###
###									###
###########################################################################


# BINDIR should be the directory in which you want to install the
# executable file (used only by 'make install').  Should probably be
# /usr/local/bin.
BINDIR=/usr/local/bin

# LIBDIR should be the directory in which you want to install the
# IRISPLOT on line help messages (used only by 'make install').
# Should probably be /usr/local/lib. 
LIBDIR=/usr/local/lib

# MANDIR should be the directory in which you want to install the
# manual page. Usually it is
# /usr/catman/local/u_man/cat#
# make sure  /usr/catman/local/u_man/cat# exists before you
# make install.
MANDIR=/usr/catman/u_man/cat7

# If you have a f77 compiler, (un)comment the following few lines.
# F77_FLAG=-DHAVE_F77
# F77LIB = -lF77 -lI77_mp -lU77 -lc_s
# FOBJ = fcontour.o

F77_FLAG=-DHAVE_F77
F77LIB = -lF77 -lI77 -lU77 -lc_s
FOBJ = fcontour.o

# the optimalizer flag, usually  -g or  -O
# COMP_FLAG = -O

COMP_FLAG = -O 

## That is all you have to do.

####################################################################
###								 ###
###       Do not edit the stuff below 				 ###
###								 ###
####################################################################

CFLAGS = $(F77_FLAG) $(COMP_FLAG) 

all:  
	cd gsrc; make install CFLAGS="$(CFLAGS)"
	cd src;  make install CFLAGS="$(CFLAGS)" F77LIB="$(F77LIB)"\
		 FOBJ="$(FOBJ)" 

install: all irisplot irishelp
	cd help; make install LIBDIR="$(LIBDIR)"
	cd doc; make install  MANDIR="$(MANDIR)"
	cd bin; make install  BINDIR="$(BINDIR)"


irisplot:
	echo '#! /bin/sh' >irisplot
	echo 'echo ' >> irisplot
	echo 'PATH=$$PATH:$(BINDIR)' >>irisplot
	echo 'export PATH' >>irisplot
	echo 'trap true 2' >> irisplot
	echo '$(BINDIR)/irisplot1' >>irisplot
	echo 'exitstatus=$$?' >> irisplot
	echo 'trap 2' >> irisplot
	echo '/bin/rm -f .Irisplot.Attr .Irisplot.Data'>>irisplot
	echo 'exit 0' >>irisplot
	echo 'echo ' >> irisplot
	chmod 755 irisplot
	mv irisplot ./bin

irishelp:
	echo '#! /bin/sh' >irishelp
	echo ' ' >> irishelp
	echo 'LIBDIR=$(LIBDIR)/irisplot.hlp' >> irishelp
	echo 'TOPICS=Topics'>>irishelp
	echo 'case $$# in' >> irishelp
	echo '0)' >>irishelp
	echo '  $(BINDIR)/irishelp1 $$LIBDIR/$$TOPICS.HLP' >>irishelp
	echo ';;' >> irishelp
	echo '*)' >>irishelp
	echo '  $(BINDIR)/irishelp1 $$LIBDIR/$$1.HLP' >>irishelp	
	echo ';;' >> irishelp
	echo 'esac' >> irishelp
	echo 'exit 0'>>irishelp
	echo 'echo ' >> irishelp
	chmod 755 irishelp
	mv irishelp ./bin

manual: doc
	
doc:
	cd doc; make doc

clean:
	cd gsrc; make clean
	cd src; make clean
	cd help; make clean;
	cd bin; make clean;

compress:
	cd gsrc; make compress
	cd src; make compress
	cd help; make compress
	cd TEST; make compress

uncompress:
	cd gsrc; make uncompress
	cd src; make uncompress
	cd help; make uncompress
	cd TEST; make uncompress

dist:
	make clean;
	cd ..; tar cvf Irisplot.2.0.tar Irisplot

#######################################################################
