From 0bde33d9a11e73c1e798b40c453fa0593f8f706b Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 13 Oct 2013 11:55:48 +0200 Subject: 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 --- cursor/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3