#  Makefile for GTOOL-3.1 samples
#

include ../../../Mkinclude

PROGRAMS      = gtstspct gtstfilt gtstspct_old

SRC	      = $(PROGRAM).F

FFLAGS 	      = $(STDFFLAGS) -I$(INCDIR)

CFLAGS        = $(STDCFLAGS) -I$(INCDIR)

CPPFLAGS      = $(STDCPPFLAGS) -I$(INCDIR)

LDFLAGS       = $(STDLDFLAGS)

HDRS	      = $(INCDIR)/gtsinc.F

OPTRG	      =  ../optarg/optarg.o

FTLIBDIR      = ./ftpack_single
FTLIB	      = $(FTLIBDIR)/libftp4.a
LIBFTP	      = -L$(FTLIBDIR) -lftp4

MAKEFILE      = Makefile
SUBDIRS	      = $(FTLIBDIR)

all: $(PROGRAMS)

gtstspct_old: gtstspct_old.o afftru.o fst2spp.o $(OPTRG) subtrd.o $(FTLIB)
	$(GT3FRT) gtstspct_old.o afftru.o fst2spp.o $(OPTRG) subtrd.o $(LIBFTP) -L$(LIBDIR)

gtstspct: gtstspct.o afftru.o fst2spp2.o $(OPTRG) subtrd.o $(FTLIB)
	$(GT3FRT) gtstspct.o afftru.o fst2spp2.o $(OPTRG) subtrd.o $(LIBFTP) -L$(LIBDIR)

gtstfilt: gtstfilt.o afftru.o $(OPTRG) $(FTLIB)
	$(GT3FRT) gtstfilt.o afftru.o $(OPTRG) $(LIBFTP) -L$(LIBDIR)

gtstspct_old.o: gtstspct_old.F $(HDRS)

gtstspct.o: gtstspct.F $(HDRS)

gtstfilt.o: gtstfilt.F $(HDRS)

$(FTLIB): 
	cd  $(FTLIBDIR); \
	echo "Making $(FTLIBDIR)" ; \
	$(MAKE) 

install: $(PROGRAMS)
	@echo "Installing executable program $(PROGRAMS)"
	$(CP) $(PROGRAMS) $(BINDEST)

clean: clean.local clean.dir

clean.local:
	$(RM) *.o *~ core *.trace *.f $(PROGRAMS)

clean.dir:
	@for i in $(SUBDIRS) ; do \
	  cd $$i ; \
	  echo "Cleaning $$i/" ; \
	  $(MAKE) clean ; \
	  cd .. ; \
	done

index:
		@$(INDEX) $(HDRS) $(SRCS)

print:		$(PRINTSTAMP)

$(PRINTSTAMP): $(HDRS) $(SRCS_ALL)
		$(PRINT) $?
		$(TOUCH) $(PRINTSTAMP)

tags:
		@$(TAGS) $(HDRS) $(SRCS_ALL)



########

