[gnome-todo] build: Refactor using standard macros



commit 3799b85c5cad9ec688a61b36a9d1d201b1845207
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Jul 21 11:01:46 2015 +0100

    build: Refactor using standard macros
    
    We should use the AX_* macros from autoconf-archive to improve the
    readability and maintainability of the build system.

 configure.ac    |   55 ++++++++++++++++++++++++-------------------------------
 src/Makefile.am |   21 ++++++++++++---------
 2 files changed, 36 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index cec2851..8b5d51b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,21 +14,20 @@ AM_SILENT_RULES([yes])
 # Releases do not have git directories
 AX_IS_RELEASE([git-directory])
 
-dnl ***************************************************************************
-dnl Internationalization
-dnl ***************************************************************************
-IT_PROG_INTLTOOL([0.40.6])
-PKG_PROG_PKG_CONFIG([0.22])
-
-GETTEXT_PACKAGE=AC_PACKAGE_TARNAME
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
-
 ## don't rerun to this point if we abort
 AC_CACHE_SAVE
 
-AM_PROG_CC_C_O
-AC_PROG_CXX
+# We require additional macros later on
+AX_REQUIRE_DEFINED([APPSTREAM_XML])
+AX_REQUIRE_DEFINED([IT_PROG_INTLTOOL])
+
+# Add debug symbol
+AX_CHECK_ENABLE_DEBUG([yes], [GNOME_TODO_ENABLE_DEBUG])
+
+# Enable compiler warnings
+AX_COMPILER_FLAGS([GNOME_TODO_WARN_CFLAGS], [GNOME_TODO_WARN_LDFLAGS])
+
+AC_PROG_CC_C_O
 AC_PROG_INSTALL
 
 # enable libtool
@@ -38,32 +37,26 @@ LT_INIT([disable-static])
 ## don't rerun to this point if we abort
 AC_CACHE_SAVE
 
+PKG_PROG_PKG_CONFIG
+
 GLIB_GSETTINGS
 AM_GLIB_GNU_GETTEXT
 
-# We require additional macros
-AX_REQUIRE_DEFINED([APPSTREAM_XML])
+dnl ***************************************************************************
+dnl Internationalization
+dnl ***************************************************************************
+IT_PROG_INTLTOOL([0.40.6])
+
+GETTEXT_PACKAGE=AC_PACKAGE_TARNAME
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
 
 dnl ================================================================
 dnl Misc
 dnl ================================================================
-AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
-
-GNOME_COMPILE_WARNINGS(maximum)
-
-MAINTAINER_COMPILER_FLAGS="\
-  $MAINTAINER_COMPILER_FLAGS\
- -Wall -Wcast-align -Wuninitialized\
- -Wno-strict-aliasing -Wempty-body -Wformat\
- -Wformat-security -Wformat-nonliteral -Winit-self\
- -Wdeclaration-after-statement -Wvla\
- -Wpointer-arith -Wmissing-declarations\
- -Wcast-align -Wmissing-prototypes\
- -Wredundant-decls"
-
-# strip leading spaces
-MAINTAINER_COMPILER_FLAGS=${MAINTAINER_COMPILER_FLAGS#*  }
-AC_SUBST(MAINTAINER_COMPILER_FLAGS)
+
+GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
+AC_SUBST([GLIB_COMPILE_RESOURCES])
 
 PKG_CHECK_MODULES(GNOME_TODO,
                   gmodule-export-2.0
diff --git a/src/Makefile.am b/src/Makefile.am
index 738eb84..af5cfe5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,14 +5,13 @@ AM_CPPFLAGS = \
        -DUI_DATA_DIR=\""$(pkgdatadir)/style"\" \
        -DGOA_API_IS_SUBJECT_TO_CHANGE \
        -I$(srcdir)/storage \
-       -I$(srcdir)/notification \
-       $(GNOME_TODO_CFLAGS)
+       -I$(srcdir)/notification
 
 bin_PROGRAMS = gnome-todo
 
 BUILT_SOURCES = \
-    gtd-resources.c \
-    gtd-resources.h
+       gtd-resources.c \
+       gtd-resources.h
 
 gnome_todo_SOURCES = \
        $(BUILT_SOURCES) \
@@ -58,18 +57,22 @@ gnome_todo_SOURCES = \
        gtd-window.h \
        main.c
 
+gnome_todo_CFLAGS = \
+       $(GNOME_TODO_CFLAGS) \
+       $(GNOME_TODO_WARN_CFLAGS)
+
 gnome_todo_LDFLAGS = \
-       -Wl,--export-dynamic
+       -Wl,--export-dynamic \
+       $(GNOME_TODO_WARN_LDFLAGS)
 
 gnome_todo_LDADD = \
-       -lm \
        $(GNOME_TODO_LIBS)
 
-resource_files = $(shell glib-compile-resources --sourcedir=$(top_srcdir)/data --generate-dependencies 
$(top_srcdir)/data/todo.gresource.xml)
+resource_files = $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(top_srcdir)/data --generate-dependencies 
$(top_srcdir)/data/todo.gresource.xml)
 gtd-resources.c: $(top_srcdir)/data/todo.gresource.xml $(resource_files)
-       glib-compile-resources --target=$@ --sourcedir=$(top_srcdir)/data --generate-source --c-name todo 
$(top_srcdir)/data/todo.gresource.xml
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data --generate-source 
--c-name todo $(top_srcdir)/data/todo.gresource.xml
 gtd-resources.h: $(top_srcdir)/data/todo.gresource.xml $(resource_files)
-       glib-compile-resources --target=$@ --sourcedir=$(top_srcdir)/data --generate-header --c-name todo 
$(top_srcdir)/data/todo.gresource.xml
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(top_srcdir)/data --generate-header 
--c-name todo $(top_srcdir)/data/todo.gresource.xml
 
 CLEANFILES = \
        $(BUILT_SOURCES)


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