[gimp] enums: don't write generated enum files to src-dir if unchanged



commit f9fa0d1b189ec01b06695176d271f010f4fb0965
Author: Ell <ell_se yahoo com>
Date:   Mon May 22 17:19:17 2017 -0400

    enums: don't write generated enum files to src-dir if unchanged
    
    When regenerating an enum file, don't copy it back to the source
    directory if it hasn't actually changed.  This allows using a read-
    only source directory where the enum header is newer than the
    generated file, as long as they're not really out of sync.
    
    OTOH, *do* touch the generated source-dir file even when unchanged,
    in order to avoid re-running its recipe on the next build, however,
    allow this to silently fail (which is harmless).

 app/config/Makefile.am     |   20 ++++++++++++++------
 app/core/Makefile.am       |   17 +++++++++++++----
 app/display/Makefile.am    |   17 +++++++++++++----
 app/gegl/Makefile.am       |   19 ++++++++++++++-----
 app/operations/Makefile.am |   19 ++++++++++++++-----
 app/paint/Makefile.am      |   17 +++++++++++++----
 app/plug-in/Makefile.am    |   19 ++++++++++++++-----
 app/text/Makefile.am       |   17 +++++++++++++----
 app/tools/Makefile.am      |   17 +++++++++++++----
 app/widgets/Makefile.am    |   17 +++++++++++++----
 libgimp/Makefile.am        |    2 +-
 libgimpbase/Makefile.am    |   37 +++++++++++++++++++++++++++----------
 libgimpconfig/Makefile.am  |   17 +++++++++++++----
 libgimpthumb/Makefile.am   |    2 +-
 libgimpwidgets/Makefile.am |   17 +++++++++++++----
 15 files changed, 189 insertions(+), 65 deletions(-)
---
diff --git a/app/config/Makefile.am b/app/config/Makefile.am
index be87b44..f6f3d00 100644
--- a/app/config/Makefile.am
+++ b/app/config/Makefile.am
@@ -132,10 +132,10 @@ CLEANFILES = $(EXTRA_PROGRAMS) foorc
 # rules to generate built sources
 #
 # setup autogeneration dependencies
-gen_sources = xgen-dec
+gen_sources = xgen-cec
 CLEANFILES += $(gen_sources)
 
-$(srcdir)/config-enums.c: $(srcdir)/config-enums.h $(GIMP_MKENUMS)
+xgen-cec: $(srcdir)/config-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"config-enums.h\"\n#include\"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -145,7 +145,15 @@ $(srcdir)/config-enums.c: $(srcdir)/config-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               config-enums.h) > xgen-dec \
-       && cp xgen-dec $@ \
-       && rm -f xgen-dec
-
+               config-enums.h) > $@
+
+$(srcdir)/config-enums.c: xgen-cec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 9e99352..63e734d 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -450,7 +450,7 @@ gimpmarshal.c: gimpmarshal.h
        && cp xgen-gmc $(@F) \
        && rm -f xgen-gmc xgen-gmc~
 
-$(srcdir)/core-enums.c: $(srcdir)/core-enums.h $(GIMP_MKENUMS)
+xgen-cec: $(srcdir)/core-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"core-enums.h\"\n#include \"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -460,6 +460,15 @@ $(srcdir)/core-enums.c: $(srcdir)/core-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               core-enums.h) > xgen-cec \
-       && cp xgen-cec $@ \
-       && rm -f xgen-cec
+               core-enums.h) > $@
+
+$(srcdir)/core-enums.c: xgen-cec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/display/Makefile.am b/app/display/Makefile.am
index a7cd6ac..46acb10 100644
--- a/app/display/Makefile.am
+++ b/app/display/Makefile.am
@@ -178,7 +178,7 @@ libappdisplay_a_SOURCES = \
 gen_sources = xgen-dec
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/display-enums.c: $(srcdir)/display-enums.h $(GIMP_MKENUMS)
+xgen-dec: $(srcdir)/display-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"display-enums.h\"\n#include\"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -188,6 +188,15 @@ $(srcdir)/display-enums.c: $(srcdir)/display-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               display-enums.h) > xgen-dec \
-       && cp xgen-dec $@ \
-       && rm -f xgen-dec
+               display-enums.h) > $@
+
+$(srcdir)/display-enums.c: xgen-dec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/gegl/Makefile.am b/app/gegl/Makefile.am
index 5cfdc15..a6a7f4f 100644
--- a/app/gegl/Makefile.am
+++ b/app/gegl/Makefile.am
@@ -49,10 +49,10 @@ libappgegl_a_SOURCES = $(libappgegl_a_built_sources) $(libappgegl_a_sources)
 # rules to generate built sources
 #
 # setup autogeneration dependencies
-gen_sources = xgen-tec
+gen_sources = xgen-ggec
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/gimp-gegl-enums.c: $(srcdir)/gimp-gegl-enums.h $(GIMP_MKENUMS)
+xgen-ggec: $(srcdir)/gimp-gegl-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"core/core-enums.h\"\n#include \"gimp-gegl-enums.h\"\n#include 
\"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -62,6 +62,15 @@ $(srcdir)/gimp-gegl-enums.c: $(srcdir)/gimp-gegl-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               gimp-gegl-enums.h) > xgen-tec \
-       && cp xgen-tec $@ \
-       && rm -f xgen-tec
+               gimp-gegl-enums.h) > $@
+
+$(srcdir)/gimp-gegl-enums.c: xgen-ggec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/operations/Makefile.am b/app/operations/Makefile.am
index a342f9a..2abca9e 100644
--- a/app/operations/Makefile.am
+++ b/app/operations/Makefile.am
@@ -108,10 +108,10 @@ libappoperations_a_SOURCES = \
 # rules to generate built sources
 #
 # setup autogeneration dependencies
-gen_sources = xgen-pec
+gen_sources = xgen-oec
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/operations-enums.c: $(srcdir)/operations-enums.h $(GIMP_MKENUMS)
+xgen-oec: $(srcdir)/operations-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"operations-enums.h\"\n#include \"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -121,6 +121,15 @@ $(srcdir)/operations-enums.c: $(srcdir)/operations-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               operations-enums.h) > xgen-pec \
-       && cp xgen-pec $@ \
-       && rm -f xgen-pec
+               operations-enums.h) > $@
+
+$(srcdir)/operations-enums.c: xgen-oec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/paint/Makefile.am b/app/paint/Makefile.am
index 4a14926..66df99f 100644
--- a/app/paint/Makefile.am
+++ b/app/paint/Makefile.am
@@ -98,7 +98,7 @@ libapppaint_a_SOURCES = $(libapppaint_a_built_sources) $(libapppaint_a_sources)
 gen_sources = xgen-pec
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/paint-enums.c: $(srcdir)/paint-enums.h $(GIMP_MKENUMS)
+xgen-pec: $(srcdir)/paint-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"paint-enums.h\"\n#include \"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -108,6 +108,15 @@ $(srcdir)/paint-enums.c: $(srcdir)/paint-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               paint-enums.h) > xgen-pec \
-       && cp xgen-pec $@ \
-       && rm -f xgen-pec
+               paint-enums.h) > $@
+
+$(srcdir)/paint-enums.c: xgen-pec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/plug-in/Makefile.am b/app/plug-in/Makefile.am
index 5dbc0ad..471bf9a 100644
--- a/app/plug-in/Makefile.am
+++ b/app/plug-in/Makefile.am
@@ -78,10 +78,10 @@ libappplug_in_a_SOURCES = \
 # rules to generate built sources
 #
 # setup autogeneration dependencies
-gen_sources = xgen-bec
+gen_sources = xgen-pec
 CLEANFILES = $(EXTRA_PROGRAMS) $(gen_sources)
 
-$(srcdir)/plug-in-enums.c: $(srcdir)/plug-in-enums.h $(GIMP_MKENUMS)
+xgen-pec: $(srcdir)/plug-in-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"plug-in-enums.h\"\n#include \"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -91,6 +91,15 @@ $(srcdir)/plug-in-enums.c: $(srcdir)/plug-in-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               plug-in-enums.h) > xgen-bec \
-       && cp xgen-bec $@ \
-       && rm -f xgen-bec
+               plug-in-enums.h) > $@
+
+$(srcdir)/plug-in-enums.c: xgen-pec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/text/Makefile.am b/app/text/Makefile.am
index e9bead5..44966e1 100644
--- a/app/text/Makefile.am
+++ b/app/text/Makefile.am
@@ -57,7 +57,7 @@ libapptext_a_SOURCES = $(libapptext_a_built_sources) $(libapptext_a_sources)
 gen_sources = xgen-tec
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/text-enums.c: $(srcdir)/text-enums.h $(GIMP_MKENUMS)
+xgen-tec: $(srcdir)/text-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"text-enums.h\"\n#include \"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -67,6 +67,15 @@ $(srcdir)/text-enums.c: $(srcdir)/text-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               text-enums.h) > xgen-tec \
-       && cp xgen-tec $@ \
-       && rm -f xgen-tec
+               text-enums.h) > $@
+
+$(srcdir)/text-enums.c: xgen-tec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/tools/Makefile.am b/app/tools/Makefile.am
index 3c6cca4..73adcc3 100644
--- a/app/tools/Makefile.am
+++ b/app/tools/Makefile.am
@@ -234,7 +234,7 @@ libapptools_a_SOURCES = $(libapptools_a_built_sources) $(libapptools_a_sources)
 gen_sources = xgen-tec
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/tools-enums.c: $(srcdir)/tools-enums.h $(GIMP_MKENUMS)
+xgen-tec: $(srcdir)/tools-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"core/core-enums.h\"\n#include \"tools-enums.h\"\n#include 
\"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -244,6 +244,15 @@ $(srcdir)/tools-enums.c: $(srcdir)/tools-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               tools-enums.h) > xgen-tec \
-       && cp xgen-tec $@ \
-       && rm -f xgen-tec
+               tools-enums.h) > $@
+
+$(srcdir)/tools-enums.c: xgen-tec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am
index a74dc94..66e0994 100644
--- a/app/widgets/Makefile.am
+++ b/app/widgets/Makefile.am
@@ -462,7 +462,7 @@ libappwidgets_a_SOURCES = \
 gen_sources = xgen-wec
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/widgets-enums.c: $(srcdir)/widgets-enums.h $(GIMP_MKENUMS)
+xgen-wec: $(srcdir)/widgets-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gtk/gtk.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"widgets-enums.h\"\n#include \"gimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -472,6 +472,15 @@ $(srcdir)/widgets-enums.c: $(srcdir)/widgets-enums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               widgets-enums.h) > xgen-wec \
-       && cp xgen-wec $@ \
-       && rm -f xgen-wec
+               widgets-enums.h) > $@
+
+$(srcdir)/widgets-enums.c: xgen-wec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
index fc43739..5ae5e6a 100644
--- a/libgimp/Makefile.am
+++ b/libgimp/Makefile.am
@@ -443,7 +443,7 @@ uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
 gen_sources = xgen-cec xgen-umh xgen-umc
 CLEANFILES = $(gen_sources)
 
-gimpenums.c: $(srcdir)/gimpenums.h $(srcdir)/gimpenums.c.tail $(GIMP_MKENUMS)
+gimpenums.c: $(srcdir)/gimpenums.h $(srcdir)/gimpenums.c.tail $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#undef 
GIMP_DISABLE_DEPRECATED\n#include \"libgimpbase/gimpbase.h\"\n#include 
\"libgimpconfig/gimpconfigenums.h\"\n#include \"gimpenums.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
diff --git a/libgimpbase/Makefile.am b/libgimpbase/Makefile.am
index 45a9a23..fff0dd3 100644
--- a/libgimpbase/Makefile.am
+++ b/libgimpbase/Makefile.am
@@ -201,7 +201,7 @@ EXTRA_PROGRAMS = test-cpu-accel
 gen_sources = xgen-bec xgen-cec
 CLEANFILES = $(EXTRA_PROGRAMS) $(gen_sources)
 
-$(srcdir)/gimpbaseenums.c: $(srcdir)/gimpbaseenums.h $(GIMP_MKENUMS)
+xgen-bec: $(srcdir)/gimpbaseenums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <glib-object.h>\n#undef 
GIMP_DISABLE_DEPRECATED\n#include \"gimpbasetypes.h\"\n#include \"libgimp/libgimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -211,11 +211,20 @@ $(srcdir)/gimpbaseenums.c: $(srcdir)/gimpbaseenums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE \"-libgimp\");\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               gimpbaseenums.h) > xgen-bec \
-       && cp xgen-bec $@ \
-       && rm -f xgen-bec
-
-$(srcdir)/gimpcompatenums.c: $(srcdir)/gimpcompatenums.h $(GIMP_MKENUMS)
+               gimpbaseenums.h) > $@
+
+$(srcdir)/gimpbaseenums.c: xgen-bec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
+
+xgen-cec: $(srcdir)/gimpcompatenums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <glib-object.h>\n#include 
\"gimpbasetypes.h\"\n#include \"gimpcompatenums.h\"\n#include \"libgimp/libgimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -225,9 +234,17 @@ $(srcdir)/gimpcompatenums.c: $(srcdir)/gimpcompatenums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE \"-libgimp\");\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               gimpcompatenums.h) > xgen-cec \
-       && cp xgen-cec $@ \
-       && rm -f xgen-cec
-
+               gimpcompatenums.h) > $@
+
+$(srcdir)/gimpcompatenums.c: xgen-cec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
 
 DISTCLEANFILES = gimpversion.h
diff --git a/libgimpconfig/Makefile.am b/libgimpconfig/Makefile.am
index 8664fd9..1464686 100644
--- a/libgimpconfig/Makefile.am
+++ b/libgimpconfig/Makefile.am
@@ -138,7 +138,7 @@ uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
 gen_sources = xgen-cec
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/gimpconfigenums.c: $(srcdir)/gimpconfigenums.h $(GIMP_MKENUMS)
+xgen-cec: $(srcdir)/gimpconfigenums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"gimpconfigenums.h\"\n#include \"libgimp/libgimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -148,6 +148,15 @@ $(srcdir)/gimpconfigenums.c: $(srcdir)/gimpconfigenums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE \"-libgimp\");\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               gimpconfigenums.h) > xgen-cec \
-       && cp xgen-cec $@ \
-       && rm -f xgen-cec
+               gimpconfigenums.h) > $@
+
+$(srcdir)/gimpconfigenums.c: xgen-cec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
diff --git a/libgimpthumb/Makefile.am b/libgimpthumb/Makefile.am
index 5406d0c..267f1aa 100644
--- a/libgimpthumb/Makefile.am
+++ b/libgimpthumb/Makefile.am
@@ -111,7 +111,7 @@ uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
 gen_sources = xgen-tec
 CLEANFILES = $(gen_sources)
 
-gimpthumb-enums.c: $(srcdir)/gimpthumb-enums.h $(GIMP_MKENUMS)
+gimpthumb-enums.c: $(srcdir)/gimpthumb-enums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <glib-object.h>\n#include \"gimpthumb-enums.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
diff --git a/libgimpwidgets/Makefile.am b/libgimpwidgets/Makefile.am
index 7a8bee0..0ad3e55 100644
--- a/libgimpwidgets/Makefile.am
+++ b/libgimpwidgets/Makefile.am
@@ -307,7 +307,7 @@ endif
 gen_sources = xgen-wec xgen-wmh xgen-wmc
 CLEANFILES = $(gen_sources)
 
-$(srcdir)/gimpwidgetsenums.c: $(srcdir)/gimpwidgetsenums.h $(GIMP_MKENUMS)
+xgen-wec: $(srcdir)/gimpwidgetsenums.h $(GIMP_MKENUMS) Makefile.am
        $(AM_V_GEN) (cd $(srcdir) && $(GIMP_MKENUMS) \
                --fhead "#include \"config.h\"\n#include <gio/gio.h>\n#include 
\"libgimpbase/gimpbase.h\"\n#include \"gimpwidgetsenums.h\"\n#include \"libgimp/libgimp-intl.h\"" \
                --fprod "\n/* enumerations from \"@filename@\" */" \
@@ -317,9 +317,18 @@ $(srcdir)/gimpwidgetsenums.c: $(srcdir)/gimpwidgetsenums.h $(GIMP_MKENUMS)
                --dhead "  static const Gimp@Type@Desc descs[] =\n  {" \
                --dprod "    { @VALUENAME@, @valuedesc@, @valuehelp@ }," \
                --dtail "    { 0, NULL, NULL }\n  };\n\n  static GType type = 0;\n\n  if (G_UNLIKELY (! 
type))\n    {\n      type = g_@type@_register_static (\"@EnumName@\", values);\n      
gimp_type_set_translation_domain (type, GETTEXT_PACKAGE \"-libgimp\");\n      
gimp_type_set_translation_context (type, \"@enumnick@\");\n      gimp_@type@_set_value_descriptions (type, 
descs);\n    }\n\n  return type;\n}\n" \
-               gimpwidgetsenums.h) > xgen-wec \
-       && cp xgen-wec $@ \
-       && rm -f xgen-wec
+               gimpwidgetsenums.h) > $@
+
+$(srcdir)/gimpwidgetsenums.c: xgen-wec
+       $(AM_V_GEN) if ! cmp -s $< $@; then \
+               cp $< $@; \
+       else \
+               # if the file hasn't changed, only update its timestamp, so that \
+               # the receipe doesn't get executed again next time, but allow this \
+               # to fail (e.g., when using a read-only source directory). \
+               touch $@ 2> /dev/null \
+               || true; \
+       fi
 
 gimpwidgetsmarshal.h: $(srcdir)/gimpwidgetsmarshal.list
        $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gimp_widgets_marshal $(srcdir)/gimpwidgetsmarshal.list 
--header >> xgen-wmh \


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