# @(#)makefile	19.1 (ESO-IPG) 02/25/03 13:29:08
# .COPYRIGHT:	Copyright (c) 1988 European Southern Observatory,
#						all rights reserved
# .TYPE		make file
# .NAME		$MIDASHOME/$MIDVERS/contrib/pepsys/src/makefile 
# .LANGUAGE	makefile syntax
# .ENVIRONMENT	Unix Systems. 
# .COMMENT	Compiles source files and generates "pepsys" commands
#
# .REMARKS	
# .AUTHOR	A.T.Young
# .VERSION 0.0	920220:		
# .VERSION 3.0  930308:		Using default.mk file
# .VERSION 4.4  930321:		ATY adds dependences

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

M = ../../exec

LINC=../incl

# The Fortran optimization may fail, in that case remove '#' in the next line
#F_OPT = 

LLIB = -L$(LLIBDIR) -lpep -L$(LIBDIR) -lmidas

LIBS =	$(LLIBDIR)/libpep.a\
	$(LIBDIR)/libmidas.a 

OUT =   $(M)/horform.exe \
	$(M)/instr.exe \
	$(M)/plan.exe \
	$(M)/danish.exe \
	$(M)/esodcon.exe \
	$(M)/eso50.exe \
	$(M)/danstarx.exe $(M)/esodstarx.exe $(M)/meanstar.exe \
	$(M)/reduce.exe


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

$(MAKEFILE_VMS): makefile
	$(MAKE_VMS)


$(M)/danstarx.exe: danstarx.o $(LIBS)
	$(LD77) danstarx.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/esodstarx.exe: esodstarx.o getut.o $(LIBS)
	$(LD77) esodstarx.o getut.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/meanstar.exe: meanstar.o $(LIBS)
	$(LD77) meanstar.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/danish.exe: danish.o $(LIBS)
	$(LD77) danish.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/esodcon.exe: esodcon.o getut.o $(LIBS)
	$(LD77) esodcon.o getut.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/eso50.exe: eso50.o $(LIBS)
	$(LDCC) eso50.o $(LLIB) $(MLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/horform.exe: horform.o $(LIBS)
	$(LD77) horform.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/instr.exe: instr.o $(LIBS)
	$(LD77) instr.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@


reduce.o: $(LINC)/mstars.inc $(LINC)/mbands.inc $(LINC)/obs.inc \
	 $(LINC)/dlsq.inc $(LINC)/kingfit.inc

$(M)/reduce.exe: reduce.o $(LIBS)
	$(LD77) reduce.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@


planbot.o: $(LINC)/mstars.inc $(LINC)/mbands.inc

plantop.o: $(LINC)/mstars.inc $(LINC)/mbands.inc

plan.exe: plantop.o planbot.o $(LIBS)
	f77 -o plan.exe plantop.o planbot.o  \
		$$MIDASHOME/$$MIDVERS/lib/midaslib.a \
		$(LLIB)

$(M)/plan.exe: plantop.o planbot.o $(LIBS)
	$(LD77) plantop.o planbot.o $(LLIB) $(SLIB) -o $@
	$(STRIP) $@

clean_exec:
	rm -f $(OUT)

clean:
	rm -f *.o
	rm -f *.f
