#####    Makefile for gaspan
#####   Available systems: CDC, SGI, Linux, HP
#####
#####   Adapt this Makefile to one of these systems:
#####   1. IRIS Indigo
#####   2. HP-UX 9.2
#####   3. HP-UX 10.x
#####   4. Linux PC with g77
#####     
#####   enable the commands of the system wanted by
#####   deleting the number sign in front of the commands
#####
##### graphics in Xwindow:          make gaspan
##### graphics in Tektronix window: make tekgaspan  !!! not supported anymore

##### location of source codes
SRC=


####### IRIS Indigo at least R4000 and Irix 6.2

#CC=cc
#CFLAGS=-O -mips3  -DMEMORY -DSGI
#FFLAGS=-mips3 -O -static -extend_source -vms_stdin
#XLDLIBS=-lXt -lX11

########## HP UX 9.2

#CC=cc
#CFLAGS=-O -Aa -DMEMORY -D_HPUX_SOURCE -DHP
#FFLAGS=-O +es +E6 -K +ppu
#LDLIBS=-lm
#XLDLIBS=-L/usr/X11R6/lib -Xt -lX11 -lm
########## Linux

CC=gcc
CFLAGS=-O -Wall -W -Werror -DMEMORY
FC=g77
LDLIBS=-lm
XLDLIBS=-L/usr/X11R6/lib -lXt -lX11 -lm
#FFLAGS=-O -W -Wall -fno-automatic -ffixed-line-length-132 -fno-f2c
##### newer versions < egcs, kernels 2.2.xx
FFLAGS=-O -W -Wall -Werror -fno-automatic -ffixed-line-length-132 -fno-f2c -ffast-math -fgcse


#########

OBJgaspan=gaspan.o gasber.o gascal.o gaschi.o gasdefc.o gasdefd.o gasdefe.o \
	  gasdeff.o gasdeft.o gasdefw.o gasdis.o gaseic.o gaseif.o gasein.o \
	  gaseip.o gaserr.o gasfck.o gasfil.o gasfit.o gasfou.o gasfun.o \
          gasgen.o gaslib.o gaslst.o gasmtx.o gasnews.o gaspar.o gaspck.o gaspsin.o \
	  gasque.o gasres.o gassea.o gasslp.o gasspc.o gasstp.o gasval.o \
	  gasweight.o gaswrtf.o readmatrix.o gasmpar.o \
	  gascdc.o gasffl.o gasisw.o gassgn.o gasuti.o graph.o joinps.o lineget.o msg_error.o \
	  readascii.o readdat.o readdaterr.o readfft.o readstrasb.o readosp.o \
          writespec.o

TEKGRAFIK=Tekgraflib0.o Tekgraflibc.o Tekgraflibf.o

XGRAFIK=Xgraflibf.o Xgrafik.o

gaspan:    $(OBJgaspan) $(XGRAFIK)
	    $(FC) $(OBJgaspan) $(XGRAFIK) $(XLDLIBS) -o gaspan

tekgaspan:     $(OBJgaspan) $(TEKGRAFIK)
	    $(FC) $(OBJgaspan) $(TEKGRAFIK) $(LDLIBS) -o tekgaspan

gasber.o:  $(SRC)gasber.f  gasctr.icl gaseic.icl \
	                   gasfil.icl gasfit.icl \
	                   gaspar.icl gaspea.icl \
	                   gasspe.icl
gascal.o:  $(SRC)gascal.f  gaseic.icl gasfil.icl \
	                   gastxt.icl
gascdc.o:  $(SRC)gascdc.c  gascdc.h
gaschi.o:  $(SRC)gaschi.f  gasctr.icl gasfit.icl \
	                   gaspar.icl
gasdefc.o: $(SRC)gasdefc.f gasctr.icl gasfil.icl
gasdefd.o: $(SRC)gasdefd.f gasdis.icl
gasdefe.o: $(SRC)gasdefe.f gaseic.icl gasfil.icl
gasdeff.o: $(SRC)gasdeff.f gaseic.icl gasfil.icl
gasdeft.o: $(SRC)gasdeft.f gasctr.icl gaseic.icl
gasdefw.o: $(SRC)gasdefw.f gaseic.icl gasfil.icl
gasdis.o:  $(SRC)gasdis.f  gasctr.icl gasdis.icl \
	                   gaseic.icl gasfil.icl \
	                   gasfit.icl gaspar.icl \
	                   gasspe.icl gastxt.icl \
                           gasplt.icl gaseic.icl \
                           gaspea.icl
gaseic.o:  $(SRC)gaseic.f  gasctr.icl gaseic.icl \
	                   gasfil.icl gastxt.icl \
                           gaspar.icl gaspea.icl
gaseif.o:  $(SRC)gaseif.f  gaspea.icl gaspar.icl
gasein.o:  $(SRC)gasein.f  gastxt.icl gaspea.icl
gasfck.o:  $(SRC)gasfck.f  gasctr.icl gasfit.icl \
	                   gaspar.icl
gasffl.o:  $(SRC)gasffl.c
gasfil.o:  $(SRC)gasfil.f  gasctr.icl gasfil.icl \
                           gasspe.icl
gasfit.o:  $(SRC)gasfit.f  gasctr.icl gaseic.icl \
	                   gasfil.icl gasfit.icl \
	                   gaspar.icl gasdis.icl \
                           gastxt.icl
gasfou.o:  $(SRC)gasfou.f  gasctr.icl
gasfun.o:  $(SRC)gasfun.f  gasctr.icl gaspar.icl
gasgen.o:  $(SRC)gasgen.f  gasctr.icl gaseic.icl \
	                   gasfil.icl gasfit.icl \
	                   gaspar.icl gastxt.icl
gasisw.o:  $(SRC)gasisw.c
gaslib.o:  $(SRC)gaslib.f
gaslst.o:  $(SRC)gaslst.f  gasctr.icl gaseic.icl \
	                   gasfil.icl gaspea.icl \
	                   gasspe.icl gastxt.icl
gasmtx.o:  $(SRC)gasmtx.f  gaspar.icl
gaspan.o:  $(SRC)gaspan.f  gasctr.icl gaseic.icl \
                           gasfil.icl gasfit.icl \
                           gaspar.icl gaspea.icl \
                           gasspe.icl gastxt.icl \
                           cli_parms.icl
gasmpar.o: $(SRC)gasmpar.f gaspar.icl
gaspar.o:  $(SRC)gaspar.f  gasctr.icl gaseic.icl \
	                   gasfit.icl gaspar.icl \
	                   gaspea.icl
gaspck.o:  $(SRC)gaspck.f  gasctr.icl gasfit.icl \
	                   gaspar.icl
gasque.o:  $(SRC)gasque.f  gasctr.icl gaseic.icl \
	                   gasfil.icl gaspea.icl \
	                   gasspe.icl gastxt.icl
gasres.o:  $(SRC)gasres.f  gasctr.icl gasfit.icl \
	                   gaspar.icl
gassea.o:  $(SRC)gassea.f  gasctr.icl gaseic.icl \
	                   gasfil.icl gasfit.icl \
	                   gaspea.icl gasspe.icl \
	                   gastxt.icl
gassgn.o:  $(SRC)gassgn.c
gasslp.o:  $(SRC)gasslp.f  gasctr.icl gaspea.icl
gasspc.o:  $(SRC)gasspc.f  gasctr.icl gasfil.icl
gasstp.o:  $(SRC)gasstp.f  gasctr.icl gasdis.icl \
	                   gasfit.icl gaspar.icl
gasuti.o:  $(SRC)gasuti.c
gasval.o:  $(SRC)gasval.f  gasctr.icl gaseic.icl \
	                   gasfil.icl gaspar.icl \
	                   gaspea.icl gasspe.icl
gaswrtf.o: $(SRC)gaswrtf.f gasfil.icl
lineget.o: $(SRC)lineget.c
joinps.o:     $(SRC)joinps.c
readascii.o:  $(SRC)readascii.c
readdat.o:    $(SRC)readdat.c
readdaterr.o: $(SRC)readdaterr.c
readmatrix.o: $(SRC)readmatrix.f
readstrasb.o: $(SRC)readstrasb.c
readosp.o:    $(SRC)readosp.c
readfft.o:    $(SRC)readfft.c
writespec.o:  $(SRC)writespec.c
gasnews.o:	$(SRC)gasnews.c converttext message.h

Tekgraflib0.o:	$(SRC)Tekgraflib0.c grafik.h
Tekgraflibc.o:	$(SRC)Tekgraflibc.c grafik.h
Tekgraflibf.o:	$(SRC)Tekgraflibf.c Tekgraflib0.h

Xgraflibf.o:	$(SRC)Xgraflibf.c grafik.h
Xgrafik.o:	$(SRC)Xgrafik.c Xgrafik.h grafik.h

graph.o:	$(SRC)graph.c grafik.h

converttext:	converttext.o
		$(CC) converttext.o -o converttext
		./converttext CHANGES message.h
		rm converttext


tsto=tst.o gasuti.o

tst:          $(tsto)
	    $(FC) $(tsto) $(LDLIBS) -o tst

derivch=derivcheck.o derivx.o derivp.o graph.o gasuti.o gasfun.o gaslib.o gaspsin.o \
        joinps.o gasmpar.o

derivcheck:         $(derivch) $(XGRAFIK)
	    $(FC) $(derivch) $(XGRAFIK) $(XLDLIBS) -o derivcheck


derivcheck.o: $(SRC)derivcheck.f gasctr.icl gasfit.icl \
                                 gaspar.icl gaseic.icl
derivx.o:     $(SRC)derivx.f gasctr.icl gasfit.icl \
                             gaspar.icl gaseic.icl
derivp.o:     $(SRC)derivp.f gasctr.icl gasfit.icl \
                                 gaspar.icl gaseic.icl
