## Process this file with automake to produce Makefile.in
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
DISTCHECK_CONFIGURE_FLAGS= --enable-gtk-doc --enable-glade-catalog

SUBDIRS = libpeas loaders
GCOVDIRS = libpeas loaders

if ENABLE_GTK
SUBDIRS += libpeas-gtk peas-demo
GCOVDIRS += libpeas-gtk
endif

SUBDIRS += tests data po docs

dist-hook:
	@if test -d "$(srcdir)/.git"; \
	then \
		echo Creating ChangeLog && \
		( cd "$(top_srcdir)" && \
		  echo '# Generated by Makefile. Do not edit.'; echo; \
		  $(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
		&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
		|| ( rm -f ChangeLog.tmp ; \
		     echo Failed to generate ChangeLog >&2 ); \
	else \
		echo A git clone is required to generate a ChangeLog >&2; \
	fi

test test-report perf-report full-report: all
	@cd tests && $(MAKE) $(AM_MAKEFLAGS) $(@)

if GDB_ENABLED

test-gdb: all
	@cd tests && $(MAKE) $(AM_MAKEFLAGS) $(@)

else

test-gdb:
	@echo "You need GDB"

endif # GDB_ENABLED

if VALGRIND_ENABLED

test-valgrind test-callgrind: all
	@cd tests && $(MAKE) $(AM_MAKEFLAGS) $(@)

else

test-valgrind test-callgrind:
	@echo "You need Valgrind"

endif # VALGRIND_ENABLED

demo: all
	@cd peas-demo && $(MAKE) $(AM_MAKEFLAGS) $(@)

if GCOV_ENABLED

gcov: test
	@for dir in $(GCOVDIRS); do \
	   (cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $(@)); \
	 done

all-local:
	@find . -name "*.gcda" -delete && find . -name "*.[ch].gcov" -delete

else

gcov:
	@echo "You need to reconfigure with --enable-gcov"

endif	# GCOV_ENABLED

.PHONY: test test-gdb test-valgrind test-callgrind \
        test-report perf-report full-report gcov demo
