# $Id$

INCLUDES =								\
	-I$(top_srcdir)							\
	-DDEFAULT_XDG_CACHE_HOME=\"~/.cache\"				\
	-DDEFAULT_XDG_DATA_HOME=\"~/.local/share\"			\
	-DDEFAULT_XDG_CONFIG_HOME=\"~/.config\"				\
	-DDEFAULT_XDG_DATA_DIRS=\"$(datadir):/usr/local/share:/usr/share\" \
	-DDEFAULT_XDG_CONFIG_DIRS=\"$(sysconfdir)/xdg:$(sysconfdir)/xfce4:/etc/xdg\" \
	-DDATADIR=\"$(datadir)\"					\
	-DSYSCONFDIR=\"$(sysconfdir)\"					\
	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
	-DG_LOG_DOMAIN=\"libxfce4util\"					\
	-DKIOSKDIR=\"$(sysconfdir)/xdg/xfce4/kiosk\"			\
	-DKIOSKDEF=\"ALL\"						\
	-DLIBXFCE4UTIL_COMPILATION

lib_LTLIBRARIES =							\
	libxfce4util.la

libxfce4util_headers =							\
	debug.h								\
	i18n.h								\
	utf8.h								\
	util.h								\
	xfce-desktopentry.h						\
	xfce-fileutils.h						\
	xfce-generics.h							\
	xfce-i18n.h							\
	xfce-kiosk.h							\
	xfce-license.h							\
	xfce-miscutils.h						\
	xfce-posix-signal-handler.h					\
	xfce-rc.h							\
	xfce-resource.h							\
	xfce-utf8.h

libxfce4util_built_public_sources =					\
	libxfce4util-enum-types.h

libxfce4util_built_sources =						\
	$(libxfce4util_built_public_sources)				\
	libxfce4util-alias.h						\
	libxfce4util-aliasdef.c						\
	libxfce4util-enum-types.c

libxfce4utilincludedir = $(includedir)/xfce4/libxfce4util
libxfce4utilinclude_HEADERS =						\
	$(libxfce4util_built_public_sources)				\
	$(libxfce4util_headers)						\
	libxfce4util.h							\
	libxfce4util-config.h

libxfce4util_la_SOURCES =						\
	$(libxfce4utilinclude_HEADERS)					\
	$(libxfce4util_built_sources)					\
	libxfce4util-config.c						\
	libxfce4util-private.c						\
	libxfce4util-private.h						\
	xfce-desktopentry.c						\
	xfce-fileutils.c						\
	xfce-i18n.c							\
	xfce-kiosk.c							\
	xfce-license.c							\
	xfce-miscutils.c						\
	xfce-posix-signal-handler.c					\
	xfce-private.h							\
	xfce-rc.c							\
	xfce-rc-config.c						\
	xfce-rc-private.h						\
	xfce-rc-simple.c						\
	xfce-resource.c							\
	xfce-utf8.c

libxfce4util_la_CFLAGS = 						\
	$(GOBJECT_CFLAGS)

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

libxfce4util_la_LIBADD =						\
	$(GOBJECT_LIBS)

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libxfce4util-1.0.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-letc							\
	xgen-leth

DISTCLEANFILES =							\
	stamp-libxfce4util-enum-types.h					\
	$(libxfce4util_built_sources)

BUILT_SOURCES =								\
	$(libxfce4util_built_sources)

if HAVE_GNUC_VISIBILITY
TESTS =									\
	abicheck.sh
endif

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

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

libxfce4util-enum-types.h: stamp-libxfce4util-enum-types.h
	@true
stamp-libxfce4util-enum-types.h: $(libxfce4util_headers) Makefile
	( cd $(srcdir) && glib-mkenums \
		--fhead "#ifndef __LIBXFCE4UTIL_ENUM_TYPES_H__\n#define __LIBXFCE4UTIL_ENUM_TYPES_H__\n#include <glib-object.h>\n" \
		--fprod "/* enumerations from \"@filename@\" */\n" \
		--vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define XFCE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
		--ftail "#endif /* __LIBXFCE4UTIL_ENUM_TYPES_H__ */" \
		$(libxfce4util_headers) ) > xgen-leth \
	&& (cmp -s xgen-leth libxfce4util-enum-types.h || cp xgen-leth libxfce4util-enum-types.h) \
	&& rm -f xgen-leth \
	&& echo timestamp > $(@F)

libxfce4util-enum-types.c: $(libxfce4util_headers) Makefile
	( cd $(srcdir) && glib-mkenums \
		--fhead "#include <libxfce4util/libxfce4util.h>\n#include <libxfce4util/libxfce4util-alias.h>\n" \
		--fprod "\n/* enumerations from \"@filename@\" */" \
		--vhead "GType\n@enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G@Type@Value values[] = {" \
		--vprod "      { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
		--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_@type@_register_static (\"@EnumName@\", values);\n  }\n  return etype;\n}\n" \
		--ftail "\n#define __LIBXFCE4UTIL_ENUM_TYPES_C__\n#include <libxfce4util/libxfce4util-aliasdef.c>\n" \
		$(libxfce4util_headers) ) >> xgen-letc \
	&& cp xgen-letc libxfce4util-enum-types.c \
	&& rm -f xgen-letc
endif

# required for gtk-doc
dist-hook: all

EXTRA_DIST =								\
	abicheck.sh							\
	libxfce4util.symbols						\
	libxfce4util-alias.h						\
	libxfce4util-aliasdef.c						\
	make-libxfce4util-alias.pl

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