[Xcb-commit] xcb/util-cursor: 2 commits - cursor

Michael Stapelberg stapelberg at kemper.freedesktop.org
Sun Oct 13 12:38:15 PDT 2013


 cursor/Makefile.am |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 0bde33d9a11e73c1e798b40c453fa0593f8f706b
Author: Uli Schlachter <psychon at znc.in>
Date:   Sun Oct 13 11:55:48 2013 +0200

    Fail the build if gperf is needed, but not found
    
    The rule that cursor/Makefile.am uses for calling gperf can be found on the
    internet[0]. That page explains three cases that should be handled:
    
    1. gperf succeeded
    2. gperf failed
    3. gperf is missing
    
    The reasoning for the third case is:
    
      If $(GPERF) does not answer to --version, it is certainly missing, and missing
      already suggested to install Gperf. Then remove the temporary output file, and
      let the compilation proceed by updating the timestamp of the output file.
      That's a best effort, essentially helping users who get the project with
      broken timestamps.
    
    However, this assumes that the user is building from a tarball which already
    contains a working version of the output C file. When building from git, this
    file does not exist and instead of updating the timestamp of the output file,
    this Makefile rule would create the output file.
    
    Thus, the following four cases need to be handled:
    
    1. gperf succeeded
    2. gperf failed
    3. gperf is missing and the output file already exists
    4. gperf is missing and the output file is missing, too
    
    For the third case, the above reasoning applies. However, in the fourth case,
    the build would continue and produce a broken library. For xcb-util-cursor this
    means that linking to this library would fail with "undefined reference to
    `cursor_shape_to_id'". So in this case the build should fail.
    
    [0]: http://www.lrde.epita.fr/~akim/ccmp/doc/gnuprog2/Using-Gperf-with-the-GNU-Build-System.html
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/cursor/Makefile.am b/cursor/Makefile.am
index 6982845..3e92189 100644
--- a/cursor/Makefile.am
+++ b/cursor/Makefile.am
@@ -26,7 +26,10 @@ shape_to_id.c: shape_to_id.gperf
 	elif $(GPERF) --version >/dev/null 2>&1; then \
 	  rm $@t; \
 	  exit 1; \
-	else \
+	elif test -f $@; then \
 	  rm $@t; \
 	  touch $@; \
+	else \
+	  rm $@t; \
+	  exit 1; \
 	fi
commit 0d84049a454bc613c38c26a8e78b0398ec704385
Author: Uli Schlachter <psychon at znc.in>
Date:   Sun Oct 13 11:47:27 2013 +0200

    Use $(AM_V_GEN) when calling gperf
    
    This adds support for automake's silent mode to the gperf rule. In silent mode,
    make will not print the whole command lines, but only a short version of what it
    does.
    
    For this rule, "GEN shape_to_id.c" will be printed.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/cursor/Makefile.am b/cursor/Makefile.am
index 186a39e..6982845 100644
--- a/cursor/Makefile.am
+++ b/cursor/Makefile.am
@@ -21,7 +21,7 @@ GPERFFLAGS = --includes --struct-type --language=ANSI-C --switch=1
 CLEANFILES = shape_to_id.c
 
 shape_to_id.c: shape_to_id.gperf
-	if $(GPERF) $(GPERFFLAGS) shape_to_id.gperf >$@t; then \
+	$(AM_V_GEN)if $(GPERF) $(GPERFFLAGS) shape_to_id.gperf >$@t; then \
 	  mv $@t $@; \
 	elif $(GPERF) --version >/dev/null 2>&1; then \
 	  rm $@t; \


More information about the xcb-commit mailing list