include $(top_srcdir)/common.am

ACLOCAL_AMFLAGS = --install -I m4 ${ACLOCAL_FLAGS}

SUBDIRS = plugins src data po doc
DIST_SUBDIRS = $(SUBDIRS)

EXTRA_DIST = \
	README \
	COPYING \
	AUTHORS \
	NEWS

DISTCHECK_CONFIGURE_FLAGS = \
	--enable-appstream-util \
	--disable-gtk-doc \
	--enable-introspection

# Remove doc directory on uninstall
uninstall-local:
	-rm -r $(docdir)

GITIGNOREFILES = \
	INSTALL \
	aclocal.m4 \
	build \
	build-aux \
	config \
	config.h.in \
	gtk-doc.m4 \
	gtk-doc.make \
	m4 \
	src/.deps \
	src/Makefile \
	src/Makefile.in \
	$(NULL)

AUTHORS:
	@if test -d "$(srcdir)/.git"; \
	then \
		echo Creating $@ && \
		( cd "$(top_srcdir)" && \
		  echo '# Generated by Makefile. Do not edit.'; echo; \
		  git log --no-merges --pretty=format:"%an" src \
		  | sort | uniq ) > $@.tmp \
		&& mv -f $@.tmp $@ \
		|| ( rm -f $@.tmp ; \
		     echo Failed to generate $@ >&2 ); \
	fi

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

.PHONY: AUTHORS

-include $(top_srcdir)/git.mk
