USERFLAGS = -I$(EXTLIBDIR)/Include/FitsIO -DWITH_SOPHYA
include $(DPCBASEREP)/Include/MakefileUser.h
 
ALIB := ./Objs/
AOBJ := ./Objs/

$(AOBJ)%.o:%.cc
	$(COMPILE.cc)   $(USERFLAGS) -o $@ $<
$(AOBJ)%.o:%.c
	$(COMPILE.c) -c $(CFLAGS) $(USERFLAGS) -o $@ $<

LIBOLIST := $(AOBJ)asciitoiwtr.o $(AOBJ)fitstoirdr.o $(AOBJ)fitstoiwtr.o $(AOBJ)toi.o $(AOBJ)toimanager.o $(AOBJ)toiprocessor.o $(AOBJ)toisqfilter.o \
$(AOBJ)toiseqbuff.o 
EXEOLIST := $(AOBJ)fits2asc.o $(AOBJ)tsttoi.o $(AOBJ)tsttoi2.o
EXELIST := $(AOBJ)tstrztoi $(AOBJ)fits2asc $(AOBJ)tsttoi $(AOBJ)tsttoi2

INCLIST := asciitoiwtr.h fitstoirdr.h fitstoiwtr.h toi.h config.h conf.h \
 toiprocessor.h toimanager.h toiseqbuff.h 


all : $(EXELIST) 

clean:
	rm -f  $(LIBOLIST)
	rm -f  $(EXEOLIST)
	rm -f  $(EXELIST)
#	rm -f $(AOBJ)asciitoiwtr.o $(AOBJ)fitstoirdr.o $(AOBJ)fitstoiwtr.o $(AOBJ)toi.o $(AOBJ)toimanager.o $(AOBJ)toiprocessor.o $(AOBJ)toisqfilter.o $(AOBJ)tsttoi.o 

LIBF =  $(SLB)libsophya.so $(SLB)libextsophya.so 
LIBS = -L$(SLB) -lextsophya -lsophya -lpthread -lm 
ifeq ($(MACHEROS),OSF1)
LIBS := $(LIBS) -lfor
endif


$(AOBJ)tstrztoi: $(AOBJ)tstrztoi.o $(AOBJ)rztoi.o $(LIBOLIST)
	$(LINK.cc)  -o $@ $^ $(LIBS)
$(AOBJ)fits2asc: $(AOBJ)fits2asc.o $(LIBOLIST)
	$(LINK.cc)  -o $@ $^ $(LIBS)
$(AOBJ)tsttoi: $(AOBJ)tsttoi.o $(LIBOLIST)
	$(LINK.cc)  -o $@ $^ $(LIBS)
$(AOBJ)tsttoi2: $(AOBJ)tsttoi2.o $(LIBOLIST)
	$(LINK.cc)  -o $@ $^ $(LIBS)

$(AOBJ)tstrztoi.o: tstrztoi.cc rztoi.h $(INCLIST)
$(AOBJ)rztoi.o: rztoi.cc rztoi.h $(INCLIST)
$(AOBJ)fits2asc.o: fits2asc.cc $(INCLIST)
$(AOBJ)tsttoi.o: tsttoi.cc $(INCLIST)
$(AOBJ)tsttoi2.o: tsttoi2.cc $(INCLIST)

 
$(AOBJ)asciitoiwtr.o: asciitoiwtr.cc asciitoiwtr.h toi.h config.h conf.h \
 toiprocessor.h toimanager.h 
$(AOBJ)fitstoirdr.o: fitstoirdr.cc fitstoirdr.h toiprocessor.h config.h conf.h
$(AOBJ)fitstoiwtr.o: fitstoiwtr.cc fitstoiwtr.h toi.h config.h conf.h
$(AOBJ)toi.o: toi.cc toiprocessor.h config.h conf.h toi.h 
$(AOBJ)toimanager.o: toimanager.cc toimanager.h
$(AOBJ)toiprocessor.o: toiprocessor.cc toiprocessor.h config.h conf.h toi.h \
 toimanager.h
$(AOBJ)toisqfilter.o: toisqfilter.cc toisqfilter.h toiprocessor.h config.h \
 conf.h toi.h toimanager.h
$(AOBJ)toiseqbuff.o: toiseqbuff.cc toiprocessor.h config.h conf.h toi.h \
toiseqbuff.h 
