[gthumb] build: Fix parallel build problems with enum generation
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] build: Fix parallel build problems with enum generation
- Date: Tue, 31 Jul 2012 20:17:20 +0000 (UTC)
commit e15ad6cac0bb91b3d9b4ee51f1fb37917a6423f1
Author: Ross Burton <ross burton intel com>
Date: Tue Jul 31 17:26:27 2012 +0100
build: Fix parallel build problems with enum generation
If the enum rule is triggered because one of the dependencies changed, but the
resulting enum-types file is identical, it isn't copied across. This causes
problems in parallel builds because make busy-loops on the file changing instead
of just running the commands sequentially.
The upshot is that a make -j where this happens (simply touching a .h file will
do it) will sit spinning inside make.
Fix this by pruning the dependencies to only those actually required, and doing
a mv instead of cmp||cp. If the headers have been modified then we'll be
rebuilding anyway so the optimisation of the cmp is simply causing bugs.
https://bugzilla.gnome.org/show_bug.cgi?id=680925
extensions/contact_sheet/Makefile.am | 10 ++++------
extensions/file_tools/Makefile.am | 10 ++++------
extensions/importer/Makefile.am | 10 ++++------
extensions/pixbuf_savers/Makefile.am | 10 ++++------
gthumb/Makefile.am | 10 ++++------
5 files changed, 20 insertions(+), 30 deletions(-)
---
diff --git a/extensions/contact_sheet/Makefile.am b/extensions/contact_sheet/Makefile.am
index 2a74fb5..e45dd22 100644
--- a/extensions/contact_sheet/Makefile.am
+++ b/extensions/contact_sheet/Makefile.am
@@ -18,17 +18,16 @@ HEADER_FILES = \
preferences.h \
$(NULL)
-enum-types.h: $(HEADER_FILES) $(GLIB_MKENUMS)
+enum-types.h: $(HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#ifndef ENUM_TYPES_H\n#define ENUM_TYPES_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
--fprod "/* enumerations from \"@filename \" */\n" \
--vhead "GType @enum_name _get_type (void);\n#define GTH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* ENUM_TYPES_H */" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) enum-types.h || cp xgen-$(@F) enum-types.h ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) enum-types.h )
-enum-types.c: $(HEADER_FILES) enum-types.h
+enum-types.c: $(HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#include <glib-object.h>\n" \
--fprod "\n/* enumerations from \"@filename \" */\n#include \"@filename \"" \
@@ -36,8 +35,7 @@ enum-types.c: $(HEADER_FILES) enum-types.h
--vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName \", values);\n }\n return etype;\n}\n" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) enum-types.c || cp xgen-$(@F) enum-types.c ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) enum-types.c )
libcontact_sheet_la_SOURCES = \
$(ENUM_TYPES) \
diff --git a/extensions/file_tools/Makefile.am b/extensions/file_tools/Makefile.am
index f2dffce..feab2a1 100644
--- a/extensions/file_tools/Makefile.am
+++ b/extensions/file_tools/Makefile.am
@@ -32,17 +32,16 @@ HEADER_FILES = \
gth-image-rotator.h \
preferences.h
-enum-types.h: $(HEADER_FILES) $(GLIB_MKENUMS)
+enum-types.h: $(HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#ifndef ENUM_TYPES_H\n#define ENUM_TYPES_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
--fprod "/* enumerations from \"@filename \" */\n" \
--vhead "GType @enum_name _get_type (void);\n#define GTH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* ENUM_TYPES_H */" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) enum-types.h || cp xgen-$(@F) enum-types.h ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) enum-types.h )
-enum-types.c: $(HEADER_FILES) enum-types.h
+enum-types.c: $(HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#include <glib-object.h>\n" \
--fprod "\n/* enumerations from \"@filename \" */\n#include \"@filename \"" \
@@ -50,8 +49,7 @@ enum-types.c: $(HEADER_FILES) enum-types.h
--vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName \", values);\n }\n return etype;\n}\n" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) enum-types.c || cp xgen-$(@F) enum-types.c ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) enum-types.c )
libfile_tools_la_SOURCES = \
$(ENUM_TYPES) \
diff --git a/extensions/importer/Makefile.am b/extensions/importer/Makefile.am
index d8dcfcd..828f56a 100644
--- a/extensions/importer/Makefile.am
+++ b/extensions/importer/Makefile.am
@@ -14,17 +14,16 @@ HEADER_FILES = \
preferences.h \
utils.h
-gth-import-enum-types.h: $(HEADER_FILES) $(GLIB_MKENUMS)
+gth-import-enum-types.h: $(HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#ifndef ENUM_TYPES_H\n#define ENUM_TYPES_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
--fprod "/* enumerations from \"@filename \" */\n" \
--vhead "GType @enum_name _get_type (void);\n#define GTH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* ENUM_TYPES_H */" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) gth-import-enum-types.h || cp xgen-$(@F) gth-import-enum-types.h ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) gth-import-enum-types.h )
-gth-import-enum-types.c: $(HEADER_FILES) gth-import-enum-types.h
+gth-import-enum-types.c: $(HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#include <glib-object.h>\n" \
--fprod "\n/* enumerations from \"@filename \" */\n#include \"@filename \"" \
@@ -32,8 +31,7 @@ gth-import-enum-types.c: $(HEADER_FILES) gth-import-enum-types.h
--vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName \", values);\n }\n return etype;\n}\n" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) gth-import-enum-types.c || cp xgen-$(@F) gth-import-enum-types.c ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) gth-import-enum-types.c )
libimporter_la_SOURCES = \
$(ENUM_TYPES) \
diff --git a/extensions/pixbuf_savers/Makefile.am b/extensions/pixbuf_savers/Makefile.am
index f2f7563..0be9d60 100644
--- a/extensions/pixbuf_savers/Makefile.am
+++ b/extensions/pixbuf_savers/Makefile.am
@@ -12,17 +12,16 @@ ENUM_TYPES = \
HEADER_FILES = \
preferences.h
-enum-types.h: $(HEADER_FILES) $(GLIB_MKENUMS)
+enum-types.h: $(HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#ifndef ENUM_TYPES_H\n#define ENUM_TYPES_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
--fprod "/* enumerations from \"@filename \" */\n" \
--vhead "GType @enum_name _get_type (void);\n#define GTH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* ENUM_TYPES_H */" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) enum-types.h || cp xgen-$(@F) enum-types.h ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) enum-types.h )
-enum-types.c: $(HEADER_FILES) enum-types.h
+enum-types.c: $(HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#include <glib-object.h>\n" \
--fprod "\n/* enumerations from \"@filename \" */\n#include \"@filename \"" \
@@ -30,8 +29,7 @@ enum-types.c: $(HEADER_FILES) enum-types.h
--vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName \", values);\n }\n return etype;\n}\n" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) enum-types.c || cp xgen-$(@F) enum-types.c ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) enum-types.c )
libpixbuf_savers_la_SOURCES = \
$(ENUM_TYPES) \
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index 1fe4d91..9d7d8f2 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -322,17 +322,16 @@ gthumb_CFLAGS = \
-DGTHUMB_APPLICATIONS_DIR=\"$(applications_dir)\" \
$(NULL)
-gth-enum-types.h: $(PUBLIC_HEADER_FILES) $(GLIB_MKENUMS)
+gth-enum-types.h: $(PUBLIC_HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#ifndef GTH_ENUM_TYPES_H\n#define GTH_ENUM_TYPES_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
--fprod "/* enumerations from \"@filename \" */\n" \
--vhead "GType @enum_name _get_type (void);\n#define GTH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
--ftail "G_END_DECLS\n\n#endif /* GTH_ENUM_TYPES_H */" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) gth-enum-types.h || cp xgen-$(@F) gth-enum-types.h ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) gth-enum-types.h )
-gth-enum-types.c: $(PUBLIC_HEADER_FILES) gth-enum-types.h
+gth-enum-types.c: $(PUBLIC_HEADER_FILES)
$(AM_V_GEN)( $(GLIB_MKENUMS) \
--fhead "#include <glib-object.h>\n" \
--fprod "\n/* enumerations from \"@filename \" */\n#include \"@filename \"" \
@@ -340,8 +339,7 @@ gth-enum-types.c: $(PUBLIC_HEADER_FILES) gth-enum-types.h
--vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_ type@_register_static (\"@EnumName \", values);\n }\n return etype;\n}\n" \
$^> xgen-$(@F) \
- && (cmp -s xgen-$(@F) gth-enum-types.c || cp xgen-$(@F) gth-enum-types.c ) \
- && rm -f xgen-$(@F) )
+ && mv -f xgen-$(@F) gth-enum-types.c )
gth-marshal.h: gth-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN)( $(GLIB_GENMARSHAL) $(srcdir)/gth-marshal.list --header --prefix=gth_marshal > $@ )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]