From 3e3a0304f7f3d76cfc0cd87cc7650e53a567471a Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Wed, 31 May 2023 14:50:21 -0500 Subject: [PATCH] Improve depfile generated by glib-compile-resources glib-compile-resources --dependency-file= currently generates a depfile with rules that look like this: foo.xml: resource1 resource2 This means that if any of the files listed in the GResource manifest foo.xml change, rebuild foo.xml because foo.xml depends on those files. This is not useful because the XML manifest is not expected to be a generated dependency and even if it was, changes to the listed files would not imply any need to regenerate the manifest. What we really do need to regenerate is the C source file that is generated by glib-compile-resources after processing the XML manifest and all the resource files. That is, the rule should look like this: foo.c: foo.xml resource1 resource2 as suggested by Hans Ulrich Niedermann in the issue report. Fixes #2829 --- gio/glib-compile-resources.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gio/glib-compile-resources.c b/gio/glib-compile-resources.c index 398a08ad4..46eec1914 100644 --- a/gio/glib-compile-resources.c +++ b/gio/glib-compile-resources.c @@ -987,11 +987,15 @@ main (int argc, char **argv) g_hash_table_iter_init (&iter, files); dep_string = g_string_new (NULL); - escaped = escape_makefile_string (srcfile); + escaped = escape_makefile_string (target); g_string_printf (dep_string, "%s:", escaped); g_free (escaped); - /* First rule: foo.xml: resource1 resource2.. */ + escaped = escape_makefile_string (srcfile); + g_string_append_printf (dep_string, " %s", escaped); + g_free (escaped); + + /* First rule: foo.c: foo.xml resource1 resource2.. */ while (g_hash_table_iter_next (&iter, &key, &data)) { file_data = data;