Subject: bug#75655: configure doesn't update Makefile

From: Pip Cet <[email-masked]>
Date: Thu, 23 Jan 2025 20:10:44 +0000

"Stefan Kangas" <[email-masked]> writes:

> Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <[email-masked]> writes:
>
>> If we can't remove the advice (the first case has already been made
>> unnecessary (commit 4939f58d2c45062d5eac3f4c845b4494cf113f1f); the
>> $(wildcard) proposal merely does the same thing for the second case), we
>> should, at least, recommend "git clean --interactive -dX" instead.
>>
>> -i rather than -f asks the user for confirmation; -X instead of -x will
>> avoid the unnecessary deletion of files we're almost certain are
>> valuable. This option and the "-d" option don't have long equivalents.
>>
>> Confirmed to work in this case.
>
> +1
>
> I think the advice is occasionally useful, but making it safe is even
> better.
>
> At the very least, we should write in big bold letters to be careful
> with this command, but I'd prefer just changing it to the safe version
> as I fail to see any drawbacks.

Proposed patch.  Please criticize hard: this is the second file a person
building Emacs from git for the first time will read, and it's worth it
to get this right.

This patch is independent of fixing the issue; if we decide to do the
wildcard thing, we might eventually be able to remove the first
suggestion and go straight to "git clean -idX", but as the problem
cannot be fixed retroactively, we should definitely keep this hint for a
few years.

We can think of this as a new section; some content remains, but the
order and wording changed significantly, the examples were replaced, the
instructions were simplified.  As all commands should be safe to run now
(assuming the user didn't edit autogenerated files), present them like
the other safe commands.

The error message mentions benchmarks/Makefile.in because that's likely
the first one people will see, and because that is the precise messsage
I actually saw.

>From c97a5e0f5e1467e2e3bbbf2a53a2190c2d083b3f Mon Sep 17 00:00:00 2001
From: Pip Cet <[email-masked]>
Subject: [PATCH] Improve instructions for Makefile regeneration (bug#75655)

The scratch/elisp-benchmarks branch will add benchmarks/Makefile.in.
Switching back to an older revision that doesn't have the directory
will result in a broken Makefile which can be manually deleted to make
the tree buildable again.

* INSTALL.REPO (configuration): Remove outdated examples.  Add current
example.  Recommend safer switches for "git clean".
---
 INSTALL.REPO | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/INSTALL.REPO b/INSTALL.REPO
index 6a6c7a2187b..68d11ba9756 100644
--- a/INSTALL.REPO
+++ b/INSTALL.REPO
@@ -75,18 +75,19 @@ To rebuild Emacs with the default configuration options, you can use:
 
   $ make bootstrap configure=default
 
-Occasionally, there are changes that 'make bootstrap' won't be able to
-handle.  The most thorough cleaning can be achieved by 'git clean -fdx'
-which will leave you with only files from the git repository.  Here
-are some faster methods for a couple of particular error cases:
+Rarely, after a git update, all 'make' commands will fail because the
+Makefile itself is no longer usable.  Error messages such as:
 
-    /usr/bin/m4:aclocal.m4:9: cannot open `m4/stdbit_h.m4': No such file or directory
+    make: *** No rule to make target 'benchmarks/Makefile.in', needed by 'Makefile'.  Stop.
 
-This can be fixed with 'rm aclocal.m4'.
+indicate this.  You should delete and rebuild the Makefile:
 
-    make: *** No rule to make target 'lib/Makefile.am', needed by 'lib/Makefile.in'
+  $ rm -f Makefile
+  $ make
+
+If this doesn't fix the problem, you can clean the git repo:
 
-This can be fixed with 'rm lib/Makefile Makefile'.
+  $ git clean -idX
 
 Because the repository version of Emacs is a work in progress, it will
 sometimes fail to build.  Please wait a day or so (and check the
-- 
2.47.1