
AM_CPPFLAGS = 								\
	-I$(top_srcdir)							\
	-DDATADIR=\"$(datadir)\"					\
	-DEXO_COMPILATION						\
	-DG_LOG_DOMAIN=\"exo\"						\
	-DHELPERDIR=\"$(HELPER_PATH_PREFIX)/xfce4/exo-$(LIBEXO_VERSION_API)\"	\
	-DLIBEXO_VERSION_API=\"$(LIBEXO_VERSION_API)\"			\
	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"

lib_LTLIBRARIES = libexo-1.la

libexo_headers =							\
	exo-binding.h							\
	exo-cell-renderer-ellipsized-text.h				\
	exo-cell-renderer-icon.h					\
	exo-execute.h							\
	exo-gdk-pixbuf-extensions.h					\
	exo-gtk-extensions.h						\
	exo-gobject-extensions.h					\
	exo-icon-bar.h							\
	exo-icon-chooser-dialog.h					\
	exo-icon-view.h							\
	exo-job.h							\
	exo-simple-job.h						\
	exo-string.h							\
	exo-toolbars-editor-dialog.h					\
	exo-toolbars-editor.h						\
	exo-toolbars-model.h						\
	exo-toolbars-view.h						\
	exo-tree-view.h							\
	exo-utils.h							\
	exo-wrap-table.h						\
	exo-xsession-client.h

libexo_built_public_sources =						\
	exo-enum-types.h

libexo_built_sources =							\
	$(libexo_built_public_sources)					\
	exo-alias.h							\
	exo-aliasdef.c							\
	exo-enum-types.c						\
	exo-marshal.c							\
	exo-marshal.h

libexoincludedir = $(includedir)/exo-1/exo

libexoinclude_HEADERS =							\
	$(libexo_built_public_sources)					\
	$(libexo_headers)						\
	exo.h								\
	exo-config.h

libexo_1_la_SOURCES =							\
	$(libexoinclude_HEADERS)					\
	$(libexo_built_sources)						\
	exo-binding.c							\
	exo-cell-renderer-ellipsized-text.c				\
	exo-cell-renderer-icon.c					\
	exo-config.c							\
	exo-execute.c							\
	exo-gdk-pixbuf-extensions.c					\
	exo-gtk-extensions.c						\
	exo-gobject-extensions.c					\
	exo-icon-bar.c							\
	exo-icon-chooser-dialog.c					\
	exo-icon-chooser-model.c					\
	exo-icon-chooser-model.h					\
	exo-icon-view.c							\
	exo-job.c							\
	exo-job.h							\
	exo-simple-job.c						\
	exo-private.c							\
	exo-private.h							\
	exo-string.c							\
	exo-thumbnail-preview.c						\
	exo-thumbnail-preview.h						\
	exo-thumbnail.c							\
	exo-thumbnail.h							\
	exo-toolbars-editor-dialog.c					\
	exo-toolbars-editor.c						\
	exo-toolbars-model.c						\
	exo-toolbars-private.c						\
	exo-toolbars-private.h						\
	exo-toolbars-view.c						\
	exo-tree-view.c							\
	exo-utils.c							\
	exo-wrap-table.c						\
	exo-xsession-client.c

libexo_1_la_CFLAGS =							\
	$(GIO_CFLAGS)							\
	$(GTK_CFLAGS)							\
	$(LIBX11_CFLAGS)						\
	$(LIBXFCE4UTIL_CFLAGS)

libexo_1_la_LDFLAGS =							\
	-export-dynamic							\
	-version-info $(LIBEXO_VERINFO)					\
	-export-symbols-regex "^[^_].*"					\
	-no-undefined

libexo_1_la_LIBADD =							\
	$(GIO_LIBS)							\
	$(GTK_LIBS)							\
	$(LIBX11_LIBS)							\
	$(LIBXFCE4UTIL_LIBS)						\
	-lm

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = exo-$(LIBEXO_VERSION_API).pc

##
## GTK+ 3 support library
##

libexo_2_includedir = $(includedir)/exo-2/exo

lib_LTLIBRARIES += libexo-2.la

libexo_2_include_HEADERS =						\
	exo.h								\
	exo-binding.h							\
	exo-config.h							\
	exo-execute.h							\
	exo-gdk-pixbuf-extensions.h					\
	exo-gtk-extensions.h						\
	exo-gobject-extensions.h					\
	exo-job.h							\
	exo-simple-job.h						\
	exo-string.h							\
	exo-utils.h							\
	exo-icon-chooser-dialog.h					\
	exo-icon-chooser-model.h					\
	exo-icon-view.h							\
	exo-enum-types.h						\
	exo-toolbars-model.h						\
	exo-cell-renderer-icon.h					\
	exo-thumbnail.h							\
	exo-thumbnail-preview.h						\
	exo-tree-view.h

libexo_2_la_SOURCES =							\
	$(libexo_2_include_HEADERS)					\
	exo-binding.c							\
	exo-marshal.c							\
	exo-marshal.h							\
	exo-private.c							\
	exo-private.h							\
	exo-config.c							\
	exo-execute.c							\
	exo-gdk-pixbuf-extensions.c					\
	exo-gtk-extensions.c						\
	exo-gobject-extensions.c					\
	exo-job.c							\
	exo-simple-job.c						\
	exo-string.c							\
	exo-utils.c							\
	exo-icon-chooser-dialog.c					\
	exo-icon-chooser-model.c					\
	exo-icon-view.c							\
	exo-enum-types.c						\
	exo-cell-renderer-icon.c					\
	exo-thumbnail.c							\
	exo-thumbnail-preview.c						\
	exo-tree-view.c

libexo_2_la_CFLAGS =							\
	$(LIBXFCE4UTIL_CFLAGS)						\
	$(GIO_CFLAGS)							\
	$(GTK3_CFLAGS)							\
	$(LIBX11_CFLAGS)

libexo_2_la_LDFLAGS =							\
	-export-dynamic							\
	-version-info $(LIBEXO_VERINFO)					\
	-export-symbols-regex "^[^_].*"					\
	-no-undefined

libexo_2_la_LIBADD =							\
	$(LIBXFCE4UTIL_LIBS)						\
	$(GIO_LIBS)							\
	$(GTK3_LIBS)							\
	$(LIBX11_LIBS)							\
	-lm

pkgconfig_DATA += exo-2.pc

##
## 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
CLEANFILES =								\
	actual-abi							\
	expected-abi							\
	xgen-eetc							\
	xgen-eeth							\
	xgen-emc							\
	xgen-emh

DISTCLEANFILES =							\
	stamp-exo-enum-types.h						\
	stamp-exo-marshal.h						\
	$(libexo_built_sources)

BUILT_SOURCES =								\
	$(libexo_built_sources)

exo-alias.h: make-exo-alias.pl exo.symbols
	$(AM_V_GEN) $(PERL) $(srcdir)/make-exo-alias.pl < $(srcdir)/exo.symbols > exo-alias.h

exo-aliasdef.c: make-exo-alias.pl exo.symbols
	$(AM_V_GEN) $(PERL) $(srcdir)/make-exo-alias.pl -def < $(srcdir)/exo.symbols > exo-aliasdef.c

exo-enum-types.h: stamp-exo-enum-types.h
	@true
stamp-exo-enum-types.h: $(libexo_headers) Makefile
	$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
		--fhead "#ifndef __EXO_ENUM_TYPES_H__\n#define __EXO_ENUM_TYPES_H__\n#include <libxfce4util/libxfce4util.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_ENUM_TYPES_H__ */" \
		$(libexo_headers) ) >> xgen-eeth \
	&& (cmp -s xgen-eeth exo-enum-types.h || cp xgen-eeth exo-enum-types.h ) \
	&& rm -f xgen-eeth \
	&& echo timestamp > $(@F)

exo-enum-types.c: $(libexo_headers) Makefile
	$(AM_V_GEN) ( cd $(srcdir) && glib-mkenums \
		--fhead "#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include <exo/exo.h>\n#include <exo/exo-alias.h>\n" \
		--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" \
		--ftail "\n#define __EXO_ENUM_TYPES_C__\n#include <exo/exo-aliasdef.c>\n" \
		$(libexo_headers) ) >> xgen-eetc \
	&& cp xgen-eetc exo-enum-types.c \
	&& rm -f xgen-eetc

exo-marshal.h: stamp-exo-marshal.h
	@true
stamp-exo-marshal.h: exo-marshal.list Makefile
	$(AM_V_GEN) ( cd $(srcdir) && glib-genmarshal \
		--prefix=_exo_marshal \
		--header exo-marshal.list ) >> xgen-emh \
	&& ( cmp -s xgen-emh exo-marshal.h || cp xgen-emh exo-marshal.h ) \
	&& rm -f xgen-emh \
	&& echo timestamp > $(@F)

exo-marshal.c: exo-marshal.list Makefile
	$(AM_V_GEN) echo "#include <exo/exo-marshal.h>" > xgen-emc \
	&& ( cd $(srcdir) && glib-genmarshal \
		--prefix=_exo_marshal \
		--body exo-marshal.list ) >> xgen-emc \
	&& cp xgen-emc exo-marshal.c \
	&& rm -f xgen-emc
endif


# required for gtk-doc
dist-hook: all

EXTRA_DIST = 								\
	abicheck.sh							\
	exo.symbols							\
	exo-alias.h							\
	exo-aliasdef.c							\
	exo-icon-view-accessible.c					\
	exo-marshal.list						\
	make-exo-alias.pl

if HAVE_GNUC_VISIBILITY
TESTS =									\
	abicheck.sh
endif

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