# Makefile for develop/utils/c
# Satofumi KAMIMURA
# $Id$

# Compile options
CC = gcc
CFLAGS = -g -O0 -Wall -W -Werror $(INCLUDES) `sdl-config --cflags`
CXXFLAGS = $(CFLAGS) `cppunit-config --cflags`
INCLUDES = -I. -I../cpp
LDFLAGS =
LDLIBS = `cppunit-config --libs` `sdl-config --libs` -lSDL_net

# Target
UTILS_C_LIB = utils_c.a
TARGET = allTest $(UTILS_C_LIB)

all : $(TARGET)
	./allTest

clean :
	$(RM) $(TARGET) *.o
	cd sample/ && $(MAKE) clean
#	cd doxygen_html/ && $(RM) *.html *.css *.png *.map *.md5 *.dot installdox
depend :
	makedepend -Y -- $(INCLUDES) -- $(wildcard *.cpp *.c *.h)

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

.PHONY : all clean depend
######################################################################
serial_device.o : serial_device.c serial_device_lin.c serial_device_win.c

$(UTILS_C_LIB) : \
	$(UTILS_C_LIB)(connect_device.o) \
	$(UTILS_C_LIB)(serial_device.o) \
	$(UTILS_C_LIB)(tcpip_device.o) \
	$(UTILS_C_LIB)(get_keyword.o) \

allTest.o : ../../../../../unittest/allTest.cpp
	$(CXX) $(CXXFLAGS) $< -c -o $@

../cpp/tcpipServer.o ../cpp/tcpipDevice.o ../cpp/sdlBase.o ../connectionDevice.o :
	cd $(@D)/ && $(MAKE) $(@F)

allTest : \
	ringBuffer.o RingBufferTest.o \
	movingAverage.o MovingAverageTest.o \
	../cpp/connectionDevice.o ../cpp/tcpipServer.o \
	../cpp/tcpipDevice.o ../cpp/sdlBase.o \
	tcpip_device.o TcpipDeviceTest.o \

# DO NOT DELETE

MovingAverageTest.o: MovingAverageTest.h movingAverage.h cpp_extern_macro.h
RingBufferTest.o: RingBufferTest.h ringBuffer.h cpp_extern_macro.h
TcpipDeviceTest.o: TcpipDeviceTest.h ../cpp/tcpipServer.h
TcpipDeviceTest.o: ../cpp/tcpipDevice.h ../cpp/sdlBase.h
TcpipDeviceTest.o: ../cpp/connectionDevice.h ../cpp/ringBufferTemplate.h
TcpipDeviceTest.o: tcpip_device.h cpp_extern_macro.h
connect_device.o: connect_device.h cpp_extern_macro.h tcpip_device.h
connect_device.o: serial_device.h
get_keyword.o: get_keyword.h
movingAverage.o: movingAverage.h cpp_extern_macro.h
ringBuffer.o: ringBuffer.h cpp_extern_macro.h
serial_device.o: detect_os.h serial_device_win.c
serial_device_lin.o: serial_device.h cpp_extern_macro.h connect_device.h
tcpip_device.o: tcpip_device.h cpp_extern_macro.h connect_device.h
tcpip_device.o: detect_os.h
MovingAverageTest.o: movingAverage.h cpp_extern_macro.h
RingBufferTest.o: ringBuffer.h cpp_extern_macro.h
connect_device.o: cpp_extern_macro.h
math_util.o: detect_os.h
movingAverage.o: cpp_extern_macro.h
ringBuffer.o: cpp_extern_macro.h
serial_device.o: cpp_extern_macro.h
tcpip_device.o: cpp_extern_macro.h
