Subject: a build failure in a VPATH build
From: Bruno Haible <[email-masked]>
To: [email-masked]
Date: Sun, 21 Jul 2024 19:34:22 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

A VPATH build of diffutils (git HEAD, with GNU make, on Ubuntu 22.04)
fails like this:

$ mkdir bb
$ cd bb
$ ../configure
$ make
...
make[1]: Entering directory '/DIFFUTILS/diffutils/bb/src'
  GEN      paths.h
  CC       cmp.o
In file included from ../../src/cmp.c:19:
../../src/system.h:87:10: fatal error: version.h: No such file or directory
   87 | #include "version.h"
      |          ^~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:2451: cmp.o] Error 1

The attached patch fixes it.

From 17ef3ec3c21a9e56385538a620b2837b4b0a1bdd Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email-masked]>
Date: Sun, 21 Jul 2024 19:30:46 +0200
Subject: [PATCH] build: Fix a build failure in a VPATH build

* src/Makefile.am (cmp.$(OBJEXT) etc.): Depend on version.h.
---
 src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 01c6f1f..04c9201 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,7 +52,7 @@ noinst_HEADERS = diff.h system.h
 
 MOSTLYCLEANFILES = paths.h paths.ht
 
-cmp.$(OBJEXT) diff3.$(OBJEXT) diff.$(OBJEXT) sdiff.$(OBJEXT): paths.h
+cmp.$(OBJEXT) diff3.$(OBJEXT) diff.$(OBJEXT) sdiff.$(OBJEXT): paths.h version.h
 
 gdiff = `echo diff|sed '$(transform)'`
 BUILT_SOURCES = paths.h
-- 
2.34.1