commit 2a6b5c1088128756824932d837fdd14b593eece1
parent dfa8f7981b612fb7d827776b1810f504dd6add10
Author: Thomas Gardner <tmg@fastmail.com>
Date: Tue, 24 Sep 2019 17:59:05 +1000
build: preserve generated files
GNU Make sees the generated protocol source file as intermediate. But
intermediate files are deleted after the make invocation. This leads to
two undesirable behaviours:
1. the generated file cannot be inspected,
2. the pretty printed build output becomes tainted.
Making the file a prerequisite of .PRECIOUS prevents the deletion.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/protocol/local.mk b/protocol/local.mk
@@ -4,6 +4,10 @@ dir := protocol
PROTOCOL_EXTENSIONS = $(dir)/wayland-drm.xml
+# GNUMake correctly marks %-protocol.c as an intermediate file, and deletes it
+# after the build. The file can be preserved by marking it as precious.
+.PRECIOUS: $(dir)/%-protocol.c
+
$(dir)/%-protocol.c: $(dir)/%.xml
$(call quiet,GEN,$(WAYLAND_SCANNER)) code < $< > $@