##########################################################################
# Copyright 2018 MBARI                                             
##########################################################################
# Summary  : Makefile for QNX-additions for Linux
# Filename : Makefile
# Author   : Henthorn
# Project  : 
# Version  : Version 1.0
# Created  : 11/20/2018
# Modified : 11/20/2018
# Archived :
##########################################################################
# Modification History:
#
##########################################################################

CC	    = g++
CCPP	    = g++
LD	    = gcc

DEBUG 	    = -g
#EXCEPTION_HANDLING = -WC,-xs

## OPTIMIZE = -4 -Os
OPTIMIZE = 

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

CFLAGS	    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -DUNIX 
CPPFLAGS    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -DUNIX
#
# Comment out unless For Mac:
#CFLAGS	    += -D_MAC
#CPPFLAGS   += -D_MAC

#	         $(EXCEPTION_HANDLING)

INCLUDES    = -I.  \
	      -I/usr/include           

LIBS 			= -L. -lqnx

LDFLAGS	    = -g
LIBPATH	    = /usr/lib:.

OBJS	    =	AsciiFile.o \
		AngleData.o \
		CharData.o \
		BinaryFile.o \
		DataLog.o \
		DataLogReader.o \
		DataLogWriter.o \
		FileData.o \
		StringConverter.o \
		StringData.o \
		TimeP.o \
		TimeTag.o \
		ShortData.o \
		Math.o \
		NavUtils.o \
		IntegerData.o \
		FloatData.o \
		DoubleData.o \
		DataField.o \
		DataFieldFactory.o \
		LogFile.o 

TARGETS = 	libqnx.a readlog writelog logToMatlab logToCsv

all:		$(TARGETS)

libqnx.a:	$(OBJS)
		ar rcs libqnx.a $(OBJS)
		ranlib libqnx.a


readlog:	readlog.o $(OBJS)
		g++ readlog.o $(LIBS) -lm -o readlog


writelog:	writelog.o $(OBJS)
		g++ writelog.o $(LIBS) -lm -o writelog


logToMatlab:	logToMatlab.o $(OBJS)
		g++ logToMatlab.o $(LIBS) -lm -o logToMatlab


logToCsv:	logToCsv.o $(OBJS)
		g++ logToCsv.o $(LIBS) -lm -o logToCsv


install:


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

.SUFFIXES:
.SUFFIXES:	.o .c .cc

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

DEST	    = .

MAKEFILE    = Makefile

#include       $(OBJS:.o=.d)

clean:
	rm -f core *.o $(OBJS:.o=.d) *.lib *.yy *.tab.* $(TARGETS)

update:
	cvs update $(CC_SRCS) $MAKEFILE

commit:
	cvs commit $(CC_SRCS) $MAKEFILE

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

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










# DO NOT DELETE
