# .COPYRIGHT:	Copyright (c) 1988 European Southern Observatory,
#						all rights reserved
# .TYPE		make file
# .NAME		$MIDASHOME/$MIDVERS/applic/fit/src/makefile 
# .LANGUAGE	makefile syntax
# .ENVIRONMENT	Unix Systems. 
# .COMMENT	Compiles source files and generates "fit" commands
#
# .REMARKS	
# .AUTHOR	
# .VERSION 1.1	880831:		Implementation
# .VERSION 1.2	890104:		Generating makefile.com for VMS systems
# .VERSION 2.1  901102:         new directory structure CG.
# .VERSION 3.0  930308:		Using default.mk file
# 100803	last modif

include ../../../local/default.mk

M = ../../exec

FLIB = -L$(LIBDIR)/fitlib.a
FLIB = -lfit

INCS = $(INC)/fiti.inc $(INC)/fitc.inc $(INC)/fitd.inc

LLIB = -L$(LIBDIR) -lfit -lftab -lmidas
LLIB1 =-L$(LIBDIR) -lfit -lfituser -lftab -lmidas
LLIB2 =-L$(LIBDIR) -lfit -lfituser $(NAGLIB) -lfit -lgen -lftab -lmidas

LIBS =  $(LIBDIR)/libfit.a \
	$(LIBDIR)/libftab.a \
	$(LIBDIR)/libmidas.a 

LIBS1 = $(LIBDIR)/libfituser.a \
	$(LIBDIR)/libfit.a \
	$(LIBDIR)/libftab.a \
	$(LIBDIR)/libmidas.a 

LIBS2 = $(LIBDIR)/libfituser.a \
	$(LIBDIR)/libfit.a \
	$(LIBDIR)/libgen.a \
	$(LIBDIR)/libftab.a \
	$(LIBDIR)/libmidas.a 

VMS_FILES = fitcrea.mod fitimag.mod funcrea.mod

OUT =	$(M)/fitcopy.exe $(M)/fitcrea.exe $(M)/fitimag.exe \
	$(M)/fitread.exe $(M)/fitsele.exe $(M)/funcrea.exe \
	$(M)/fittable.exe $(M)/tablefit.exe  

# DEPENDENCIES:
all: $(MAKEFILE_VMS) $(OUT) $(VMS_FILES)

$(MAKEFILE_VMS): makefile
	$(MAKE_VMS)

$(M)/fitcopy.exe: fitcopy.o $(LIBS) 
	$(LD77) fitcopy.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
$(M)/fitcrea.exe: fitcrea.o $(LIBS1)
	$(LD77) fitcrea.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@
$(M)/fitimag.exe: fitimag.o $(LIBS2)
	$(LD77) fitimag.o  $(LLIB2) $(SLIB) -o $@
	$(STRIP) $@
$(M)/fitread.exe: fitread.o $(LIBS)
	$(LD77) fitread.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
$(M)/fitsele.exe: fitsele.o $(LIBS)
	$(LD77) fitsele.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
$(M)/funcrea.exe: funcrea.o $(LIBS1)
	$(LD77) funcrea.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@
$(M)/fittable.exe: fittable.o $(LIBS)
	$(LD77) fittable.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@
$(M)/tablefit.exe: tablefit.o $(LIBS)
	$(LD77) tablefit.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

fitcopy.f: $(INCS)
fitcrea.f: $(INCS)
fitimag.f: $(INCS)
fitread.f: $(INCS)
fitsele.f: $(INCS)
funcrea.f: $(INCS)
fittable.f: $(INCS)
tablefit.f: $(INCS)


clean_exec:
	rm -f $(OUT)

test:
	echo $(SUFFIXES)
clean:
	rm -f *.o
	rm -f *.f *.mod
