# cvsid: $Id: Makefile.sample.in,v 1.12 2016/03/24 10:38:37 tm Exp $
#
# sample Makefile for PDFlib applications
# This may have to be changed for your build environment


CXX = arm-linux-androideabi-g++
SAMPLE_CFLAGS = 
SAMPLE_LDFLAGS = 
SAMPLE_LDLIBS = 
SAMPLE_DLLDLIBS = 

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

PROGS	= 		\
	certsec  	\
	encrypt  	\
	insertxmp 	\
	dumper  	\
	multisign	\
	sign

all: $(PROGS)

test: $(PROGS)
	@echo "to test the hellosign sample use: make testhellosign"
	@echo "to test the dynamicsign sample use: make testdynamicsign"
	./certsec PLOP-datasheet.pdf PLOP-datasheet-certsec.pdf
	./encrypt
	./insertxmp
	./dumper PLOP-datasheet.pdf
	./multisign invoice.pdf PLOP-datasheet.pdf
	./sign invoice.pdf invoice-signed.pdf

# program to demonstrate the usage of the ploplibdl.c module to load the PLOP
# DLL dynamically
encryptdl: encryptdl.c ploplibdl.c
	$(CC) -c $(CFLAGS) encryptdl.c
	$(CC) -c $(CFLAGS) ploplibdl.c
	$(CXX) -o $@ $(LDFLAGS) encryptdl.o ploplibdl.o $(SAMPLE_DLLDLIBS)

dynamicsign:
	@echo "you need a version of PDFlib installed to build this target"
	$(CXX) dynamicsign.c $(CFLAGS) $(LDFLAGS) -lpdf $(LDLIBS) -o dynamicsign

testdynamicsign: dynamicsign
	-./dynamicsign PLOP-datasheet.pdf PLOP-datasheet-signed-dynamic.pdf


hellosign:
	@echo "you need a version of PDFlib installed to build this target"
	$(CXX) hellosign.c $(CFLAGS) $(LDFLAGS) -lpdf $(LDLIBS) -o hellosign

testhellosign: hellosign
	-./hellosign

clean:
	$(RM) $(PROGS) encryptdl *.o
	$(RM) hellosign dynamicsign PLOP-datasheet-encrypted.pdf PLOP-datasheet-encrypted-dl.pdf
	$(RM) PLOP-datasheet-xmp.pdf hellosign.pdf invoice-signed.pdf PLOP-datasheet-signed-dynamic.pdf

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

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

