SUBDIRS = . build contrib data libide src plugins tools po tests doc

INTLTOOL_FILES = \
	intltool-extract.in \
	intltool-merge.in \
	intltool-update.in \
	$(NULL)

EXTRA_DIST = \
	$(INTLTOOL_FILES) \
	AUTHORS \
	$(NULL)

DISTCLEANFILES = \
	intltool-extract \
	intltool-merge \
	intltool-update \
	po/.intltool-merge-cache

# --disable-gtk-doc until future notice
DISTCHECK_CONFIGURE_FLAGS = \
	--enable-introspection \
	--disable-gtk-doc \
	--disable-tracing \
	--enable-appstream-util \
	$(NULL)

GITIGNOREFILES = \
	**/*.swp \
	*.o \
	aclocal.m4 \
	build-aux \
	ChangeLog \
	config \
	config.h.in \
	gtk-doc.m4 \
	gtk-doc.make \
	INSTALL \
	$(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" libide src plugins \
		  | 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

run:
	PEAS_DEBUG=1 \
	GB_IN_TREE_PLUGINS=1 \
	GB_IN_TREE_FONTS=1 \
	GB_IN_TREE_STYLE_SCHEMES=1 \
	GI_TYPELIB_PATH="libide:contrib/tmpl:$(GI_TYPELIB_PATH)" \
	GOBJECT_DEBUG=instance-count \
	PATH=$(top_builddir)/src:${PATH} \
	$(LIBTOOL) --mode=execute gdb -ex run --args src/gnome-builder -vvvv -s

strace:
	PEAS_DEBUG=1 \
	GB_IN_TREE_PLUGINS=1 \
	GB_IN_TREE_FONTS=1 \
	GB_IN_TREE_STYLE_SCHEMES=1 \
	GI_TYPELIB_PATH="libide:contrib/tmpl:$(GI_TYPELIB_PATH)" \
	GOBJECT_DEBUG=instance-count \
	PATH=$(top_builddir)/src:${PATH} \
	$(LIBTOOL) --mode=execute strace -T src/gnome-builder -vvvv -s

debug:
	PEAS_DEBUG=1 \
	GB_IN_TREE_PLUGINS=1 \
	GB_IN_TREE_FONTS=1 \
	GB_IN_TREE_STYLE_SCHEMES=1 \
	GI_TYPELIB_PATH="libide:contrib/tmpl:$(GI_TYPELIB_PATH)" \
	G_DEBUG=fatal-criticals \
	GOBJECT_DEBUG=instance-count \
	PATH=$(top_builddir)/src:${PATH} \
	$(LIBTOOL) --mode=execute gdb -ex run --args src/gnome-builder -vvvv -s

valgrind:
	PEAS_DEBUG=1 \
	GB_IN_TREE_PLUGINS=1 \
	GB_IN_TREE_FONTS=1 \
	GB_IN_TREE_STYLE_SCHEMES=1 \
	GI_TYPELIB_PATH="libide:contrib/tmpl:$(GI_TYPELIB_PATH)" \
	G_DEBUG=fatal-criticals \
	G_SLICE=always-malloc \
	PATH=$(top_builddir)/src:${PATH} \
	$(LIBTOOL) --mode=execute valgrind src/gnome-builder -vvvv -s

-include $(top_srcdir)/git.mk
