# Makefile for PDFlib C samples, C language binding
# $Id: Makefile.in,v 1.11 2001/04/01 11:02:56 tm Exp $

VERSION		= @VERSION@
LIBPDF		= lib@PDFLIBNAME@
SHELL		= @SHELL@
INSTALL		= @INSTALL@
INSTALL_DATA 	= @INSTALL_DATA@
srcdir		= @srcdir@
top_builddir	= ../..
VPATH		= @srcdir@
EXE		= @EXEEXT@
OBJ		= @OBJEXT@
CC		= @CC@
RM      	= @RM@
LIBTOOL		= ../../libtool --silent

PDFLIBLINK	= @PDFLIBLINK@

CFLAGS		= -I../../pdflib @DEFINES@ $(CPPFLAGS)

.SUFFIXES: .c .$(OBJ) .lo

.c.lo:
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $<

.c.$(OBJ):
	$(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $<

# ------------------------------

SRC	= \
	$(srcdir)/hello.c		\
	$(srcdir)/image.c		\
	$(srcdir)/pdfclock.c		\
	$(srcdir)/personalize.c		\
	$(srcdir)/quickreference.c

OBJS	= \
	$(srcdir)/hello.lo		\
	$(srcdir)/image.lo		\
	$(srcdir)/pdfclock.lo		\
	$(srcdir)/personalize.lo	\
	$(srcdir)/quickreference.lo

all:	hello$(EXE) image$(EXE) pdfclock$(EXE)

test: hello$(EXE) image$(EXE) pdfclock$(EXE)
	-./hello
	-./image
	-./pdfclock

pditest: personalize$(EXE) quickreference$(EXE) test
	-./personalize
	-./quickreference

.PHONY: clean

hello$(EXE): hello.lo ../../pdflib/$(LIBPDF).la
	$(LIBTOOL) --mode=link $(CC) -static -o $@ hello.lo $(PDFLIBLINK)

image$(EXE): image.lo ../../pdflib/$(LIBPDF).la
	$(LIBTOOL) --mode=link $(CC) -static -o $@ image.lo $(PDFLIBLINK)

pdfclock$(EXE): pdfclock.lo ../../pdflib/$(LIBPDF).la
	$(LIBTOOL) --mode=link $(CC) -static -o $@ pdfclock.lo $(PDFLIBLINK)

personalize$(EXE): personalize.lo ../../pdflib/$(LIBPDF).la
	$(LIBTOOL) --mode=link $(CC) -static -o $@ personalize.lo $(PDFLIBLINK)

quickreference$(EXE): quickreference.lo ../../pdflib/$(LIBPDF).la
	$(LIBTOOL) --mode=link $(CC) -static -o $@ quickreference.lo $(PDFLIBLINK)

clean:
	-$(RM) *.$(OBJ) *.lo *.la hello$(EXE) image$(EXE)	\
	pdfclock$(EXE) personalize$(EXE) quickreference$(EXE)	\
	.libs hello_c.pdf image_c.pdf pdfclock_c.pdf		\
	personalize.pdf quickreference.pdf

depend:
	cp Makefile.in Makefile.in.bak
	sed '/^# Automatically generated dependencies/q' Makefile.in.bak >Makefile.in
	$(CC) $(CFLAGS) -MM $(SRC) | sed 's/\.o:/.lo:/g' >>Makefile.in

# Automatically generated dependencies
hello.lo: ./hello.c ../../pdflib/pdflib.h
image.lo: ./image.c ../../pdflib/pdflib.h
pdfclock.lo: ./pdfclock.c ../../pdflib/pdflib.h
personalize.lo: ./personalize.c ../../pdflib/pdflib.h
quickreference.lo: ./quickreference.c ../../pdflib/pdflib.h
