SHELL = /bin/sh

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
transform = @program_transform_name@

CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
LDFLAGS = @LDFLAGS@
GL_INCLUDES = @GL_INCLUDES@
GL_LDFLAGS = @GL_LDFLAGS@
GL_BASELIBS=-l@GL_LIBNAME@GL -l@GL_LIBNAME@GLU

GLUT_INCLUDES = @GLUT_INCLUDES@
GLUT_LDFLAGS = @GLUT_LDFLAGS@

TTF_INCLUDES = @TTF_INCLUDES@
TTF_LDFLAGS = @TTF_LDFLAGS@

LIBSOCKET = @LIBSOCKET@
RANLIB = @RANLIB@
X_INCLUDES = @X_INCLUDES@
X_LDFLAGS = @X_LDFLAGS@

mkinstalldirs= $(SHELL) $(top_srcdir)/mkinstalldirs

SRCS= FTEngine.C FTFace.C FTInstance.C FTGlyph.C \
 FTGlyphBitmap.C FTGlyphPixmap.C \
 FTFont.C FTBitmapFont.C FTPixmapFont.C \
 FTGlyphVectorizer.C \
 GLTTGlyphPolygonizer.C GLTTGlyphPolygonizerHandler.C \
 GLTTGlyphTriangulator.C \
 GLTTBitmapFont.C GLTTPixmapFont.C GLTTOutlineFont.C GLTTFont.C

OBJS=$(SRCS:.C=.o)

DEMO_SRCS=BottomText.C hsv_to_rgb.C delays.C demo.C
DEMO_OBJS=$(DEMO_SRCS:.C=.o)

LOGO_SRCS=hsv_to_rgb.C delays.C logo.C
LOGO_OBJS=$(LOGO_SRCS:.C=.o)

BBOXDEMO_SRCS=bboxdemo.C
BBOXDEMO_OBJS=$(BBOXDEMO_SRCS:.C=.o)

DEMO=demo
LOGO=logo
BBOXDEMO=bboxdemo

DEMOS= $(DEMO) $(LOGO) $(BBOXDEMO)
DEMOS_SRCS= $(DEMO_SRCS) $(LOGO_SRCS) $(BBOXDEMO_SRCS)
DEMOS_OBJS=$(DEMOS_SRCS:.C=.o)

all: $(DEMOS)

AR=ar

ALL_FLAGS=$(CXXFLAGS) $(GLUT_INCLUDES) $(GL_INCLUDES) $(TTF_INCLUDES) $(X_INCLUDES)

GLTT_LIB=libgltt.a
GL_LIBS=$(GLUT_LDFLAGS) -lglut $(GL_LDFLAGS) $(GL_BASELIBS)
X_LIBS=$(X_LDFLAGS) -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE $(LIBSOCKET) -lm
TTF_LIBS=$(TTF_LDFLAGS) -lttf
ALL_LIBS=$(LDFLAGS) -L. -lgltt $(GL_LIBS) $(X_LIBS) $(TTF_LIBS)

.C.o:
	$(CXX) $(ALL_FLAGS) -c $*.C -o $*.o

$(DEMO): $(GLTT_LIB) $(DEMO_OBJS)
	$(CXX) -o $@ $(DEMO_OBJS) $(ALL_LIBS)

$(LOGO): $(GLTT_LIB) $(LOGO_OBJS)
	$(CXX) -o $@ $(LOGO_OBJS) $(ALL_LIBS)

$(BBOXDEMO): $(GLTT_LIB) $(BBOXDEMO_OBJS)
	$(CXX) -o $@ $(BBOXDEMO_OBJS) $(ALL_LIBS)

$(GLTT_LIB): $(OBJS)
	$(AR) ruv $@ $(OBJS)
	$(RANLIB) $@

dep: $(SRCS) $(DEMO_SRCS) $(LOGO_SRCS)
	$(CXX) -MM $(ALL_FLAGS) $(SRCS) $(DEMOS_SRCS) > depend

clean:
	rm -f $(OBJS) $(DEMOS_OBJS) $(GLTT_LIB) $(DEMOS)

distclean: clean
	rm -f config.log config.status config.cache Makefile config.h depend
	touch depend

install:
	$(mkinstalldirs) $(libdir)
	$(INSTALL_DATA) $(GLTT_LIB) $(libdir)/
	$(mkinstalldirs) $(includedir)
	$(INSTALL_DATA) FT*.h GLTT*.h $(includedir)/

distrib:
	mkdistrib.sh

include depend
