PROGRAMS=xoxa_digest xoxa_outline
CC=cc

# should be overridden by the invoking makefile
DIST_LOCATION=../build

%.gz: %
	gzip --best $<


xoxa_digest: xoxa_digest.c
	$(CC) -o xoxa_digest xoxa_digest.c -I.. -L.. -lxoxa -lexpat

xoxa_outline: xoxa_outline.c
	$(CC) -o xoxa_outline xoxa_outline.c -I.. -L.. -lxoxa -lexpat

# This is a very simple-minded check, intended only to verify that the
# example programs compile without error, and produce sane output.
check: $(PROGRAMS)
	cd test; ./test.sh

dist:
	test -d $(DIST_LOCATION)/example || mkdir $(DIST_LOCATION)/example
	cp -R Makefile Makefile.in README *.c test $(DIST_LOCATION)/example

example-c.tar: clean
	mkdir example-c
	cp -R Makefile Makefile.in README *.c test example-c
	tar cf example-c.tar example-c
	rm -Rf example-c

clean:
	rm -Rf $(PROGRAMS) test/tmp_* example-c*
