#
#  Makefile to compile a version of FTGL with the FLTK 2 OpenGL Access Library.
#
#configfile=../server/fltk_config.make
configfile=../fltk_config.make

include	$(configfile)

OBJ	=	obj
TLIB	=	../lib
TINC	=	../include
SRC	=	src
TMP	=	tmp

INS	=	-I/usr/include/freetype2

AR	=	ar

A_FLAGS	=	-r

CXXFLAG	=	-DHAVE_CONFIG_H -I./ $(INS) $(CXXFLG)


SRC_HEADERS = \
    $(SRC)/FTGL/ftgl.h \
    $(SRC)/FTGL/FTBBox.h \
    $(SRC)/FTGL/FTBuffer.h \
    $(SRC)/FTGL/FTPoint.h \
    $(SRC)/FTGL/FTGlyph.h \
    $(SRC)/FTGL/FTBitmapGlyph.h \
    $(SRC)/FTGL/FTBufferGlyph.h \
    $(SRC)/FTGL/FTExtrdGlyph.h \
    $(SRC)/FTGL/FTOutlineGlyph.h \
    $(SRC)/FTGL/FTPixmapGlyph.h \
    $(SRC)/FTGL/FTPolyGlyph.h \
    $(SRC)/FTGL/FTTextureGlyph.h \
    $(SRC)/FTGL/FTFont.h \
    $(SRC)/FTGL/FTGLBitmapFont.h \
    $(SRC)/FTGL/FTBufferFont.h \
    $(SRC)/FTGL/FTGLExtrdFont.h \
    $(SRC)/FTGL/FTGLOutlineFont.h \
    $(SRC)/FTGL/FTGLPixmapFont.h \
    $(SRC)/FTGL/FTGLPolygonFont.h \
    $(SRC)/FTGL/FTGLTextureFont.h \
    $(SRC)/FTGL/FTLayout.h \
    $(SRC)/FTGL/FTSimpleLayout.h \
    ${NULL}

SRC_GLYPH = \
    $(SRC)/FTGlyph/FTGlyph.cpp \
    $(SRC)/FTGlyph/FTGlyphImpl.h \
    $(SRC)/FTGlyph/FTGlyphGlue.cpp \
    $(SRC)/FTGlyph/FTBitmapGlyph.cpp \
    $(SRC)/FTGlyph/FTBitmapGlyphImpl.h \
    $(SRC)/FTGlyph/FTBufferGlyph.cpp \
    $(SRC)/FTGlyph/FTBufferGlyphImpl.h \
    $(SRC)/FTGlyph/FTExtrudeGlyph.cpp \
    $(SRC)/FTGlyph/FTExtrudeGlyphImpl.h \
    $(SRC)/FTGlyph/FTOutlineGlyph.cpp \
    $(SRC)/FTGlyph/FTOutlineGlyphImpl.h \
    $(SRC)/FTGlyph/FTPixmapGlyph.cpp \
    $(SRC)/FTGlyph/FTPixmapGlyphImpl.h \
    $(SRC)/FTGlyph/FTPolygonGlyph.cpp \
    $(SRC)/FTGlyph/FTPolygonGlyphImpl.h \
    $(SRC)/FTGlyph/FTTextureGlyph.cpp \
    $(SRC)/FTGlyph/FTTextureGlyphImpl.h \
    $(NULL)

SRC_FONT = \
    $(SRC)/FTFont/FTFont.cpp \
    $(SRC)/FTFont/FTFontImpl.h \
    $(SRC)/FTFont/FTFontGlue.cpp \
    $(SRC)/FTFont/FTBitmapFont.cpp \
    $(SRC)/FTFont/FTBitmapFontImpl.h \
    $(SRC)/FTFont/FTBufferFont.cpp \
    $(SRC)/FTFont/FTBufferFontImpl.h \
    $(SRC)/FTFont/FTExtrudeFont.cpp \
    $(SRC)/FTFont/FTExtrudeFontImpl.h \
    $(SRC)/FTFont/FTOutlineFont.cpp \
    $(SRC)/FTFont/FTOutlineFontImpl.h \
    $(SRC)/FTFont/FTPixmapFont.cpp \
    $(SRC)/FTFont/FTPixmapFontImpl.h \
    $(SRC)/FTFont/FTPolygonFont.cpp \
    $(SRC)/FTFont/FTPolygonFontImpl.h \
    $(SRC)/FTFont/FTTextureFont.cpp \
    $(SRC)/FTFont/FTTextureFontImpl.h \
    $(NULL)

SRC_LAYOUT = \
    $(SRC)/FTLayout/FTLayout.cpp \
    $(SRC)/FTLayout/FTLayoutImpl.h \
    $(SRC)/FTLayout/FTLayoutGlue.cpp \
    $(SRC)/FTLayout/FTSimpleLayout.cpp \
    $(SRC)/FTLayout/FTSimpleLayoutImpl.h \
    $(NULL)


SRC_BASE = \
    $(SRC)/FTBuffer.cpp \
    $(SRC)/FTCharmap.cpp \
    $(SRC)/FTCharmap.h \
    $(SRC)/FTCharToGlyphIndexMap.h \
    $(SRC)/FTContour.cpp \
    $(SRC)/FTContour.h \
    $(SRC)/FTFace.cpp \
    $(SRC)/FTFace.h \
    $(SRC)/FTGlyphContainer.cpp \
    $(SRC)/FTGlyphContainer.h \
    $(SRC)/FTInternals.h \
    $(SRC)/FTLibrary.cpp \
    $(SRC)/FTLibrary.h \
    $(SRC)/FTList.h \
    $(SRC)/FTPoint.cpp \
    $(SRC)/FTSize.cpp \
    $(SRC)/FTSize.h \
    $(SRC)/FTVector.h \
    $(SRC)/FTVectoriser.cpp \
    $(SRC)/FTVectoriser.h \
    $(SRC)/FTUnicode.h \
    $(NULL)


TMP_HEADERS = \
    $(TMP)/FTGL/ftgl.h \
    $(TMP)/FTGL/FTBBox.h \
    $(TMP)/FTGL/FTBuffer.h \
    $(TMP)/FTGL/FTPoint.h \
    $(TMP)/FTGL/FTGlyph.h \
    $(TMP)/FTGL/FTBitmapGlyph.h \
    $(TMP)/FTGL/FTBufferGlyph.h \
    $(TMP)/FTGL/FTExtrdGlyph.h \
    $(TMP)/FTGL/FTOutlineGlyph.h \
    $(TMP)/FTGL/FTPixmapGlyph.h \
    $(TMP)/FTGL/FTPolyGlyph.h \
    $(TMP)/FTGL/FTTextureGlyph.h \
    $(TMP)/FTGL/FTFont.h \
    $(TMP)/FTGL/FTGLBitmapFont.h \
    $(TMP)/FTGL/FTBufferFont.h \
    $(TMP)/FTGL/FTGLExtrdFont.h \
    $(TMP)/FTGL/FTGLOutlineFont.h \
    $(TMP)/FTGL/FTGLPixmapFont.h \
    $(TMP)/FTGL/FTGLPolygonFont.h \
    $(TMP)/FTGL/FTGLTextureFont.h \
    $(TMP)/FTGL/FTLayout.h \
    $(TMP)/FTGL/FTSimpleLayout.h \
    ${NULL}

TMP_SRC = \
    $(TMP)/FTGL/ftgl.h \
    $(TMP)/FTGL/FTBBox.h \
    $(TMP)/FTGL/FTBuffer.h \
    $(TMP)/FTGL/FTPoint.h \
    $(TMP)/FTGL/FTGlyph.h \
    $(TMP)/FTGL/FTBitmapGlyph.h \
    $(TMP)/FTGL/FTBufferGlyph.h \
    $(TMP)/FTGL/FTExtrdGlyph.h \
    $(TMP)/FTGL/FTOutlineGlyph.h \
    $(TMP)/FTGL/FTPixmapGlyph.h \
    $(TMP)/FTGL/FTPolyGlyph.h \
    $(TMP)/FTGL/FTTextureGlyph.h \
    $(TMP)/FTGL/FTFont.h \
    $(TMP)/FTGL/FTGLBitmapFont.h \
    $(TMP)/FTGL/FTBufferFont.h \
    $(TMP)/FTGL/FTGLExtrdFont.h \
    $(TMP)/FTGL/FTGLOutlineFont.h \
    $(TMP)/FTGL/FTGLPixmapFont.h \
    $(TMP)/FTGL/FTGLPolygonFont.h \
    $(TMP)/FTGL/FTGLTextureFont.h \
    $(TMP)/FTGL/FTLayout.h \
    $(TMP)/FTGL/FTSimpleLayout.h \
    $(TMP)/FTGlyph.cpp \
    $(TMP)/FTGlyphImpl.h \
    $(TMP)/FTGlyphGlue.cpp \
    $(TMP)/FTBitmapGlyph.cpp \
    $(TMP)/FTBitmapGlyphImpl.h \
    $(TMP)/FTBufferGlyph.cpp \
    $(TMP)/FTBufferGlyphImpl.h \
    $(TMP)/FTExtrudeGlyph.cpp \
    $(TMP)/FTExtrudeGlyphImpl.h \
    $(TMP)/FTOutlineGlyph.cpp \
    $(TMP)/FTOutlineGlyphImpl.h \
    $(TMP)/FTPixmapGlyph.cpp \
    $(TMP)/FTPixmapGlyphImpl.h \
    $(TMP)/FTPolygonGlyph.cpp \
    $(TMP)/FTPolygonGlyphImpl.h \
    $(TMP)/FTTextureGlyph.cpp \
    $(TMP)/FTTextureGlyphImpl.h \
    $(TMP)/FTFont.cpp \
    $(TMP)/FTFontImpl.h \
    $(TMP)/FTFontGlue.cpp \
    $(TMP)/FTBitmapFont.cpp \
    $(TMP)/FTBitmapFontImpl.h \
    $(TMP)/FTBufferFont.cpp \
    $(TMP)/FTBufferFontImpl.h \
    $(TMP)/FTExtrudeFont.cpp \
    $(TMP)/FTExtrudeFontImpl.h \
    $(TMP)/FTOutlineFont.cpp \
    $(TMP)/FTOutlineFontImpl.h \
    $(TMP)/FTPixmapFont.cpp \
    $(TMP)/FTPixmapFontImpl.h \
    $(TMP)/FTPolygonFont.cpp \
    $(TMP)/FTPolygonFontImpl.h \
    $(TMP)/FTTextureFont.cpp \
    $(TMP)/FTTextureFontImpl.h \
    $(TMP)/FTLayout.cpp \
    $(TMP)/FTLayoutImpl.h \
    $(TMP)/FTLayoutGlue.cpp \
    $(TMP)/FTSimpleLayout.cpp \
    $(TMP)/FTSimpleLayoutImpl.h \
    $(TMP)/FTBuffer.cpp \
    $(TMP)/FTCharmap.cpp \
    $(TMP)/FTCharmap.h \
    $(TMP)/FTCharToGlyphIndexMap.h \
    $(TMP)/FTContour.cpp \
    $(TMP)/FTContour.h \
    $(TMP)/FTFace.cpp \
    $(TMP)/FTFace.h \
    $(TMP)/FTGlyphContainer.cpp \
    $(TMP)/FTGlyphContainer.h \
    $(TMP)/FTInternals.h \
    $(TMP)/FTLibrary.cpp \
    $(TMP)/FTLibrary.h \
    $(TMP)/FTList.h \
    $(TMP)/FTPoint.cpp \
    $(TMP)/FTSize.cpp \
    $(TMP)/FTSize.h \
    $(TMP)/FTVector.h \
    $(TMP)/FTVectoriser.cpp \
    $(TMP)/FTVectoriser.h \
    $(TMP)/FTUnicode.h \
    $(NULL)


OBJ_GLYPH = \
    $(OBJ)/FTBitmapGlyph.o \
    $(OBJ)/FTBufferGlyph.o \
    $(OBJ)/FTExtrudeGlyph.o \
    $(OBJ)/FTOutlineGlyph.o \
    $(OBJ)/FTGlyph.o \
    $(OBJ)/FTGlyphGlue.o \
    $(OBJ)/FTPixmapGlyph.o \
    $(OBJ)/FTPolygonGlyph.o \
    $(OBJ)/FTTextureGlyph.o \
    $(NULL)


OBJ_FONT = \
    $(OBJ)/FTBitmapFont.o \
    $(OBJ)/FTBufferFont.o \
    $(OBJ)/FTExtrudeFont.o \
    $(OBJ)/FTFont.o \
    $(OBJ)/FTFontGlue.o \
    $(OBJ)/FTOutlineFont.o \
    $(OBJ)/FTPixmapFont.o \
    $(OBJ)/FTPolygonFont.o \
    $(OBJ)/FTTextureFont.o \
    $(NULL)


OBJ_LAYOUT = \
    $(OBJ)/FTLayout.o \
    $(OBJ)/FTLayoutGlue.o \
    $(OBJ)/FTSimpleLayout.o \
    $(NULL)


OBJ_BASE = \
    $(OBJ)/FTBuffer.o \
    $(OBJ)/FTCharmap.o \
    $(OBJ)/FTContour.o \
    $(OBJ)/FTFace.o \
    $(OBJ)/FTGlyphContainer.o \
    $(OBJ)/FTLibrary.o \
    $(OBJ)/FTPoint.o \
    $(OBJ)/FTSize.o \
    $(OBJ)/FTVectoriser.o \
    $(NULL)


OBJS = \
    $(OBJ_GLYPH) \
    $(OBJ_FONT) \
    $(OBJ_LAYOUT) \
    $(OBJ_BASE) \
    $(NULL)


FNT_HEADERS = \
    $(TMP)/FTUnicode.h \
    $(TMP)/FTBitmapFontImpl.h \
    $(TMP)/FTExtrudeFontImpl.h \
    $(TMP)/FTOutlineFontImpl.h \
    $(TMP)/FTPixmapFontImpl.h \
    $(TMP)/FTPolygonFontImpl.h \
    $(TMP)/FTTextureFontImpl.h \
    $(NULL)



all:		tmp_src $(TLIB)/libftgl.a

clean:		
		rm $(TLIB)/libftgl.a $(OBJ)/* $(TMP)/*.cpp $(TMP)/*.h $(TMP)/FTGL/*

tmp_src:	$(SRC_BASE) $(SRC_GLYPH) $(SRC_FONT) $(SRC_LAYOUT)
		cp config.h $(TMP)/
		cp $(SRC_HEADERS) $(TMP)/FTGL/
		cp $(SRC_HEADERS) $(TINC)/FTGL/
		cp $(SRC_BASE) $(TMP)/
		cp $(SRC_GLYPH) $(TMP)/
		cp $(SRC_FONT) $(TMP)/
		cp $(SRC_LAYOUT) $(TMP)/


#
# Generate the Library.
#
$(TLIB)/libftgl.a:	obj_glyph obj_font obj_layout obj_base
		$(AR) $(A_FLAGS) $(TLIB)/libftgl.a $(OBJ_GLYPH) $(OBJ_FONT) $(OBJ_LAYOUT) $(OBJ_BASE)
#
#
#  Glyph object compile.
#
obj_glyph: $(OBJ_GLYPH) $(TMP)/config.h $(TMP)/FTInternals.h $(TMP_HEADERS)
#
#
# Compile each Glyph module.
#
$(OBJ)/FTBitmapGlyph.o:		$(TMP)/FTBitmapGlyph.cpp $(TMP)/FTBitmapGlyphImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTBufferGlyph.o:		$(TMP)/FTBufferGlyph.cpp $(TMP)/FTBufferGlyphImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTExtrudeGlyph.o:	$(TMP)/FTExtrudeGlyph.cpp $(TMP)/FTExtrudeGlyphImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTGlyph.o:		$(TMP)/FTGlyph.cpp $(TMP)/FTVectoriser.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTGlyphGlue.o:		$(TMP)/FTGlyphGlue.cpp
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTOutlineGlyph.o:	$(TMP)/FTOutlineGlyph.cpp  $(TMP)/FTOutlineGlyphImpl.h $(TMP)/FTOutlineGlyphImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTPixmapGlyph.o:		$(TMP)/FTPixmapGlyph.cpp $(TMP)/FTPixmapGlyphImpl.h/ $(TMP)/FTVectoriser.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTPolygonGlyph.o:	$(TMP)/FTPolygonGlyph.cpp $(TMP)/FTPolygonGlyphImpl.h  $(TMP)/FTVectoriser.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTTextureGlyph.o:	$(TMP)/FTTextureGlyph.cpp $(TMP)/FTTextureGlyphImpl.h  $(TMP)/FTVectoriser.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@


obj_font: $(OBJ_FONT) $(TMP)/config.h $(TMP)/FTInternals.h $(TMP_HEADERS)
#
#
# Compile each Font module.
#
$(OBJ)/FTBitmapFont.o:		$(TMP)/FTBitmapFont.cpp $(TMP)/FTBitmapFontImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTBufferFont.o:		$(TMP)/FTBufferFont.cpp $(TMP)/FTBufferFontImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTExtrudeFont.o:		$(TMP)/FTExtrudeFont.cpp $(TMP)/FTExtrudeFontImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTFont.o:		$(TMP)/FTFont.cpp $(TMP)/FTFontImpl.h $(TMP)/FTGlyphContainer.h $(TMP)/FTFace.h $(TMP)/FTUnicode.h $(FNT_HEADERS)
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTFontGlue.o:		$(TMP)/FTFontGlue.cpp
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTOutlineFont.o:		$(TMP)/FTOutlineFont.cpp $(TMP)/FTOutlineFontImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTPixmapFont.o:		$(TMP)/FTPixmapFont.cpp $(TMP)/FTPixmapFontImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTPolygonFont.o:		$(TMP)/FTPolygonFont.cpp $(TMP)/FTPolygonFontImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTTextureFont.o:		$(TMP)/FTTextureFont.cpp $(TMP)/FTTextureFontImpl.h $(TMP)/FTTextureGlyphImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@



obj_layout: $(OBJ_LAYOUT) $(TMP)/config.h $(TMP)/FTInternals.h $(TMP_HEADERS)
#
#
# Compile each Layout module.
#
$(OBJ)/FTLayout.o:		$(TMP)/FTLayout.cpp $(TMP)/FTLayoutImpl.h $(TMP)/FTUnicode.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTLayoutGlue.o:		$(TMP)/FTLayoutGlue.cpp
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTSimpleLayout.o:	$(TMP)/FTSimpleLayout.cpp $(TMP)/FTSimpleLayoutImpl.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#



obj_base: $(OBJ_BASE) $(TMP)/config.h $(TMP)/FTInternals.h $(TMP_HEADERS)
#
#
#
# Compile each Base module.
#
$(OBJ)/FTBuffer.o:		$(TMP)/FTBuffer.cpp
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTCharmap.o:		$(TMP)/FTCharmap.cpp $(TMP)/FTFace.h $(TMP)/FTCharmap.h $(TMP)/FTCharToGlyphIndexMap.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTContour.o:		$(TMP)/FTContour.cpp $(TMP)/FTContour.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTFace.o:		$(TMP)/FTFace.cpp $(TMP)/FTFace.h $(TMP)/FTLibrary.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTGlyphContainer.o:	$(TMP)/FTGlyphContainer.cpp $(TMP)/FTGlyphContainer.h $(TMP)/FTFace.h $(TMP)/FTCharmap.h $(TMP)/FTCharToGlyphIndexMap.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTLibrary.o:		$(TMP)/FTLibrary.cpp $(TMP)/FTLibrary.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTPoint.o:		$(TMP)/FTPoint.cpp
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTSize.o:		$(TMP)/FTSize.cpp $(TMP)/FTSize.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#
$(OBJ)/FTVectoriser.o:		$(TMP)/FTVectoriser.cpp $(TMP)/FTVectoriser.h $(TMP)/FTContour.h $(TMP)/FTList.h $(TMP)/FTVector.h
	$(CXX) $(CXXFLAG) -I./ -c $< -o $@
#

#
