# $Id$

INCLUDES =								\
	-I$(top_builddir)						\
	-I$(top_srcdir)							\
	-DDATADIR=\"$(datadir)\"					\
	-DG_LOG_DOMAIN=\"libxfcegui4\"					\
	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
	-DPREFIX=\"$(prefix)\"						\
	$(PLATFORM_CPPFLAGS)

lib_LTLIBRARIES =							\
	libxfcegui4.la

netk_headers =								\
	netk-application.h						\
	netk-class-group.h						\
	netk-screen.h							\
	netk-util.h							\
	netk-window.h							\
	netk-window-menu.h						\
	netk-window-action-menu.h					\
	netk-workspace.h						\
	netk-pager.h							\
	netk-tasklist.h							\
	netk-trayicon.h							

netk_built_headers =							\
	netk-enum-types.h

netk_built_sources =							\
	$(netk_built_headers)						\
	netk-enum-types.c						\
	netk-marshal.h							\
	netk-marshal.c

gui_built_headers =							\
	gui-enum-types.h

gui_built_sources =							\
	$(gui_built_headers)						\
	xfce_marshal.h							\
	xfce_marshal.c							\
	gui-enum-types.c

gui_headers =								\
	icons.h 							\
	xfce_aboutdialog.h						\
	xfce_clock.h 							\
	xfce_movehandler.h 						\
	xfce_decorbutton.h 						\
	xfce_decortoggle.h 						\
	xfce_framebox.h 						\
	xfce_scaled_image.h 						\
	xfce_iconbutton.h 						\
	xfce_togglebutton.h 						\
	xfce_menubutton.h 						\
	xfce_systemtray.h						\
	xfce-appmenuitem.h						\
	xfce-colorbutton.h						\
	xfce-widget-helpers.h						\
	xfce-exec.h							\
	xfce-filechooser.h						\
	xfce-gdk-extensions.h						\
	xfce-gtk-extensions.h						\
	xfce-heading.h							\
	session-client.h 						\
	gtktoxevent.h 							\
	xfce-icontheme.h						\
	xfce-titled-dialog.h

libxfcegui4includedir = $(includedir)/xfce4/libxfcegui4
libxfcegui4include_HEADERS =						\
	$(gui_headers)                                                  \
	libnetk.h 							\
	libxfcegui4.h 							\
	libxfcegui4-config.h						\
	dialogs.h 							\
	gtk_style.h 							\
	preview_filesel.h 						\
	xinerama.h 							\
	xfce-startup-notification.h                                     \
	$(netk_headers) 						\
	$(netk_built_headers)                                           \
	$(gui_built_headers)

libxfcegui4_la_SOURCES = 						\
	$(netk_built_sources)                                           \
	$(gui_built_sources)						\
	libnetk.h 							\
	libxfcegui4.h 							\
	libxfcegui4-config.h						\
	dialogs.c 							\
	dialogs.h 							\
	icons.c 							\
	icons.h 							\
	xfce_aboutdialog.c						\
	xfce_aboutdialog.h						\
	xfce_clock.c 							\
	xfce_clock.h 							\
	xfce_movehandler.c 						\
	xfce_movehandler.h 						\
	xfce_decorbutton.c 						\
	xfce_decorbutton.h 						\
	xfce_decortoggle.c 						\
	xfce_decortoggle.h 						\
	xfce_framebox.c 						\
	xfce_framebox.h 						\
	xfce_scaled_image.c 						\
	xfce_scaled_image.h 						\
	xfce_iconbutton.c 						\
	xfce_iconbutton.h 						\
	xfce-internals.c						\
	xfce-internals.h						\
	xfce_togglebutton.c 						\
	xfce_togglebutton.h 						\
	xfce_menubutton.c 						\
	xfce_menubutton.h 						\
	xfce_systemtray.c						\
	xfce_systemtray.h						\
	gtk_style.c 							\
	gtk_style.h 							\
	gtktoxevent.c 							\
	gtktoxevent.h 							\
	netk-application.c 						\
	netk-class-group.c 						\
	netk-inlinepixbufs.h 						\
	netk-pager.c 							\
	netk-private.h 							\
	netk-screen.c 							\
	netk-tasklist.c 						\
	netk-trayicon.c							\
	netk-util.c 							\
	netk-window.c 							\
	netk-window-menu.c 						\
	netk-window-menu.h 						\
	netk-window-action-menu.c					\
	netk-workspace.c 						\
	netk-xutils.c 							\
	netk-xutils.h 							\
	session-client.c 						\
	session-client.h 						\
	preview_filesel.c 						\
	preview_filesel.h 						\
	xfce-appmenuitem.c						\
	xfce-appmenuitem.h						\
	xfce-colorbutton.c						\
	xfce-colorbutton.h						\
	xfce-widget-helpers.c						\
	xfce-widget-helpers.h						\
	xfce-exec.c							\
	xfce-exec.h							\
	xfce-filechooser.h						\
	xfce-filechooser.c						\
	xfce-gdk-extensions.h						\
	xfce-gdk-extensions.c						\
	xfce-gtk-extensions.h						\
	xfce-gtk-extensions.c						\
	xfce-heading.c							\
	xfce-heading.h							\
	xfce-icontheme.h						\
	xfce-icontheme.c						\
	xfce-startup-notification.h                                     \
	xfce-startup-notification.c					\
	xfce-titled-dialog.c						\
	xfce-titled-dialog.h						\
	xinerama.c 							\
	xinerama.h

libxfcegui4_la_LDFLAGS = 						\
	-export-dynamic 						\
	-version-info $(LIBXFCEGUI4_VERINFO) 				\
	-export-symbols-regex "^[^_].*"					\
	-no-undefined							\
	$(LIBSM_LDFLAGS)						\
	$(LIBX11_LDFLAGS)

libxfcegui4_la_LIBADD =							\
	$(GTK_LIBS)							\
	$(LIBSM_LIBS)							\
	$(LIBX11_LIBS)							\
	$(LIBXFCE4UTIL_LIBS)						\
	$(LIBSTARTUP_NOTIFICATION_LIBS)					\
	$(PLATFORM_LIBS)

libxfcegui4_la_CFLAGS =							\
	$(NETK_CFLAGS)							\
	$(GTK_CFLAGS)							\
	$(LIBSM_CFLAGS)							\
	$(LIBX11_CFLAGS)						\
	$(LIBXFCE4UTIL_CFLAGS)						\
	$(LIBSTARTUP_NOTIFICATION_CFLAGS)				\
	$(PLATFORM_CFLAGS)


##
## 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 =								\
	xgen-netc							\
	xgen-neth							\
	xgen-nmc							\
	xgen-nmh							\
	xgen-xmh							\
	xgen-xmc

DISTCLEANFILES =							\
	stamp-netk-enum-types.h						\
	stamp-netk-marshal.h						\
	$(netk_built_sources)                                           \
	$(gui_built_sources)

BUILT_SOURCES =								\
	$(netk_built_sources)                                           \
	$(gui_built_sources)

netk-enum-types.h: stamp-netk-enum-types.h
	@true
stamp-netk-enum-types.h: $(netk_headers) Makefile
	( cd $(srcdir) && glib-mkenums \
		--fhead "#ifndef __NETK_ENUM_TYPES_H__\n#define __NETK_ENUM_TYPES_H__\n" \
		--fprod "/* enumerations from \"@filename@\" */\n" \
		--vhead "GType @enum_name@_get_type (void);\n#define NETK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
		--ftail "#endif /* __NETK_ENUM_TYPES_H__ */" \
		$(netk_headers) ) > xgen-neth \
	&& (cmp -s xgen-neth netk-enum-types.h || cp xgen-neth netk-enum-types.h) \
	&& rm -f xgen-neth \
	&& echo timestamp > $(@F)

netk-enum-types.c: $(netk_headers) Makefile
	( cd $(srcdir) && glib-mkenums \
		--fhead "#include <libxfcegui4/libxfcegui4.h>" \
		--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" \
		$(netk_headers) ) >> xgen-netc \
	&& cp xgen-netc netk-enum-types.c \
	&& rm -f xgen-netc

gui-enum-types.h: stamp-gui-enum-types.h
	@true
stamp-gui-enum-types.h: $(gui_headers) Makefile
	( cd $(srcdir) && glib-mkenums \
		--fhead "#ifndef __GUI_ENUM_TYPES_H__\n#define __GUI_ENUM_TYPES_H__\n" \
		--fprod "/* enumerations from \"@filename@\" */\n" \
		--vhead "GType @enum_name@_get_type (void);\n#define GUI_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
		--ftail "#endif /* __GUI_ENUM_TYPES_H__ */" \
		$(gui_headers) ) > xgen-guih \
	&& (cmp -s xgen-guih gui-enum-types.h || cp xgen-guih gui-enum-types.h) \
	&& rm -f xgen-guih \
	&& echo timestamp > $(@F)

gui-enum-types.c: $(gui_headers) Makefile
	( cd $(srcdir) && glib-mkenums \
		--fhead "#include <libxfcegui4/libxfcegui4.h>" \
		--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" \
		$(gui_headers) ) >> xgen-guic \
	&& cp xgen-guic gui-enum-types.c \
	&& rm -f xgen-guic

netk-marshal.h: stamp-netk-marshal.h
	@true
stamp-netk-marshal.h: netk-marshal.list Makefile
	( cd $(srcdir) && glib-genmarshal \
		--prefix=p_netk_marshal \
		--header netk-marshal.list ) >> xgen-nmh \
	&& (cmp -s xgen-nmh netk-marshal.h || cp xgen-nmh netk-marshal.h) \
	&& rm -f xgen-nmh \
	&& echo timestamp > $(@F)
#		--internal \
#

netk-marshal.c: netk-marshal.list Makefile
	( cd $(srcdir) \
		&& echo "#include <libxfcegui4/libxfcegui4.h>" \
		&& glib-genmarshal \
		--prefix=p_netk_marshal \
		--body netk-marshal.list ) >> xgen-nmc \
	&& cp xgen-nmc netk-marshal.c \
	&& rm -f xgen-nmc
	
xfce_marshal.h: stamp-xfce_marshal.h
	@true
stamp-xfce_marshal.h: xfce_marshal.list Makefile
	( cd $(srcdir) && glib-genmarshal \
		--prefix=p_xfce_marshal \
		--header xfce_marshal.list ) >> xgen-xmh \
	&& (cmp -s xgen-xmh xfce_marshal.h || cp xgen-xmh xfce_marshal.h) \
	&& rm -f xgen-xmh \
	&& echo timestamp > $(@F)
#		--internal \
#

xfce_marshal.c: xfce_marshal.list Makefile
	( cd $(srcdir) \
		&& echo "#include <libxfcegui4/libxfcegui4.h>" \
		&& glib-genmarshal \
		--prefix=p_xfce_marshal \
		--body xfce_marshal.list ) >> xgen-xmc \
	&& cp xgen-xmc xfce_marshal.c \
	&& rm -f xgen-xmc
endif

netk-inlinepixbufs.h: $(srcdir)/default_icon.png
	gdk-pixbuf-csource --raw --build-list 				\
	default_icon_data $(srcdir)/default_icon.png > netk-inlinepixbufs.h

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libxfcegui4-1.0.pc

# required for gtk-doc
dist-hook: all

EXTRA_DIST= 								\
	default_icon.png						\
	libxfcegui4-config.h.in						\
	netk-inlinepixbufs.h						\
	netk-marshal.list						\
	xfce_marshal.list

noinst_DATA =								\
	default_icon.png						\
	netk-inlinepixbufs.h

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