# This file is part of GPaste.
#
# Copyright 2011-2015 Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
#
# GPaste is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GPaste is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GPaste.  If not, see <http://www.gnu.org/licenses/>.

SUBDIRS = po

ACLOCAL_AMFLAGS  = -I m4 ${ACLOCAL_FLAGS}
AM_MAKEFLAGS = --no-print-directory
AM_DISTCHECK_CONFIGURE_FLAGS = \
	--with-dbusservicesdir="$$dc_install_base/$(dbusservicesdir)" \
	--with-controlcenterdir="$$dc_install_base/$(controlcenterdir)" \
	--enable-appstream-util \
	--enable-applet \
	--enable-introspection \
	--enable-legacy-cli \
	--enable-unity \
	--enable-vala \
	$(NULL)

AM_CFLAGS = \
	-include config.h \
	-I$(srcdir)/src/libgpaste \
	-I$(srcdir)/src/libgpaste/applet \
	-I$(srcdir)/src/libgpaste/client \
	-I$(srcdir)/src/libgpaste/core \
	-I$(srcdir)/src/libgpaste/daemon \
	-I$(srcdir)/src/libgpaste/gnome-shell-client \
	-I$(srcdir)/src/libgpaste/keybinder \
	-I$(srcdir)/src/libgpaste/screensaver-client \
	-I$(srcdir)/src/libgpaste/settings \
	-I$(srcdir)/src/libgpaste/settings-ui \
	-I$(srcdir)/src/libgpaste/ui \
	-I$(srcdir)/src/libgpaste/util \
	-I$(builddir)/src/libgpaste \
	-DG_PASTE_COMPILATION \
	-DLOCALEDIR=\"$(localedir)\" \
	-DPKGLIBEXECDIR=\"$(pkglibexecdir)\" \
	$(GLIB_CFLAGS) \
	$(GTK_CFLAGS) \
	$(NULL)

AM_LIBS = \
	$(GLIB_LIBS) \
	$(NULL)

EXTRA_DIST = \
	autogen.sh \
	README.md \
	$(NULL)

CLEANFILES =
SUFFIXES =

bin_PROGRAMS =
pkginclude_HEADERS =
pkglibexec_PROGRAMS =
lib_LTLIBRARIES =
noinst_LTLIBRARIES =

TESTS=
noinst_PROGRAMS= \
	$(TESTS) \
	$(NULL)

@INTLTOOL_XML_NOMERGE_RULE@

# Libraries

include src/libgpaste.mk

# Bindings

include bindings/gi.mk
include bindings/vapi.mk

# Core utilities

include src/daemon.mk
include src/gpaste-client.mk
include src/ui.mk

# Legacy compatibility

include legacy/gpaste.mk

# Applets

include src/applet.mk
include src/app-indicator.mk
include src/gnome-shell.mk

# Data

include data/appstream.mk
include data/completions.mk
include data/control-center.mk
include data/dbus.mk
include data/desktop.mk
include data/gsettings.mk
include data/pkg-config.mk
include data/search-provider.mk

# Man pages

include man/1.mk

# Tests stuff

include tests/gnome-shell-client.mk

# Maintainance stuff

update-po:
	$(MAKE) -C po $@

release:
	$(MAKE) update-po && \
	$(MAKE) distcheck && \
	git commit -asm "Release $(PACKAGE_NAME) $(PACKAGE_VERSION)" && \
	git tag -sm "Release $(PACKAGE_NAME) $(PACKAGE_VERSION)" v$(PACKAGE_VERSION)

# Generate a ChangeLog file from 'git log'

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