#  Makefile for GTOOL-3.1 samples
#

include ../../../Mkinclude

PROGRAMS      = gtstspct gtstfilt gtstspct_old

SRC	      = $(PROGRAM).c

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)

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

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

gtstspct_old.o: gtstspct_old.c $(HDRS)

gtstspct.o: gtstspct.c $(HDRS)

gtstfilt.o: gtstfilt.c $(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)



########

