[almanah] Tidy up build process and hide compilation churn



commit 0d515746d7fb9bc7b4c5a682a727d84ec88f5f9b
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Dec 22 15:15:33 2009 +0000

    Tidy up build process and hide compilation churn

 configure.ac    |   46 ++++++++++++++++---------
 src/Makefile.am |  101 +++++++++++++++++++++++-------------------------------
 2 files changed, 72 insertions(+), 75 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ff7696a..0c1428f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,18 +1,34 @@
 AC_INIT(almanah, 0.6.0)
 
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
-AM_CONFIG_HEADER(config.h)
-AM_MAINTAINER_MODE
+AC_CONFIG_SRCDIR([src/main.h])
+AC_CONFIG_HEADERS([config.h])
+AC_GNU_SOURCE
 
-AC_ISC_POSIX
-AC_PROG_CC
-AM_PROG_CC_STDC
-AC_HEADER_STDC
+AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-dist-gzip check-news])
+
+# Enable silent build when available (Automake 1.11)
+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+
+GETTEXT_PACKAGE=almanah
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"], [Define to the Gettext package name])
+AC_SUBST(GETTEXT_PACKAGE)
+AM_GLIB_GNU_GETTEXT
+IT_PROG_INTLTOOL([0.35.0])
+
+AC_PROG_CXX
+AM_PROG_CC_C_O
+AC_PROG_LIBTOOL()
+PKG_PROG_PKG_CONFIG
+AM_GCONF_SOURCE_2
+
+AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal])
+AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
 
 dnl ***************************************************************************
 dnl Options
 dnl ***************************************************************************
 
+dnl Debugging
 AC_ARG_ENABLE([debug],
 	AC_HELP_STRING([--enable-debug], [turn on debugging]),
 	[case "${enableval}" in
@@ -27,6 +43,7 @@ fi
 
 AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
 
+dnl Encryption support
 AC_ARG_ENABLE([encryption],
 	AC_HELP_STRING([--enable-encryption], [enable database encryption support]),
 	[case "${enableval}" in
@@ -41,6 +58,7 @@ fi
 
 AM_CONDITIONAL([ENCRYPTION], [test x$encryption = xtrue])
 
+dnl Spell checking
 AC_ARG_ENABLE([spell-checking],
 	AC_HELP_STRING([--enable-spell-checking], [enable spell checking support]),
 	[case "${enableval}" in
@@ -59,20 +77,12 @@ dnl ***************************************************************************
 dnl Dependencies
 dnl ***************************************************************************
 
-GETTEXT_PACKAGE=almanah
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
-AM_GLIB_GNU_GETTEXT
-IT_PROG_INTLTOOL([0.35.0])
-
-AM_PROG_LIBTOOL
-AM_GCONF_SOURCE_2
-AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
-
+dnl Required dependencies
 PKG_CHECK_MODULES(STANDARD, glib-2.0 gtk+-2.0 >= 2.14 gmodule-2.0 gio-2.0 sqlite3 cairo gconf-2.0 atk dbus-glib-1)
 AC_SUBST(STANDARD_CFLAGS)
 AC_SUBST(STANDARD_LIBS)
 
+dnl Evolution
 PKG_CHECK_MODULES(EVO, libecal-1.2 libedataserver-1.2 libedataserverui-1.2, have_evo=yes, have_evo=no)
 if test "x$have_evo" = "xyes"; then
 	AC_DEFINE(HAVE_EVO, 1, [Defined if libecal-1.2 is installed])
@@ -82,12 +92,14 @@ AM_CONDITIONAL([HAVE_EVO], [test x$have_evo = xyes])
 AC_SUBST(EVO_CFLAGS)
 AC_SUBST(EVO_LIBS)
 
+dnl Spell checking
 if test $spell_checking = "true"; then
 	PKG_CHECK_MODULES(SPELL_CHECKING, gtkspell-2.0)
 	AC_SUBST(SPELL_CHECKING_CFLAGS)
 	AC_SUBST(SPELL_CHECKING_LIBS)
 fi
 
+dnl Encryption support
 if test $encryption = "true"; then
 	PKG_CHECK_MODULES(ENCRYPTION, cryptui-0.0)
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 91a010d..7a6ac8c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,29 +1,8 @@
-INCLUDES = \
-	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"	\
-	-DPACKAGE_SRC_DIR=\""$(srcdir)"\"				\
-	-DPACKAGE_DATA_DIR=\""$(datadir)"\"				\
-	-I$(srcdir)/definitions						\
-	-I$(srcdir)/events						\
-	-I$(srcdir)/event-factories					\
-	$(STANDARD_CFLAGS)						\
-	$(EVO_CFLAGS)							\
-	$(ENCRYPTION_CFLAGS)						\
-	$(SPELL_CHECKING_CFLAGS)
-
-if DEBUG
-AM_CFLAGS = \
-	-fprofile-arcs	\
-	-ftest-coverage
-endif
-
 bin_PROGRAMS = almanah
 
 almanah_SOURCES = \
 	$(ALMANAH_MARSHAL_FILES)	\
-	definition-builtins.c	\
-	definition-builtins.h	\
-	event-factory-builtins.c	\
-	event-factory-builtins.h	\
+	$(ALMANAH_ENUM_FILES)	\
 	main.c			\
 	main.h			\
 	interface.c		\
@@ -88,7 +67,30 @@ almanah_SOURCES += \
 	preferences-dialog.h
 endif
 
-almanah_LDFLAGS = 
+almanah_CPPFLAGS = \
+	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\"	\
+	-DPACKAGE_SRC_DIR=\""$(srcdir)"\"				\
+	-DPACKAGE_DATA_DIR=\""$(datadir)"\"				\
+	-I$(srcdir)/definitions						\
+	-I$(srcdir)/events						\
+	-I$(srcdir)/event-factories					\
+	$(DISABLE_DEPRECATED)						\
+	$(AM_CPPFLAGS)
+
+almanah_CFLAGS = \
+	$(STANDARD_CFLAGS)		\
+	$(EVO_CFLAGS)			\
+	$(ENCRYPTION_CFLAGS)		\
+	$(SPELL_CHECKING_CFLAGS)	\
+	$(WARN_CFLAGS)			\
+	$(AM_CFLAGS)
+
+if DEBUG
+almanah_CFLAGS += \
+	-fprofile-arcs	\
+	-ftest-coverage
+endif
+
 almanah_LDADD = \
 	$(STANDARD_LIBS)	\
 	$(EVO_LIBS)		\
@@ -100,70 +102,53 @@ ALMANAH_MARSHAL_FILES = \
 	almanah-marshal.c	\
 	almanah-marshal.h
 
-GLIB_GENMARSHAL = `pkg-config --variable=glib_genmarshal glib-2.0`
-
 almanah-marshal.h: almanah-marshal.list Makefile
-	( $(GLIB_GENMARSHAL) --prefix=almanah_marshal $(srcdir)/almanah-marshal.list --header > almanah-marshal.h )
+	$(AM_V_GEN)( $(GLIB_GENMARSHAL) --prefix=almanah_marshal $(srcdir)/almanah-marshal.list --header > $(@F) )
 almanah-marshal.c: almanah-marshal.h Makefile
-	( $(GLIB_GENMARSHAL) --prefix=almanah_marshal $(srcdir)/almanah-marshal.list --header --body > almanah-marshal.c )
+	$(AM_V_GEN)( $(GLIB_GENMARSHAL) --prefix=almanah_marshal $(srcdir)/almanah-marshal.list --header --body > $(@F) )
 
 # Enums
-definition-builtins.h: stamp-definition-builtins.h
-	@true
+ALMANAH_ENUM_FILES = \
+	definition-builtins.h		\
+	definition-builtins.c		\
+	event-factory-builtins.h	\
+	event-factory-builtins.c
 
-stamp-definition-builtins.h: definition.h Makefile
-	(cd $(srcdir) && $(GLIB_MKENUMS) \
+definition-builtins.h: definition.h Makefile
+	$(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) \
 			--fhead "#ifndef __ALMANAH_DEFINITION_BUILTINS_H__\n#define __ALMANAH_DEFINITION_BUILTINS_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
 			--fprod "/* enumerations from \"@filename \" */\n" \
 			--vhead "GType @enum_name _get_type (void) G_GNUC_CONST;\n#define ALMANAH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
-			--ftail "G_END_DECLS\n\n#endif /* __ALMANAH_DEFINITION_BUILTINS_H__ */" definition.h) >> xgen-gtbh \
-	&& (cmp -s xgen-gtbh definition-builtins.h || cp xgen-gtbh definition-builtins.h ) \
-	&& rm -f xgen-gtbh \
-	&& echo timestamp > $(@F)
+			--ftail "G_END_DECLS\n\n#endif /* __ALMANAH_DEFINITION_BUILTINS_H__ */" definition.h) > $(@F)
 
 definition-builtins.c: definition.h Makefile definition-builtins.h
-	(cd $(srcdir) && $(GLIB_MKENUMS) \
+	$(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) \
 			--fhead "#include \"definition.h\"\n#include \"definition-builtins.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" \
-		definition.h ) > xgen-gtbc \
-	&& cp xgen-gtbc definition-builtins.c  \
-	&& rm -f xgen-gtbc
-
-event-factory-builtins.h: stamp-event-factory-builtins.h
-	@true
+		definition.h ) > $(@F)
 
-stamp-event-factory-builtins.h: event-factory.h Makefile
-	(cd $(srcdir) && $(GLIB_MKENUMS) \
+event-factory-builtins.h: event-factory.h Makefile
+	$(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) \
 			--fhead "#ifndef __ALMANAH_EVENT_FACTORY_BUILTINS_H__\n#define __ALMANAH_EVENT_FACTORY_BUILTINS_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
 			--fprod "/* enumerations from \"@filename \" */\n" \
 			--vhead "GType @enum_name _get_type (void) G_GNUC_CONST;\n#define ALMANAH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
-			--ftail "G_END_DECLS\n\n#endif /* __ALMANAH_EVENT_FACTORY_BUILTINS_H__ */" event-factory.h) >> xgen-gtbh \
-	&& (cmp -s xgen-gtbh event-factory-builtins.h || cp xgen-gtbh event-factory-builtins.h ) \
-	&& rm -f xgen-gtbh \
-	&& echo timestamp > $(@F)
+			--ftail "G_END_DECLS\n\n#endif /* __ALMANAH_EVENT_FACTORY_BUILTINS_H__ */" event-factory.h) > $(@F)
 
 event-factory-builtins.c: event-factory.h Makefile event-factory-builtins.h
-	(cd $(srcdir) && $(GLIB_MKENUMS) \
+	$(AM_V_GEN)(cd $(srcdir) && $(GLIB_MKENUMS) \
 			--fhead "#include \"event-factory.h\"\n#include \"event-factory-builtins.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" \
-		event-factory.h ) > xgen-gtbc \
-	&& cp xgen-gtbc event-factory-builtins.c  \
-	&& rm -f xgen-gtbc
+		event-factory.h ) > $(@F)
 
 CLEANFILES = \
 	$(ALMANAH_MARSHAL_FILES)	\
-	definition-builtins.h		\
-	definition-builtins.c		\
-	stamp-definition-builtins.h	\
-	event-factory-builtins.h		\
-	event-factory-builtins.c		\
-	stamp-event-factory-builtins.h
+	$(ALMANAH_ENUM_FILES)
 
 EXTRA_DIST = almanah-marshal.list
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]