# Makefile for rbo/utils/cpp
# Satofumi KAMIMURA
# $Id$

# Compile options
CC = ${CXX}
CXXFLAGS = -g -O0 -Wall -Werror ${INCLUDES} `cppunit-config --cflags` `sdl-config --cflags`
INCLUDES = -I. -I../c -I../../guiCtrl/cpp -I../../crdCtrl/cpp
LDFLAGS =
LDLIBS = `cppunit-config --libs` `sdl-config --libs` -lSDL_net

# Target
GUI_CPP_LIB = ../../guiCtrl/cpp/guiCtrl.a
CRD_CPP_LIB = ../../crdCtrl/cpp/crdCtrl.a
UTILS_CPP_LIB = utils.a
TARGET = ${UTILS_CPP_LIB}

all : ${TARGET}

test : allTest
	./allTest

clean :
	${RM} ${TARGET} *.o *.tag allTest
	${RM} -rf conf/
	cd doxygen_html/ && ${RM} *.html *.css *.png *.map *.md5 *.dot installdox *.gif
	cd sample/ && ${MAKE} clean

depend :
	makedepend -Y -- ${INCLUDES} -- ${wildcard *.cpp}

html : doxygen_html/index.html
doxygen_html/index.html : Doxyfile ${wildcard *.c *.cpp *.h img/* example/*}
	doxygen

.PHONY : all clean depend
######################################################################
serialDevice.o : serialDevice_lin.cpp serialDevice_win.cpp

${UTILS_CPP_LIB} : \
	${UTILS_CPP_LIB}(typeUtils.o) \
	${UTILS_CPP_LIB}(coordinateTypes.o) \
	${UTILS_CPP_LIB}(typePrint.o) \
	${UTILS_CPP_LIB}(propertyInfo.o) \
	${UTILS_CPP_LIB}(fileUtils.o) \
	${UTILS_CPP_LIB}(timeUtils.o) \
	${UTILS_CPP_LIB}(peerConnection.o) \
	${UTILS_CPP_LIB}(connectionHub.o) \
	${UTILS_CPP_LIB}(serialDevice.o) \
	${UTILS_CPP_LIB}(tcpipDevice.o) \
	${UTILS_CPP_LIB}(tcpipServer.o) \
	${UTILS_CPP_LIB}(connectionDevice.o) \
	${UTILS_CPP_LIB}(sdlBase.o) \

${GUI_CPP_LIB} ${CRD_CPP_LIB} :
	cd ${@D}/ && ${MAKE} ${@F}

allTest.o : ../../unittest/allTest.cpp
	${CXX} ${CXXFLAGS} $< -c -o $@

allTest : \
	CompileTest.o \
	TypeUtilsTest.o \
	RingBufferTest.o \
	FileUtilsTest.o \
	TcpipDeviceTest.o \
	File2GridTest.o \
	File2LineTest.o \
	PropertyInfoTest.o \
	${UTILS_CPP_LIB} ${GUI_CPP_LIB} ${CRD_CPP_LIB} \


# DO NOT DELETE

CompileTest.o: CompileTest.h serialDevice.h connectionDevice.h
CompileTest.o: ringBufferTemplate.h ../c/detect_os.h tcpipDevice.h sdlBase.h
CompileTest.o: timeUtils.h fileUtils.h coordinateTypes.h
CompileTest.o: ../../crdCtrl/cpp/coordinateCtrl.h typeUtils.h
CompileTest.o: ../c/math_util.h
File2GridTest.o: File2GridTest.h file2Grid.h typeUtils.h ../c/math_util.h
File2GridTest.o: ../c/detect_os.h
File2LineTest.o: File2LineTest.h file2Line.h typeUtils.h ../c/math_util.h
File2LineTest.o: ../c/detect_os.h
FileUtilsTest.o: FileUtilsTest.h fileUtils.h
PropertyInfoTest.o: PropertyInfoTest.h propertyInfo.h
RingBufferTest.o: RingBufferTest.h ringBufferTemplate.h
TcpipDeviceTest.o: TcpipDeviceTest.h tcpipServer.h tcpipDevice.h sdlBase.h
TcpipDeviceTest.o: connectionDevice.h ringBufferTemplate.h
TypeUtilsTest.o: TypeUtilsTest.h typeUtils.h ../c/math_util.h
TypeUtilsTest.o: ../c/detect_os.h
connectionDevice.o: connectionDevice.h ringBufferTemplate.h
connectionHub.o: connectionHub.h connectionDevice.h ringBufferTemplate.h
connectionHub.o: tcpipServer.h tcpipDevice.h sdlBase.h serialDevice.h
connectionHub.o: ../c/detect_os.h
coordinateTypes.o: coordinateTypes.h ../../crdCtrl/cpp/coordinateCtrl.h
coordinateTypes.o: typeUtils.h ../c/math_util.h ../c/detect_os.h
fileUtils.o: fileUtils.h ../c/detect_os.h
peerConnection.o: peerConnection.h tcpipDevice.h sdlBase.h connectionDevice.h
peerConnection.o: ringBufferTemplate.h tcpipServer.h
propertyInfo.o: propertyInfo.h fileUtils.h ../c/detect_os.h
sdlBase.o: sdlBase.h
serialDevice.o: ../c/detect_os.h serialDevice_win.cpp serialDevice.h
serialDevice.o: connectionDevice.h ringBufferTemplate.h
serialDevice_lin.o: serialDevice.h connectionDevice.h ringBufferTemplate.h
serialDevice_lin.o: ../c/detect_os.h
serialDevice_win.o: serialDevice.h connectionDevice.h ringBufferTemplate.h
serialDevice_win.o: ../c/detect_os.h
tcpipDevice.o: tcpipDevice.h sdlBase.h connectionDevice.h
tcpipDevice.o: ringBufferTemplate.h
tcpipServer.o: tcpipServer.h tcpipDevice.h sdlBase.h connectionDevice.h
tcpipServer.o: ringBufferTemplate.h ../c/detect_os.h
timeUtils.o: timeUtils.h ../c/detect_os.h
typePrint.o: typePrint.h typeUtils.h ../c/math_util.h ../c/detect_os.h
typeUtils.o: typeUtils.h ../c/math_util.h ../c/detect_os.h
