[bijiben] build: Tidy up glib-compile-resources usage in Makefile.am



commit 0248bf87164a23f8ff9cd80b31c25af11e92ca53
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Apr 18 22:02:56 2017 +0800

    build: Tidy up glib-compile-resources usage in Makefile.am
    
    Use $(AM_V_GEN), calculate dependencies automatically, and use
    nodist_bijiben_SOURCES correctly to ensure generated sources are not
    distributed. This means the dist-hook can be removed.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762648

 configure.ac    |    2 ++
 src/Makefile.am |   40 +++++++++++++++++-----------------------
 2 files changed, 19 insertions(+), 23 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b170d37..0ced3d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,8 @@ AM_CONDITIONAL([ENABLE_UPDATE_MIMEDB],
 
 AC_PATH_PROG([DESKTOP_FILE_VALIDATE], [desktop-file-validate])
 
+# Utility programs
+AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources])
 
 LT_INIT
 
diff --git a/src/Makefile.am b/src/Makefile.am
index e4139bf..b9f6fd1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,25 +33,19 @@ LDADD = libbiji/libbiji.la \
 bijiben_LDFLAGS = \
        -Wl,--export-dynamic
 
-resource_files = \
-       resources/Adwaita.css \
-       resources/app-menu.ui \
-       resources/editor-toolbar.ui \
-       resources/note-symbolic.svg \
-       resources/thumbnail-frame.png
-
-bjb-resources.c: bjb.gresource.xml $(resource_files)
-       glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name bjb 
$(srcdir)/bjb.gresource.xml
-
-bjb-resources.h: bjb.gresource.xml
-       glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-header --c-name bjb 
$(srcdir)/bjb.gresource.xml
-
-bijiben_built_sources = \
+bjb_gresource_xml_deps = \
+       $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir=$(srcdir) 
$(srcdir)/bjb.gresource.xml)
+bjb-resources.c: bjb.gresource.xml $(bjb_gresource_xml_deps)
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name bjb 
$<
+bjb-resources.h: bjb.gresource.xml $(bjb_gresource_xml_deps)
+       $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-header --c-name bjb 
$<
+
+bijiben_resources_sources = \
        bjb-resources.c \
-       bjb-resources.h
+       bjb-resources.h \
+       $(NULL)
 
 bijiben_SOURCES = \
-       $(bijiben_built_sources) \
        bjb-app-menu.c \
        bjb-app-menu.h \
        bjb-bijiben.c \
@@ -94,6 +88,10 @@ bijiben_SOURCES = \
        bjb-window-base.c \
        bjb-window-base.h
 
+nodist_bijiben_SOURCES = \
+       $(bjb_resources_sources) \
+       $(NULL)
+
 dbus_shell_search_provider_built_sources =             \
        bijiben-shell-search-provider-generated.c       \
        bijiben-shell-search-provider-generated.h
@@ -111,26 +109,22 @@ bijiben_shell_search_provider_SOURCES =   \
        $(NULL)
 
 nodist_bijiben_shell_search_provider_SOURCES =         \
-       $(bijiben_built_sources) \
+       $(bijiben_resources_sources) \
        $(dbus_shell_search_provider_built_sources)     \
        $(NULL)
 
 BUILT_SOURCES = \
-       $(bijiben_built_sources) \
+       $(bijiben_resources_sources) \
        $(dbus_shell_search_provider_built_sources)     \
        $(NULL)
 
 EXTRA_DIST = \
        bjb.gresource.xml \
-  $(resource_files) \
+       $(bjb_gresource_xml_deps) \
        $(NULL)
 
 CLEANFILES = \
        $(BUILT_SOURCES)        \
        $(NULL)
 
-dist-hook:
-       cd $(distdir); rm -f $(CLEANFILES)
-
-
 -include $(top_srcdir)/git.mk


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