
export RELEASE=1.17

.PHONY: all install library static examples uninstall clean distclean

all: library 
#examples

library:
	( cd src && $(MAKE) );

static:
	( cd src && $(MAKE) static );

examples: library
	( cd examples && $(MAKE) );

install:
	( cd src && $(MAKE) install );
	@INSTALL@ -d -m 755 ${DESTDIR}@prefix@/@libdir@/pkgconfig
	@INSTALL@ -m 644 modglue.pc ${DESTDIR}@prefix@/@libdir@/pkgconfig/
	@INSTALL@ -d -m 755 ${DESTDIR}@prefix@/share/man/man1
	@INSTALL@ man/man1/prompt.1 ${DESTDIR}@prefix@/share/man/man1
	@INSTALL@ man/man1/ptywrap.1 ${DESTDIR}@prefix@/share/man/man1
#	@INSTALL@ man/man1/isatty.1 ${DESTDIR}@prefix@/share/man/man1

uninstall:
	( cd src && $(MAKE) uninstall );
	rm -f ${DESTDIR}@prefix@/bin/modglue-config

tarball:
	git archive --format=tar --prefix=modglue-${RELEASE}/ HEAD | gzip > ${HOME}/tmp/modglue-${RELEASE}.tar.gz

clean:
	( cd src && $(MAKE) clean );
	( cd examples && $(MAKE) clean );
	rm -f *~

distclean: clean
	( cd src && $(MAKE) distclean );
	( cd examples && $(MAKE) distclean );
	rm -f Makefile config.cache config.log config.status modglue.pc
	rm -Rf autom4te.cache aclocal.m4
