include ../../makefile.dep

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

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

TARGETS = depthcng badbin unbadbin blkscan botmpas3 \
	  fix_temp fix_hdg flag getmat last_85 \
	  logscan set_top updscan dbupdate fillgap \
	  newflag setflags set_lgb


all:	$(TARGETS)

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

LIBS3	      = $(LIBDIR)/matlab$(LIB) \
		$(LIBDIR)/vector$(LIB) \
      $(LIBDIR)/use_db$(LIB) \
		$(LIBDIR)/dbsource$(LIB) \
		$(LIBDIR)/ioserv$(LIB)

LIBS4	      =  \
		$(LIBDIR)/vector$(LIB) \
      $(LIBDIR)/use_db$(LIB) \
		$(LIBDIR)/dbsource$(LIB) \
		$(LIBDIR)/ioserv$(LIB)



depthcng   : $(BINDIR)/depthcng$(EXE)
depthcngOBJECTS = depthcng$(OBJ)
$(BINDIR)/depthcng$(EXE): $(depthcngOBJECTS)
	$(CCLINK) -o $@ $(depthcngOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

badbin	 : $(BINDIR)/badbin$(EXE)
badbinOBJECTS = badbin$(OBJ) dbedit$(OBJ)
$(BINDIR)/badbin$(EXE): $(badbinOBJECTS)
	$(CCLINK) -o $@ $(badbinOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

unbadbin   : $(BINDIR)/unbadbin$(EXE)
unbadbinOBJECTS =  unbadbin$(OBJ) dbedit$(OBJ)
$(BINDIR)/unbadbin$(EXE): $(unbadbinOBJECTS)
	$(CCLINK) -o $@ $(unbadbinOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

blkscan   : $(BINDIR)/blkscan$(EXE)
blkscanOBJECTS = blkscan$(OBJ)	 dbedit$(OBJ)
$(BINDIR)/blkscan$(EXE): $(blkscanOBJECTS)
	$(CCLINK) -o $@ $(blkscanOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

botmpas3   : $(BINDIR)/botmpas3$(EXE)
botmpas3OBJECTS = botmpas3$(OBJ) dbedit$(OBJ)
$(BINDIR)/botmpas3$(EXE): $(botmpas3OBJECTS)
	$(CCLINK) -o $@ $(botmpas3OBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

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

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

flag   : $(BINDIR)/flag$(EXE)
flagOBJECTS = flag$(OBJ) dbedit$(OBJ) $(LIBDIR)/main_cnt$(OBJ)
$(BINDIR)/flag$(EXE): $(flagOBJECTS)
	$(CCLINK) -o $@ $(flagOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

getmat	 : $(BINDIR)/getmat$(EXE)
getmatOBJECTS = getmat$(OBJ) dbedit$(OBJ)
$(BINDIR)/getmat$(EXE): $(getmatOBJECTS)
	$(CCLINK) -o $@ $(getmatOBJECTS) $(LIBS3) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

last_85   : $(BINDIR)/last_85$(EXE)
last_85OBJECTS = last_85$(OBJ) dbedit$(OBJ)
$(BINDIR)/last_85$(EXE): $(last_85OBJECTS)
	$(CCLINK) -o $@ $(last_85OBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

logscan   : $(BINDIR)/logscan$(EXE)
logscanOBJECTS = logscan$(OBJ) dbedit$(OBJ)
$(BINDIR)/logscan$(EXE): $(logscanOBJECTS)
	$(CCLINK) -o $@ $(logscanOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

set_top   : $(BINDIR)/set_top$(EXE)
set_topOBJECTS = set_top$(OBJ) $(LIBDIR)/main_cnt$(OBJ)
$(BINDIR)/set_top$(EXE): $(set_topOBJECTS)
	$(CCLINK) -o $@ $(set_topOBJECTS) $(LIBS4) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

updscan   : $(BINDIR)/updscan$(EXE)
updscanOBJECTS = updscan$(OBJ) dbedit$(OBJ)
$(BINDIR)/updscan$(EXE): $(updscanOBJECTS)
	$(CCLINK) -o $@ $(updscanOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

dbupdate   : $(BINDIR)/dbupdate$(EXE)
dbupdateOBJECTS = dbupdate$(OBJ) dbedit$(OBJ)
$(BINDIR)/dbupdate$(EXE): $(dbupdateOBJECTS)
	$(CCLINK) -o $@ $(dbupdateOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

fillgap   : $(BINDIR)/fillgap$(EXE)
fillgapOBJECTS = fillgap$(OBJ)	 dbedit$(OBJ)
$(BINDIR)/fillgap$(EXE): $(fillgapOBJECTS)
	$(CCLINK) -o $@ $(fillgapOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

newflag   : $(BINDIR)/newflag$(EXE)
newflagOBJECTS = newflag$(OBJ)	 dbedit$(OBJ) $(LIBDIR)/main_cnt$(OBJ)
$(BINDIR)/newflag$(EXE): $(newflagOBJECTS)
	$(CCLINK) -o $@ $(newflagOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@

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

set_lgb   : $(BINDIR)/set_lgb$(EXE)
set_lbgOBJECTS = set_lgb$(OBJ)	 dbedit$(OBJ)
$(BINDIR)/set_lgb$(EXE): $(set_lbgOBJECTS)
	$(CCLINK) -o $@ $(set_lbgOBJECTS) $(LIBS1) $(LDLIBS)
	$(CHMOD) $(BIN_PERMISSION) $@


clean:
	$(RM) $(DIRT)
#
