# @(#)makefile	19.1 (ESO-IPG) 02/25/03 14:29:41
# .COPYRIGHT:	Copyright (c) 1988 European Southern Observatory,
#						all rights reserved
# .TYPE		make file
# .NAME		$MIDASHOME/$MIDVERS/stdred/spec/src/makefile 
# .LANGUAGE	makefile syntax
# .ENVIRONMENT	Unix Systems. 
# .COMMENT	Compiles source files and generates "spectr" commands
#
# .REMARKS	
# .AUTHOR	
# .VERSION 1.1	880831:		Implementation
# .VERSION 1.2	890104:		Generating makefile.com for VMS systems
# .VERSION 1.3	890508:  	KB
# .VERSION 2.1  901102:         new directory structure CG.
# .VERSION 2.2  920521:         Removing MLIB CG
# .VERSION 3.0  930308:		Using default.mk file

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

M = ../../exec

CFLAGS += $(C_OPT) $(DEBUG) $(SYS) -I$(LINC) -I$(INC) 

LLIB1 =	-L$(LLIBDIR) -lspec -lmidmath -L$(LIBDIR) -lftab -lmidas

LIBS1 =	$(LLIBDIR)/libspec.a \
	$(LIBDIR)/libftab.a \
	$(LIBDIR)/libmidas.a \

LLIB3 =	-L$(LLIBDIR) -lspec -lmidmath -L$(LIBDIR) -lgmidas -laplot -lgen -lftab -lmidas

LIBS3 =	$(LLIBDIR)/libspec.a \
	$(LIBDIR)/libgen.a \
	$(LIBDIR)/libgmidas.a \
	$(LIBDIR)/libaplot.a \
	$(LIBDIR)/libftab.a \
	$(LIBDIR)/libmidas.a 

LLIB2 = -L$(LIBDIR) -lsubplot -lftab -lgen -lsubmid -lgmidas -lmidas
LIBS2 =	$(LIBDIR)/libsubplot.a \
	$(LIBDIR)/libftab.a \
	$(LIBDIR)/libgen.a \
	$(LIBDIR)/libsubmid.a \
	$(LIBDIR)/libgmidas.a \
	$(LIBDIR)/libmidas.a 

OUT =	$(M)/specorrel.exe $(M)/caliline.exe  $(M)/fripple.exe  \
	$(M)/overiden.exe  $(M)/specenter.exe $(M)/integbin.exe \
	$(M)/sperebin.exe  $(M)/spesearch.exe $(M)/spematch.exe \
	$(M)/sprebin.exe   $(M)/sphough.exe   $(M)/progress.exe \
	$(M)/spmerge.exe   $(M)/spcumhist.exe \
	$(M)/dblend.exe    $(M)/maktab.exe    $(M)/dblgc.exe    \
	$(M)/refrac.exe    $(M)/localmax.exe

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

$(MAKEFILE_VMS): makefile
	$(MAKE_VMS)

$(M)/refrac.exe: refrac.o $(LIBS1)
	$(LD77) refrac.o $(LLIB1) $(MLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/dblgc.exe: dblgc.o $(LIBS3) 
	$(LD77) dblgc.o $(LLIB3) $(MLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/dblend.exe: dblend.o  $(LIBS3)
	$(LD77) dblend.o  $(LLIB3) $(MLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/maktab.exe: maktab.o  $(LIBS3)
	$(LD77) maktab.o  $(LLIB3) $(MLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/progress.exe: progress.o $(LIBS1)
	$(LD77) progress.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@

$(M)/spcumhist.exe: spcumhist.o $(LIBS1)
	$(LDCC) spcumhist.o $(LLIB1) $(MLIB) $(SLIB) -o $@

$(M)/localmax.exe: localmax.o $(LIBS1)
	$(LDCC) localmax.o $(LLIB1) $(MLIB) $(SLIB) -o $@

$(M)/spmerge.exe: spmerge.o $(LIBS1)
	$(LDCC) spmerge.o $(LLIB1) $(MLIB) $(SLIB) -o $@

$(M)/splocext.exe: splocext.o $(LIBS1)
	$(LDCC) splocext.o $(LLIB1) $(MLIB) $(SLIB) -o $@

$(M)/sprebin.exe: sprebin.o $(LIBS1)
	$(LDCC) sprebin.o $(LLIB1) $(MLIB) $(SLIB) -o $@

$(M)/spematch.exe: spematch.o $(LIBS1)
	$(LDCC) spematch.o $(LLIB1) $(MLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/sphough.exe: sphough.o $(LIBS1)
	$(LDCC) sphough.o $(LLIB1) $(MLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/specorrel.exe: specorrel.o $(LIBS1)
	$(LDCC) specorrel.o $(LLIB1) $(MLIB) $(SLIB) -o $@
	$(STRIP) $@

$(M)/caliline.exe: caliline.o $(LIBS1)
	$(LD77) caliline.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@

$(M)/fripple.exe: fripple.o $(LIBS1)
	$(LD77) fripple.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@

$(M)/ffnorm.exe: ffnorm.o $(LIBS1)
	$(LD77) ffnorm.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@

$(M)/integbin.exe: integbin.o $(LIBS1)
	$(LD77) integbin.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@

$(M)/overiden.exe: overiden.o $(LIBS2)
	$(LD77) overiden.o $(LLIB2) $(SLIB) $(VMSLIB) -o $@
	$(STRIP) $@

$(M)/specenter.exe: specenter.o $(LIBS1)
	$(LD77) specenter.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@

$(M)/sperebin.exe: sperebin.o $(LIBS1)
	$(LD77) sperebin.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@

$(M)/spesearch.exe: spesearch.o $(LIBS1)
	$(LD77) spesearch.o $(LLIB1) $(SLIB) -o $@
	$(STRIP) $@

clean_exec:
	rm -f $(OUT)

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