# $Id$

INCLUDES = 								\
	-I$(top_srcdir)							\
	-DDATADIR=\"$(datadir)\"					\
	-DEXO_COMPILATION						\
	-DG_LOG_DOMAIN=\"exo\"						\
	-DLIBEXECDIR=\"$(libexecdir)\"					\
	-DLIBEXO_VERSION_API=\"$(LIBEXO_VERSION_API)\"			\
	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"

lib_LTLIBRARIES = libexo-0.3.la

libexo_headers =							\
	exo-binding.h							\
	exo-cell-renderer-ellipsized-text.h				\
	exo-cell-renderer-icon.h					\
	exo-ellipsized-label.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-md5.h							\
	exo-mount-point.h						\
	exo-pango-extensions.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-url.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-0.3/exo

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

libexo_0_3_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-ellipsized-label.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-md5.c							\
	exo-mount-point.c						\
	exo-pango-extensions.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-url.c							\
	exo-utils.c							\
	exo-wrap-table.c						\
	exo-xsession-client.c

libexo_0_3_la_CFLAGS =							\
	$(GTK_CFLAGS)							\
	$(LIBXFCE4UTIL_CFLAGS)

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

libexo_0_3_la_LIBADD =							\
	$(GTK_LIBS)							\
	$(LIBXFCE4UTIL_LIBS)

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = exo-0.3.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)

if HAVE_GNUC_VISIBILITY
TESTS =									\
	abicheck.sh
endif

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

exo-aliasdef.c: make-exo-alias.pl exo.symbols
	$(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
	( 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
	( 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
	( 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
	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-marshal.list						\
	make-exo-alias.pl

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