# OCaml-Vorbis
#
# Copyright (c) 2003 by the Savonet team
#
# $Id: Makefile 2593 2006-07-07 08:03:09Z dbaelde $

PROGNAME = ocaml-vorbis
DISTFILES = aclocal.m4 bootstrap CHANGES configure configure.ac \
            COPYING Makefile README \
            src/OCamlMakefile* src/Makefile.in \
            src/META.in src/*.ml src/*.mli src/*.c src/*.h \
            examples/configure* examples/*Makefile* examples/*.ml \
            doc/html

all:

all opt byte install uninstall update:
	make -C src $@

doc:
	make -C src htdoc
	mkdir -p doc
	rm -rf doc/html
	mv src/doc/vorbis/html doc
	rm -rf src/doc

clean:
	-make -C src clean
	-make -C examples clean

distclean: clean
	rm -rf autom4te.cache config.log config.status src/META src/Makefile
	rm -rf doc
	-make -C examples distclean

dist: doc
	VERSION="$(shell grep 'AC_INIT' configure.ac)"; \
		VERSION=`echo "$$VERSION" | sed -e 's/AC_INIT([^,]*, \([^,]*\), .*)/\1/'`; \
		mkdir $(PROGNAME)-$$VERSION; \
		cp -r --parents $(DISTFILES) $(PROGNAME)-$$VERSION; \
		tar zcvf $(PROGNAME)-$$VERSION.tar.gz $(PROGNAME)-$$VERSION; \
		rm -rf $(PROGNAME)-$$VERSION

.PHONY: doc all byte opt install uninstall update clean distclean dist
