
SUBDIRS =								\
	helpers

AM_CPPFLAGS = 								\
	-I$(top_srcdir)							\
	-DBINDIR=\"$(bindir)\"						\
	-DDATADIR=\"$(datadir)\"					\
	-DG_LOG_DOMAIN=\"exo-helper\"					\
	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"

exo_helperdir = $(HELPER_PATH_PREFIX)/xfce4/exo-$(LIBEXO_VERSION_API)

exo_helper_PROGRAMS = \
	exo-helper-1

exo_helper_built_sources =						\
	exo-helper-enum-types.c						\
	exo-helper-enum-types.h

exo_helper_headers =							\
	exo-helper.h

exo_helper_1_SOURCES =						\
	$(exo_helper_built_sources)					\
	$(exo_helper_headers)						\
	exo-helper-chooser-dialog.c					\
	exo-helper-chooser-dialog.h					\
	exo-helper-chooser.c						\
	exo-helper-chooser.h						\
	exo-helper-launcher-dialog.c					\
	exo-helper-launcher-dialog.h					\
	exo-helper-utils.c						\
	exo-helper-utils.h						\
	exo-helper.c							\
	main.c

exo_helper_1_CFLAGS =							\
	$(GTK3_CFLAGS)							\
	$(LIBXFCE4UTIL_CFLAGS)						\
	$(LIBXFCE4UI2_CFLAGS)

exo_helper_1_DEPENDENCIES =						\
	$(top_builddir)/exo/libexo-2.la

exo_helper_1_LDADD =							\
	$(GTK3_LIBS)							\
	$(LIBXFCE4UTIL_LIBS)						\
	$(LIBXFCE4UI2_LIBS)						\
	$(top_builddir)/exo/libexo-2.la

bin_SCRIPTS =								\
	exo-preferred-applications

exo-preferred-applications: Makefile $(srcdir)/exo-preferred-applications.in
	sed -e 's,@HELPERDIR\@,$(HELPER_PATH_PREFIX)/xfce4/exo-$(LIBEXO_VERSION_API),g' \
	    -e 's,@LIBEXO_VERSION_API\@,$(LIBEXO_VERSION_API),g' 	\
	    < $(srcdir)/exo-preferred-applications.in			\
	    > exo-preferred-applications

desktopdir = $(datadir)/applications
desktop_in_files =							\
	exo-preferred-applications.desktop.in
desktop_DATA =								\
	$(desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@

##
## Rules to auto-generate built sources
##
## This is a bit tricky with automake, and non-trivial to implement. The
## rules below seem to work fine and don't seem to break the build, but
## they are only enabled in maintainer mode, so arbitrary users don't get
## trapped in automake's oddities. Therefore we ship the autogenerated
## files as part of the dist tarball.
##
if MAINTAINER_MODE
DISTCLEANFILES =							\
	stamp-exo-helper-enum-types.h					\
	$(exo_helper_built_sources)

BUILT_SOURCES =								\
	$(exo_helper_built_sources)

exo-helper-enum-types.h: stamp-exo-helper-enum-types.h
	@true
stamp-exo-helper-enum-types.h: $(exo_helper_headers) Makefile
	$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
		--fhead "#ifndef __EXO_HELPER_ENUM_TYPES_H__\n#define __EXO_HELPER_ENUM_TYPES_H__\n#include <exo/exo.h>\nG_BEGIN_DECLS\n" \
		--fprod "/* enumerations from \"@filename@\" */\n" \
		--vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define EXO_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
		--ftail "G_END_DECLS\n\n#endif /* !__EXO_HELPER_ENUM_TYPES_H__ */" \
		$(exo_helper_headers) ) >> xgen-eeth \
	&& (cmp -s xgen-eeth exo-helper-enum-types.h || cp xgen-eeth exo-helper-enum-types.h ) \
	&& rm -f xgen-eeth \
	&& echo timestamp > $(@F)

exo-helper-enum-types.c: $(exo_helper_headers) Makefile
	$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
		--fhead "#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include <exo-helper/exo-helper.h>\n\n#include \"exo-helper-enum-types.h\"" \
		--fprod "\n/* enumerations from \"@filename@\" */" \
		--vhead "GType\n@enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G@Type@Value values[] = {"\
		--vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
		--vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n\treturn type;\n}\n" \
		$(exo_helper_headers) ) >> xgen-eetc \
	&& cp xgen-eetc exo-helper-enum-types.c \
	&& rm -f xgen-eetc
endif

CLEANFILES =								\
	$(desktop_DATA)							\
	exo-preferred-applications

EXTRA_DIST =								\
	$(desktop_in_files)						\
	exo-preferred-applications.in

# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
