
CXX=g++
CXXFLAGS = -W -Wall -g
BIN_DIR = ../../bin
SRC_DIR = ../../src/parser

OBJECT_FILE = 	Line.o				\
	      	TokenSource.o 			\
	      	ParserDefinitionDecoder.o 	\
		Message.o 			\
		Errors.o 			\
		Definition.o 			\
		ParserEventDecoder.o		\
		ParserPaje.o 			\
		Trace.o 			\
		Color.o 			\
		Date.o 				\
		Double.o 			\
		Integer.o 			\
		Hex.o 				\
		Name.o 				\
		String.o

OBJECT_FILE = Line.o ParserDefinitionDecoder.o TokenSource.o Definition.o ParserEventDecoder.o ParserPaje.o Trace.o Color.o Date.o Double.o Integer.o Hex.o Name.o String.o

TEST_FLAGS = -DVITE_DEBUG

## Qt include path
INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I/usr/include/qt4/QtUiTools -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4
## Qt libs
LIBS          = -L/usr/lib -L/usr/X11R6/lib -lglut -lGLEW -lQtXml -lQtOpenGL -lQtGui -lQtCore -lQtUiTools -lGLU -lGL -lpthread



# Making
all:	make_src test_token test_ligne test_parser_definition test_parser_evenement test_parser_paje

# All the source files is compiled
make_src:  Message.o Errors.o $(OBJECT_FILE)

test_token:		test_token.cpp
		$(CXX) $(CXXFLAGS) $< -o $@ $(TEST_FLAGS) $(INCPATH) $(BIN_DIR)TokenSource.o $(BIN_DIR)Message.o $(BIN_DIR)Errors.o

test_ligne:	test_ligne.cpp
		$(CXX) $(CXXFLAGS) $< -o $@ $(TEST_FLAGS) $(INCPATH) $(BIN_DIR)Line.o $(BIN_DIR)TokenSource.o $(BIN_DIR)Message.o $(BIN_DIR)Errors.o

test_parser_definition:		test_parser_definition.cpp
		$(CXX) $(CXXFLAGS) $< -o $@ $(OBJECT_FILE_BIN) $(TEST_FLAGS) $(INCPATH)

test_parser_evenement:	test_parser_event.cpp
		$(CXX) $(CXXFLAGS) $< -o $@ $(OBJECT_FILE_BIN) $(TEST_FLAGS) $(INCPATH)


%.o:$(SRC_DIR)%.cpp $(SRC_DIR)%.hpp
	$(CXX) -c $(CXXFLAGS) $< -o $(BIN_DIR)$@ $(TEST_FLAGS)

$(BINDIR)/Message.o: ../../src/message/Message.cpp  ../../src/message/Message.hpp
$(BINDIR)/Trace.o:   ../stubs/Trace.cpp   ../stubs/Trace.hpp
$(BINDIR)/Color.o:   ../stubs/Color.cpp   ../stubs/Color.hpp
$(BINDIR)/Date.o:    ../stubs/Date.cpp    ../stubs/Date.hpp
$(BINDIR)/Double.o:  ../stubs/Double.cpp  ../stubs/Double.hpp
$(BINDIR)/Integer.o: ../stubs/Integer.cpp ../stubs/Integer.hpp
$(BINDIR)/Hex.o:     ../stubs/Hex.cpp     ../stubs/Hex.hpp
$(BINDIR)/Name.o:    ../stubs/Name.cpp    ../stubs/Name.hpp
$(BINDIR)/String.o:  ../stubs/String.cpp  ../stubs/String.hpp
$(BINDIR)/Errors.o:  ../stubs/Errors.cpp  ../stubs/Errors.hpp

$(BINDIR)/%.o:
	$(CXX) -c $(CXXFLAGS) $< -o $@ $(TEST_FLAGS)

test_parser_paje:		test_parser_paje.cpp
		$(CXX) $(CXXFLAGS) $< -o $@ $(OBJECT_FILE_BIN) $(TEST_FLAGS) $(INCPATH)

clean:	
		$(RM) $(BIN_DIR)*.o *.*~ Makefile~

distclean:	clean
		$(RM) test_token test_ligne test_parser_definition test_parser_evenement test_parser_paje
