#Makefile for OCRchie 

CC	= cxx
CPP     = cpp

DEBUG	= -g
OPTIMIZE = -O
CCFLAGS = $(DEBUG)
EXECUTABLE = ocr
INCLUDE = /usr/include/cxx ..

# math library directory
#MATHLIB = /lib/pa1.1

point.o: point.cpp point.h point.inl
	$(CC) $(CCFLAGS) -c point.cpp -o point.o -I${INCLUDE}


# That's it.  Now just do a gmake.

INCLUDE	= -I/usr/include/cxx -I/usr/local/include -I..
LIBDIRS	= -L../itk
LIBS	= ${LIBDIRS} -lm -ltiff -litk
#HEADERS		= system.h list.h Component.h  \
#		  BitMap.h RLEPair.h RLEMap.h LineMarker.h Page.h Point.h \
#		  convertMap.h Component.h Word.h


OFILES = 	    main.o project.o histogram.o \
		    get_skew.o \
		    RLEMap.o RLEPair.o list.o \
		    convertMap.o Component.o Page.o\
		    BitMap.o system.o \
		    Word.o learn.o

#The Executable project
ocr:	    $(OFILES)
		    $(CC) -g -o $(EXECUTABLE) ${INCLUDE} $(OFILES) $(LIBS)
		    strip $(EXECUTABLE)


# The .o files compiled in ODIR because of space considerations

system.o:	system.cc system.h
		$(CC) $(CCFLAGS) -o system.o -c ${INCLUDE} system.cc

Page.o:		Page.cc Page.h RLEMap.h RLEPair.h BitMap.h system.h \
                Component.h LineMarker.h Word.h convertMap.h
		$(CC) $(CCFLAGS) -o Page.o -c ${INCLUDE} Page.cc

RLEMap.o: 	system.cc RLEMap.cc  RLEPair.cc RLEMap.h RLEPair.h
		$(CC) $(CCFLAGS) -o RLEMap.o -c ${INCLUDE} RLEMap.cc

BitMap.o:	BitMap.cc BitMap.h system.h
		$(CC) $(CCFLAGS) -o BitMap.o -c ${INCLUDE} BitMap.cc

RLEPair.o:	RLEPair.cc RLEPair.h
		$(CC) $(CCFLAGS) -o RLEPair.o -c ${INCLUDE} RLEPair.cc

Component.o:	Component.cc Component.h system.h list.h RLEMap.h
		$(CC) $(CCFLAGS) -o Component.o -c ${INCLUDE} Component.cc

list.o:		list.h list.cc
		$(CC) $(CCFLAGS) -o list.o -c ${INCLUDE} list.cc

Word.o:		Word.h Component.h list.h list.cc
		$(CC) $(CCFLAGS) -o Word.o -c ${INCLUDE} Word.cc

convertMap.o:   convertMap.cc convertMap.h
		$(CC) $(CCFLAGS) -o convertMap.o -c ${INCLUDE} convertMap.cc

bitprint.o:	bitprint.h bitprint.cc
		$(CC) $(CCFLAGS) -o bitprint.o -c ${INCLUDE} bitprint.cc

learn.o:	system.h learn.h learn.cc
		$(CC) $(CCFLAGS) -o learn.o -c ${INCLUDE} learn.cc

main.o:	main.cc 
	$(CC) $(CCFLAGS) -o main.o -c ${INCLUDE} main.cc

project.o:	project.cc project.h BitMap.h RLEMap.h histogram.h
	$(CC) $(CCFLAGS) -o project.o -c ${INCLUDE} project.cc


histogram.o:	histogram.cc histogram.h
	$(CC) $(CCFLAGS) -o histogram.o -c ${INCLUDE} histogram.cc

get_skew.o:	get_skew.cc get_skew.h project.h histogram.h
	$(CC) $(CCFLAGS) -o get_skew.o -c ${INCLUDE} get_skew.cc


clean:		
		rm -f core *.o *~ ocr
#