SUBDIRS = misc help po app-icons icons ui

EXTRA_DIST = AUTHORS

AUTHORS:
	$(AM_V_GEN)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" $(SUBDIRS) \
		  | sort | uniq ) > $@.tmp \
		&& mv -f $@.tmp $@ \
		|| ( rm -f $@.tmp ; \
		     echo Failed to generate $@ >&2 ); \
	else touch $@; fi

# Generate the ChangeLog and clean the dist tarball
@GENERATE_CHANGELOG_RULES@

dist-hook: dist-ChangeLog
#	find $(distdir) -name "*.c" -o -name "shotwell*.h" -o -name "shotwell*.vapi" -o -name "*vala.stamp" -exec rm {} \;

MAINTAINERCLEANFILES = \
	$(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL) \
	$(GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN) \
	$(GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL)

GITIGNOREFILES = \
	ABOUT-NLS \
	plugins/**/*.h \
	plugins/**/*.vapi \
	**/*.sw[nop] \
	**/*~ \
	*.o \
	m4/* \
	**/resource.c \
	aclocal.m4 \
	build-aux \
	ChangeLog \
	config \
	config.h.in \
	gtk-doc.m4 \
	gtk-doc.make \
	INSTALL \
	$(NULL)
#
# Generate utility library for plugins
#

lib_LTLIBRARIES = \
	plugins/common/libshotwell-plugin-common.la

plugins_common_libshotwell_plugin_common_la_SOURCES = \
	plugins/common/RESTSupport.vala \
	plugins/common/Resources.vala \
	plugins/common/WebAuthenticationPane.vala \
	plugins/common/BuilderPane.vala \
	plugins/shotwell-plugin-dev-1.0.vapi

$(top_srcdir)/plugins/shotwell-plugin-common.vapi plugins/shotwell-plugin-common.h: \
	plugins_common_libshotwell_plugin_common_la_vala.stamp

plugins_common_libshotwell_plugin_common_la_VALAFLAGS = \
	$(COMMON_VALAFLAGS) \
	--library publishing-support \
	--pkg gtk+-3.0 \
	--pkg json-glib-1.0 \
	--pkg libsoup-2.4 \
	--pkg libxml-2.0 \
	--pkg webkit2gtk-4.0 \
	--pkg gee-0.8 \
	--vapi=plugins/shotwell-plugin-common.vapi \
	--header=plugins/shotwell-plugin-common.h

plugins_common_libshotwell_plugin_common_la_CFLAGS = \
	$(PLUGIN_CFLAGS) \
	-Wno-incompatible-pointer-types -Wno-discarded-qualifiers \
	-DGETTEXT_PACKAGE='"$(GETTEXT_PACKAGE)"' \
	-I $(top_srcdir)/plugins -I$(top_builddir)/plugins

plugins_common_libshotwell_plugin_common_la_LIBADD = \
	$(PLUGIN_LIBS)

plugins/shotwell-plugin-dev-1.0.vapi plugins/shotwell-plugin-dev-1.0.h: src_plugins_libplugin_la_vala.stamp

#
# Create intermediate library for the Plugin API
#
noinst_LTLIBRARIES = \
	src/plugins/libplugin.la

src_plugins_libplugin_la_SOURCES = \
	src/plugins/SpitInterfaces.vala \
	src/plugins/TransitionsInterfaces.vala \
	src/plugins/PublishingInterfaces.vala \
	src/plugins/DataImportsInterfaces.vala

src_plugins_libplugin_la_VALAFLAGS = \
	$(COMMON_VALAFLAGS) \
	--pkg gio-2.0 \
	--pkg gtk+-3.0 \
	--pkg gmodule-2.0 \
	--pkg gee-0.8 \
	--library plugins \
	--vapi=plugins/shotwell-plugin-dev-1.0.vapi \
	--header=plugins/shotwell-plugin-dev-1.0.h

src_plugins_libplugin_la_CFLAGS = $(PLUGIN_CFLAGS)

SHOTWELL_PLUGIN_LDFLAGS = \
	-no-undefined \
	-module \
	-shared \
	-export_dynamic \
	-avoid-version

-include $(top_srcdir)/git.mk

plugindir = $(pkglibdir)/plugins/builtin
plugin_LTLIBRARIES =
dist_plugin_DATA =
pkglibexec_PROGRAMS =

dist_pkglibexec_SCRIPTS = $(top_srcdir)/settings-migrator/shotwell-settings-migrator
dist_noinst_DATA = $(NULL)

MOSTLYCLEANFILES = $(NULL)

include $(top_srcdir)/common.am
include $(top_srcdir)/shotwell.am
include $(top_srcdir)/thumbnailer.am

# Plugins
include $(top_srcdir)/publish.am

if HAVE_EXTRA_PLUGINS
include $(top_srcdir)/publish-extra.am
endif

include $(top_srcdir)/transition.am
include $(top_srcdir)/import.am

dist_noinst_SCRIPTS = \
	autogen.sh

dist_noinst_DATA += \
	plugins/shotwell-plugin-dev-1.0.h \
	plugins/shotwell-plugin-common.h \
	vapi/gphoto.h \
	vapi/libexif.vapi \
	vapi/libgphoto2.vapi \
	vapi/libraw.vapi \
	vapi/unity.deps \
	vapi/unity.vapi \
	vapi/misc.vapi