# $Id: Makefile.am 21730 2006-05-20 16:23:40Z benny $

INCLUDES =								\
	-DBINDIR=\"$(bindir)\"						\
	-DDATADIR=\"$(datadir)\"					\
	-DEXO_API_SUBJECT_TO_CHANGE					\
	-DEXO_DISABLE_DEPRECATED					\
	-DG_LOG_DOMAIN=\"Terminal\"					\
	-DLIBEXECDIR=\"$(libexecdir)\"					\
	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
	-DSN_API_NOT_YET_FROZEN						\
	-I$(top_srcdir)							\
	$(PLATFORM_CPPFLAGS)

bin_PROGRAMS = 								\
	Terminal

Terminal_built_sources =						\
	terminal-enum-types.c						\
	terminal-enum-types.h						\
	terminal-marshal.c						\
	terminal-marshal.h

Terminal_dbus_sources =							\
	terminal-dbus.c							\
	terminal-dbus.h

Terminal_headers =							\
	terminal-accel-map.h						\
	terminal-app.h							\
	terminal-dialogs.h						\
	terminal-helper-dialog.h					\
	terminal-helper.h						\
	terminal-image-loader.h						\
	terminal-monitor.h						\
	terminal-options.h						\
	terminal-preferences.h						\
	terminal-preferences-dialog.h					\
	terminal-screen.h						\
	terminal-shortcut-editor.h					\
	terminal-stock.h						\
	terminal-tab-header.h						\
	terminal-toolbars-model.h					\
	terminal-toolbars-view.h					\
	terminal-widget.h						\
	terminal-window.h

Terminal_SOURCES =							\
	$(Terminal_built_sources)					\
	$(Terminal_headers)						\
	main.c								\
	terminal-accel-map.c						\
	terminal-app.c							\
	terminal-dialogs.c						\
	terminal-helper-dialog.c					\
	terminal-helper.c						\
	terminal-image-loader.c						\
	terminal-monitor.c						\
	terminal-options.c						\
	terminal-preferences.c						\
	terminal-preferences-dialog.c					\
	terminal-screen.c						\
	terminal-shortcut-editor.c					\
	terminal-stock.c						\
	terminal-tab-header.c						\
	terminal-toolbars-model.c					\
	terminal-toolbars-view.c					\
	terminal-widget.c						\
	terminal-window.c

Terminal_CFLAGS =							\
	$(DBUS_CFLAGS)							\
	$(EXO_CFLAGS)							\
	$(GTK_CFLAGS)							\
	$(LIBSTARTUP_NOTIFICATION_CFLAGS)				\
	$(VTE_CFLAGS)							\
	$(PLATFORM_CFLAGS)

Terminal_LDFLAGS =							\
	-no-undefined							\
	$(DBUS_LIBS)							\
	$(EXO_LIBS)							\
	$(GTK_LIBS)							\
	$(LIBSTARTUP_NOTIFICATION_LIBS)					\
	$(VTE_LIBS)							\
	$(TERMINAL_LIBS)

# install symlink to 'terminal'
install-data-local:
	$(mkinstalldirs) $(DESTDIR)$(bindir)
	( cd $(DESTDIR)$(bindir) ; ln -sf Terminal terminal )

if HAVE_DBUS
Terminal_CFLAGS +=							\
	-DDBUS_API_SUBJECT_TO_CHANGE
Terminal_SOURCES +=							\
	$(Terminal_dbus_sources)
endif


##
## 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-tetc							\
	xgen-teth							\
	xgen-tmc							\
	xgen-tmh

DISTCLEANFILES =							\
	stamp-terminal-enum-types.h					\
	stamp-terminal-marshal.h					\
	$(Terminal_built_sources)

BUILT_SOURCES =								\
	$(Terminal_built_sources)

terminal-enum-types.h: stamp-terminal-enum-types.h
	@true
stamp-terminal-enum-types.h: $(Terminal_headers) Makefile
	( cd $(srcdir) && glib-mkenums \
		--fhead "#ifndef __TERMINAL_ENUM_TYPES_H__\n#define __TERMINAL_ENUM_TYPES_H__\n#include <exo/exo.h>\nG_BEGIN_DECLS\n" \
		--fprod "/* enumerations from \"@filename@\" */\n" \
		--vhead "GType @enum_name@_get_type (void);\n#define TERMINAL_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
		--ftail "G_END_DECLS\n\n#endif /* !__TERMINAL_ENUM_TYPES_H__ */" \
		$(Terminal_headers) ) >> xgen-teth \
	&& (cmp -s xgen-teth terminal-enum-types.h || cp xgen-teth terminal-enum-types.h ) \
	&& rm -f xgen-teth \
	&& echo timestamp > $(@F)
terminal-enum-types.c: $(Terminal_headers) Makefile
	( cd $(srcdir) && glib-mkenums \
		--fhead "#ifdef HAVE_CONFIG_H\n#include <config.h>\n#endif\n#undef GTK_DISABLE_DEPRECATED\n#define GTK_ENABLE_BROKEN\n#include <terminal/terminal-enum-types.h>\n#include <terminal/terminal-app.h>\n#include <terminal/terminal-helper.h>\n#include <terminal/terminal-preferences.h>" \
		--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" \
		$(Terminal_headers) ) >> xgen-tetc \
	&& cp xgen-tetc terminal-enum-types.c \
	&& rm -f xgen-tetc

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

terminal-marshal.c: terminal-marshal.list Makefile
	( cd $(srcdir) && glib-genmarshal \
		--prefix=_terminal_marshal \
		--body terminal-marshal.list ) >> xgen-tmc \
	&& cp xgen-tmc terminal-marshal.c \
	&& rm -f xgen-tmc
endif


clean-local:
	rm -f *.core core core.*

EXTRA_DIST =								\
	terminal-config.h.in						\
	terminal-marshal.list

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