# sample Makefile for TET applications
#
# tested with gmake, so if your make does not work properly try to use gmake

RM      = rm -f

CXX = g++
SAMPLE_CFLAGS = 
SAMPLE_LDFLAGS = 
SAMPLE_LDLIBS = -framework ApplicationServices -framework SystemConfiguration
SAMPLE_DLLDLIBS = 

CFLAGS  = -I./include $(SAMPLE_CFLAGS)
LDFLAGS = -L./lib $(SAMPLE_LDFLAGS)
LDLIBS  = -ltet -lm $(SAMPLE_DLLDLIBS) $(SAMPLE_LDLIBS)

PROGS	= \
	dumper \
	extractor \
	fontfilter \
	get_attachments \
	glyphinfo \
	image_resources \
	images_per_page \
	tetml

all: $(PROGS)

test: $(PROGS)
	./dumper TET-datasheet.pdf
	./extractor TET-datasheet.pdf TET-datasheet.txt
	./fontfilter TET-datasheet.pdf
	./tetml TET-datasheet.pdf TET-datasheet.tetml
	./get_attachments Portfolio_sample.pdf attachments.txt
	./images_per_page TET-datasheet.pdf
	./image_resources TET-datasheet.pdf
	./glyphinfo TET-datasheet.pdf TET-datasheet.info.txt

# program to demonstrate the usage of the tetlibdl.c module to load the TET
# DLL dynamically
extractordl: extractordl.c tetlibdl.c
	$(CC) -c $(CFLAGS) extractordl.c
	$(CC) -c $(CFLAGS) tetlibdl.c
	$(CXX) -o $@ $(LDFLAGS) extractordl.o tetlibdl.o $(SAMPLE_DLLDLIBS)
        
clean:
	$(RM) $(PROGS) *.o attachments.txt TET-datasheet.tetml
	$(RM) TET-datasheet.txt TET-datasheet.info.txt
	$(RM) TET-datasheet_*.tif TET-datasheet.pdf_*.jpg

#  As we need a C++ linker change the default rules how to create executables
.SUFFIXES:
.SUFFIXES: .c

.c:
	$(CXX) -o $@ $(CFLAGS) $(LDFLAGS) $< $(LDLIBS)
