##########################################################################
# Copyright (c) 1999 MBARI                              
# MBARI Proprietary Information. All rights reserved.   
##########################################################################
# Summary  : Makefile for building complete vehicle code tree
# Filename : Makefile
# Author   : Andrew Pearce
# Project  : 
# Version  : Version 1.0
# Created  : 12/06/99
# Modified : 12/06/99
# Archived :
##########################################################################
# Modification History:
# $Header$
#
##########################################################################

CC	    = cc
CCPP	    = cc
LD	    = cc
AR 	    = wlib
DEPEND_TOOL = makedepend

AUV_BIN_DIR = ../bin

DEBUG 	    = -g
EXCEPTION_HANDLING = -WC,-xs

## OPTIMIZE = -4 -Os
OPTIMIZE = 

## MAP_OUTPUT = -S -ms -M
MAP_OUTPUT =

CFLAGS	    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -D_QNX -DUNIX  
CPPFLAGS    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -D_QNX -DUNIX \
	         $(EXCEPTION_HANDLING)

INCLUDES    = -I.  \
	      -Iutils \
	      -Iframework \
	      -IDataLog \
	      -ItaskIF \
	      -I/usr/include           

CPPFLAGS = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) $(EXCEPTION_HANDLING) -D_QNX 

# Order of directories is important for this build.
# Simulator must come after echoSounder.
DIRS	    =   taskIF \
		framework \
		utils \
		Reson7K \
		framework \
		DataLog \
		crossbow m3dmgx1 \
		DropWeight \
		FuelCell \
		gps \
		newTailCone \
		adaptiveSampler \
		bluefinBatt \
		dock \
		parosci \
		DynamicControl \
		echoSounder \
		EventLog \
		LayeredControl \
		Navigation \
		seabird \
		seabird25p \
		Supervisor \
		SystemInterfaces \
		sysdata \
		VehicleConfiguration \
		WorkSite \
		delta_t \
		dvl \
		fastcat \
		hydroscat \
		lisst \
		isus \
		kearfott \
		apps \
		biolume \
		fan \
		reson6046 \
		edgetechFSDW \
		sonardyne \
		camera \
		Cathx \
		CARL \
		newmat terrainNav terrainAid \
		MbTrnRecv \
		benthos benthosWithAvtrak OCR507 LOPC \
		ExternalComms epiBatt \
		newBatt \
		Ats \
		Simulator \
		vn100

-include autonomy.make # this file contains the general
                       # modifications we want to apply to
                       # all the modules 

#ifeq ($(AUTONOMY), 1)
# following line are more specific to this specific file 
#DIRS := $(DIRS) \
#	StatePublisher \
#	VcsServer \
#	cluster \
#	smartSampler

# end of AUTONOMY specific
#endif 

all:		
		for subdir in $(DIRS); do \
		  cd $$subdir; \
		  if \
		    make all; \
		  then \
		    echo "make succeeded";\
		  else \
		    echo "make failed";\
		    exit; \
		  fi; \
		  cd ..; \
		done
		@echo "That's all folks!"

clean:
		for subdir in $(DIRS); do \
		  (cd $$subdir; make clean; echo ; cd ..); \
		done
		rm -f core $(OBJS) $(OBJS:.o=.d) *.lib *.yy *.tab.* 


update:
		for subdir in $(DIRS); do \
		  (cd $$subdir; cvs update; echo ; cd ..); \
		done

commit:
		for subdir in $(DIRS); do \
		  (cd $$subdir; cvs commit; echo ; cd ..); \
		done

install:
		for subdir in $(DIRS); do \
		  cd $$subdir; \
		  make install AUV_BIN_DIR=../bin; \
		  echo; \
		  cd ..; \
		done

install_target:
		cp bin/* //1/home/dorado1/auv/altex/onboard/bin

release:
		for subdir in $(DIRS); do \
		  cd $$subdir; \
		  make install AUV_BIN_DIR=$(AUV_BIN_DIR); \
		  echo; \
		  cd ..; \
		done

##########################################################################
# Do not modify anything below this line unless absolutely necessary

.SUFFIXES:
.SUFFIXES:	.o .c .cc .d .idl

%.d: %.c
	    @echo Generating dependencies for $?
	    @$(DEPEND_TOOL) $(INCLUDES) $? -f $@

%.d: %.cc
	    @echo Generating dependencies for $?
	    @$(DEPEND_TOOL) $(INCLUDES) $? -f $@ 

%.o: %.c 
	    @$(CC) $(CFLAGS) $(INCLUDES) $< -o $@	
	    @echo
%.o: %.cc
	    @$(CCPP) $(CPPFLAGS) $(INCLUDES) $< -o $@
	    @echo

DEST	    = .

MAKEFILE    = Makefile

depend:	

##########################################################################
# DO NOT DELETE THIS LINE -- make depend depends on it.
