# written by Zheng Gengbin

SHELL = @CONFIGSHELL@

srcdir      = @srcdir@
top_srcdir  = @top_srcdir@

SUBDIR =  @hpfdir@ @adlibdir@ scripts 
TESTDIR = examples

VPATH = .:${srcdir}

all: ${srcdir}/configure
	@for i in ${SUBDIR}; \
	do (cd $$i; $(MAKE) "MAKE=$(MAKE)"); done

${srcdir}/configure: ${srcdir}/configure.in 
	cd ${srcdir}/ && autoconf
	autoheader

testing:
	cd examples ; make testing

clean:
	@for i in ${SUBDIR} ${TESTDIR}; \
	do (cd $$i; $(MAKE) "MAKE=$(MAKE)" clean); done

distclean: 
	@for i in ${SUBDIR} ${TESTDIR}; \
	do (cd $$i; $(MAKE) "MAKE=$(MAKE)" distclean); done
	@echo Deleting generated Makefiles ...
	rm -f Makefile
	find ${SUBDIR} -name Makefile  -exec rm {} \;
	@echo Deleting generated configure files ...
	rm -f config.cache config.status config.log
	@echo Deleting if installed in current dir ...;
	if [ -d bin ] ; then rm -r -f bin ; fi
	if [ -d include ] ; then rm -r -f include ; fi
	if [ -d lib ] ; then rm -r -f lib; fi

install:
	@for i in ${SUBDIR} ; \
	do (cd $$i; $(MAKE) "MAKE=$(MAKE)" install); done

uninstall:
	@for i in ${SUBDIR} ; \
	do (cd $$i; $(MAKE) "MAKE=$(MAKE)" uninstall); done


