include ../../makefile.dep

LIBDIR= ../../lib/$(HOST)
BINDIR= ../../bin/$(HOST)

INCLUDES      =  -I../include  -I../../include

TARGETS = arrdep refabsbt timslip rotate rotnav

all:	$(TARGETS)

LIBS1	      =  \
		$(LIBDIR)/vstat$(LIB) \
		$(LIBDIR)/use_adcp$(LIB) \
		$(LIBDIR)/matlab$(LIB) \
      $(LIBDIR)/use_db$(LIB) \
		$(LIBDIR)/dbsource$(LIB) \
		$(LIBDIR)/ioserv$(LIB)

# Not all the targets really need the full list; but
# it does not take much time to check the whole list,
# and using a single list simplifies the makefile!

arrdep	 : $(BINDIR)/arrdep$(EXE)
arrdepOBJECTS = arrdep$(OBJ) get_ref$(OBJ) read_ref$(OBJ) is_jump$(OBJ) \
		$(LIBDIR)/main_cnt$(OBJ)
$(BINDIR)/arrdep$(EXE): $(arrdepOBJECTS)
	$(CCLINK) -o $@ $(arrdepOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

refabsbt   : $(BINDIR)/refabsbt$(EXE)
refabsbt.c : refabinc.c
	touch $@
refabsbtOBJECTS = refabsbt$(OBJ) read_ref$(OBJ) fix2vel$(OBJ) \
		$(LIBDIR)/main_cnt$(OBJ)
$(BINDIR)/refabsbt$(EXE): $(refabsbtOBJECTS)
	$(CCLINK) -o $@ $(refabsbtOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

timslip   : $(BINDIR)/timslip$(EXE)
timslipOBJECTS = timslip$(OBJ) vrefabs$(OBJ) brent$(OBJ) fix2vel$(OBJ)\
	 is_jump$(OBJ) is_turn$(OBJ) get_ref$(OBJ) read_ref$(OBJ) \
	 $(LIBDIR)/main_cnt$(OBJ)
$(BINDIR)/timslip$(EXE): $(timslipOBJECTS)
	$(CCLINK) -o $@ $(timslipOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

rotate	 : $(BINDIR)/rotate$(EXE)
rotateOBJECTS = rotate$(OBJ) $(LIBDIR)/main_cnt$(OBJ)
$(BINDIR)/rotate$(EXE): $(rotateOBJECTS)
	$(CCLINK) -o $@ $(rotateOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

rotnav	 : $(BINDIR)/rotnav$(EXE)
rotnavOBJECTS = rotnav$(OBJ) $(LIBDIR)/main_cnt$(OBJ)
$(BINDIR)/rotnav$(EXE): $(rotnavOBJECTS)
	$(CCLINK) -o $@ $(rotnavOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

clean:
	$(RM) $(DIRT)
#
