#
# this is the only variable you need to set, the root directory
# for your freetype2 distribution. also set the VER variable
# in order to have accurate information in the generated files, or not :P
#
TOP=/home/dodo/FT2/freetype-2.14.1
VER=freetype-2.14.1

#DEBUG=-g
CFLAGS=-Wall $(DEBUG)
LFLAGS=$(DEBUG)

#LIBDBG=-g

#
# tf-s is a program linked with the system freetype2 library
# tf-k is the same program linked with our generated library
# run them with a font file as an argument to generate out.pgm
#
all: tf-s tf-k

tf-s: tf.c
	$(CC) -o $@ -DUSE_SYS_FT tf.c `pkg-config --cflags --libs freetype2` $(LFLAGS)
tf-k: tf.c ft2.h ft2.o
	$(CC) -o $@ $(CFLAGS) tf.c ft2.o $(LFLAGS) $(LIBDBG)

ft2.o: ft2.c
	$(CC) $(LIBDBG) -c ft2.c

sinfil: sinfil.c
	$(CC) -o $@ $(CFLAGS) $^ $(LFLAGS)

ft2.c: ft2defs.spec ft2source.spec sinfil
	./sinfil TOP=$(TOP) VER=$(VER) ft2defs.spec ft2source.spec 

ft2.h: ft2defs.spec ft2header.spec sinfil
	./sinfil TOP=$(TOP) VER=$(VER) ft2defs.spec ft2header.spec 

clean:
	rm -f *.o sinfil *.log ft2.c ft2.h tf-s tf-k *.pgm
