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 = gcc
CXXFLAGS = -O2 -DWIN32 -D__WIN32__
LDFLAGS =
GL_INCLUDES = -I.
GL_LDFLAGS =
GL_BASELIBS=-lopengl32 -lGLU32

GLUT_INCLUDES =
GLUT_LDFLAGS =

TTF_INCLUDES = -I../freetype/lib
TTF_LDFLAGS = -L../freetype/lib

LIBSOCKET =
RANLIB = ranlib
X_INCLUDES =
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)

DEMO=demo
LOGO=logo

all: $(DEMO) $(LOGO)

AR=ar

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

GLTT_LIB=libgltt.a
GL_LIBS=$(GL_LDFLAGS) $(GL_BASELIBS) $(GLUT_LDFLAGS) -lglut
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)

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

#depend: dep
#	@true

#dep: $(SRCS) $(DEMO_SRCS) $(LOGO_SRCS)

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

clean:
	rm -f $(OBJS) $(DEMO_OBJS) $(LOGO_OBJS) $(GLTT_LIB) $(DEMO) $(LOGO)

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
