summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUli Schlachter <psychon@znc.in>2013-10-13 11:55:48 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-10-13 21:37:44 +0200
commit0bde33d9a11e73c1e798b40c453fa0593f8f706b (patch)
tree12e8c6db5086010ca05587c4a05bdbe817b82728
parent0d84049a454bc613c38c26a8e78b0398ec704385 (diff)
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@znc.in>
-rw-r--r--cursor/Makefile.am5
1 files changed, 4 insertions, 1 deletions
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