# types and marshals

MARSHALFILES = ctk-marshal.c ctk-marshal.h
ENUMFILES = ctk-enum-types.h ctk-enum-types.c
STAMP_FILES = stamp-ctk-enum-types.h stamp-ctk-marshal.h

CLEANFILES = $(STAMP_FILES) $(BUILT_SOURCES)

BUILT_SOURCES = $(MARSHALFILES) $(ENUMFILES)

sources_h = \
  $(top_srcdir)/clutk/clutk.h \
  $(srcdir)/ctk-actor.h \
  $(srcdir)/ctk-bin.h \
  $(srcdir)/ctk-box.h \
  $(srcdir)/ctk-button.h \
  $(srcdir)/ctk-dnd.h \
  $(srcdir)/ctk-effect.h \
  $(srcdir)/ctk-effect-drop-shadow.h \
  $(srcdir)/ctk-effect-blur.h \
  $(srcdir)/ctk-effect-context.h \
  $(srcdir)/ctk-effect-glow.h \
  $(srcdir)/ctk-focusable.h \
  $(srcdir)/ctk-hbox.h \
  $(srcdir)/ctk-icon-view.h \
  $(srcdir)/ctk-image.h \
  $(srcdir)/ctk-layer.h \
  $(srcdir)/ctk-layer-actor.h \
  $(srcdir)/ctk-main.h \
  $(srcdir)/ctk-menu.h \
  $(srcdir)/ctk-menu-item.h \
  $(srcdir)/ctk-menu-seperator.h \
  $(srcdir)/ctk-render-target.h \
  $(srcdir)/ctk-scroll-view.h \
  $(srcdir)/ctk-text.h \
  $(srcdir)/ctk-toplevel.h \
  $(srcdir)/ctk-tooltip.h \
  $(srcdir)/ctk-types.h \
  $(srcdir)/ctk-utils.h \
  $(srcdir)/ctk-vbox.h

EXTRA_DIST = \
  ctk-marshal.list \
  ctk-enum-types.h.in \
  ctk-enum-types.c.in

DISTCLEANFILES = \
	$(ENUMFILES) \
	$(MARSHALFILES) \
	$(NULL)

ctk-enum-types.h: stamp-ctk-enum-types.h Makefile
	@true
stamp-ctk-enum-types.h: $(sources_h) ctk-enum-types.h.in
	( cd $(srcdir) && \
	  $(GLIB_MKENUMS) \
	    --template ctk-enum-types.h.in \
	  $(sources_h) ) >> xgen-teth && \
	(cmp -s xgen-teth ctk-enum-types.h || cp xgen-teth ctk-enum-types.h) && \
	rm -f xgen-teth && \
	echo timestamp > $(@F) 

ctk-enum-types.c: stamp-ctk-enum-types.h ctk-enum-types.c.in
	( cd $(srcdir) && \
	  $(GLIB_MKENUMS) \
	    --template ctk-enum-types.c.in \
	  $(sources_h) ) >> xgen-tetc && \
	cp xgen-tetc ctk-enum-types.c && \
	rm -f xgen-tetc

ctk-marshal.h: stamp-ctk-marshal.h
	@true

stamp-ctk-marshal.h: ctk-marshal.list
	$(QUIET_GEN)$(GLIB_GENMARSHAL) \
	  --prefix=ctk_marshal \
	  --header \
	  $(srcdir)/ctk-marshal.list > xgen-cmh \
	&& (cmp -s xgen-cmh ctk-marshal.h || cp xgen-cmh ctk-marshal.h ) \
	&& rm -f xgen-cmh \
	&& echo timestamp > $(@F)

ctk-marshal.c: ctk-marshal.h Makefile
	$(QUIET_GEN)( echo "#include \"ctk-marshal.h\"" ; \
	  $(GLIB_GENMARSHAL) \
	  	--prefix=ctk_marshal \
		--body \
	  $(srcdir)/ctk-marshal.list --body ) >> xgen-cmc \
	&& cp xgen-cmc ctk-marshal.c \
	&& rm -f xgen-cmc

# the library
if HAVE_LOCALINSTALL
SHADERDIR=$(top_srcdir)/data/shaders
else
SHADERDIR=$(datadir)/clutk/shaders
endif
INCLUDES = \
	-I$(srcdir) \
	-I$(top_srcdir) \
	-DG_LOG_DOMAIN=\"Clutk\" \
	-DPREFIX=\""$(prefix)"\" \
	-DLIBDIR=\""$(libdir)"\" \
  -DSHADERDIR=\"$(SHADERDIR)\" \
  -DG_DISABLE_DEPRECATED \
  -DGDK_PIXBUF_DISABLE_DEPRECATED \
  -DGDK_DISABLE_DEPRECATED \
  -DGTK_DISABLE_DEPRECATED

AM_CPPFLAGS = \
	$(CAIRO_CFLAGS) \
	$(GCC_FLAGS) \
	$(GTK_CFLAGS) \
	$(CLUTTER_GTK_CFLAGS) \
	$(CLUTTER_CFLAGS) \
  $(MAINTAINER_CFLAGS)

lib_LTLIBRARIES = libclutk-0.3.la

# please, keep the list sorted alphabetically
libclutk_0_3_la_SOURCES = \
  $(srcdir)/ctk-arb-asm-private.c \
  $(srcdir)/ctk-arb-asm-private.h \
  $(srcdir)/ctk-actor.c \
  $(srcdir)/ctk-bin.c \
  $(srcdir)/ctk-box.c \
  $(srcdir)/ctk-button.c \
  $(srcdir)/ctk-dnd.c \
  $(srcdir)/ctk-effect.c \
  $(srcdir)/ctk-effect-blur.c \
  $(srcdir)/ctk-effect-drop-shadow.c \
  $(srcdir)/ctk-effect-context.c \
  $(srcdir)/ctk-effect-glow.c \
  ctk-enum-types.c \
  $(srcdir)/ctk-focusable.c \
  $(srcdir)/ctk-gfx-private.c \
  $(srcdir)/ctk-gfx-private.h \
  $(srcdir)/ctk-hbox.c \
  $(srcdir)/ctk-icon-view.c \
  $(srcdir)/ctk-image.c \
  $(srcdir)/ctk-layer.c \
  $(srcdir)/ctk-layer-actor.c \
  $(srcdir)/ctk-main.c \
  ctk-marshal.c \
  $(srcdir)/ctk-menu.c \
  $(srcdir)/ctk-menu-item.c \
  $(srcdir)/ctk-menu-seperator.c \
  $(srcdir)/ctk-private.h \
  $(srcdir)/ctk-render-target.c \
  $(srcdir)/ctk-scroll-view.c \
  $(srcdir)/ctk-text.c \
  $(srcdir)/ctk-toplevel.c \
  $(srcdir)/ctk-tooltip.c \
  $(srcdir)/ctk-utils.c \
  $(srcdir)/ctk-vbox.c

libclutk_0_3_la_LIBADD = \
  $(CAIRO_LIBS) \
  $(CLUTTER_LIBS) \
  $(CLUTTER_GTK_LIBS) \
  $(GTK_LIBS) \
  -lGLEW
libclutk_0_3_la_LDFLAGS = $(CLUTK_LT_LDFLAGS)

ctkheadersdir = $(includedir)/clutk-0.3/clutk
ctkheaders_HEADERS = \
  $(sources_h) \
  $(top_builddir)/clutk/ctk-enum-types.h

# Gobject introspection support go here 
if HAVE_INTROSPECTION
BUILT_GIRSOURCES =

Ctk-0.3.gir:
	$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
	--namespace Ctk --nsversion=0.3 \
	$(INCLUDES) \
	--c-include='clutk/clutk.h' \
	--include=GObject-2.0 \
	--include=Clutter-1.0 \
	--include=Gtk-2.0 \
	--include=GtkClutter-0.10 \
	--library=libclutk-0.3.la \
	--output $@ \
	$(ctkheaders_HEADERS) \
	$(libclutk_0_3_la_SOURCES)
	
BUILT_GIRSOURCES += Ctk-0.3.gir

# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix.
girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES)

typelibsdir = $(libdir)/girepository-1.0/

typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)

%.typelib: %.gir $(INTROSPECTION_COMPILER)
	$(QUIET_GEN) \
	LD_LIBRARY_PATH=.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \
	$(INTROSPECTION_COMPILER) \
		--includedir=$(top_srcdir) \
		--includedir=. \
		$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)

CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
endif
