From: Gregory Heytings <gregory@heytings.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: src/Makefile unhelpful
Date: Sat, 17 Sep 2022 10:46:24 +0000 [thread overview]
Message-ID: <0b5f34d9bc43b17dd0df@heytings.org> (raw)
In-Reply-To: <b24128855b9125242091@heytings.org>
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
Complete patch attached, comments welcome.
I added a (minimal) sanity check, too. I remember at least one case when
make "failed to fail", it returned 0 even though the build did in fact not
succeed.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Display-a-help-message-when-building-Emacs-failed.patch --]
[-- Type: text/x-diff; name=Display-a-help-message-when-building-Emacs-failed.patch, Size: 2459 bytes --]
From 8cab514b4499b99f3c2ae07fa345b54c4ecc5823 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Sat, 17 Sep 2022 10:39:03 +0000
Subject: [PATCH] Display a help message when building Emacs failed.
* Makefile.in (actual-all): New target, replacing the former all target.
(advice-on-failure, sanity-check): New targets.
(all): Use the new targets.
---
Makefile.in | 42 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 3f811ea60f..2e518de348 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -366,7 +366,47 @@ ELN_DESTDIR =
gsettings_SCHEMAS = etc/org.gnu.emacs.defaults.gschema.xml
-all: ${SUBDIR} info $(gsettings_SCHEMAS:.xml=.valid) src-depending-on-lisp
+all:
+ $(MAKE) actual-all || $(MAKE) advice-on-failure exit-status=$$?
+ $(MAKE) sanity-check
+
+.PHONY: actual-all advice-on-failure sanity-check
+
+actual-all: ${SUBDIR} info $(gsettings_SCHEMAS:.xml=.valid) src-depending-on-lisp
+
+advice-on-failure:
+ @echo
+ @echo " Make failed with exit status ${exit-status}."
+ @cat Makefile | \
+ sed -n '/^# ADVICE-ON-FAILURE-BEGIN/,$${p;/^# ADVICE-ON-FAILURE-END/q};' | \
+ sed 's/^# //' | grep -v '^ADVICE-ON-FAILURE-'
+ @echo
+ @exit ${exit-status}
+
+# ADVICE-ON-FAILURE-BEGIN
+# You might consider to:
+# - run "make bootstrap", which might fix the problem
+# - run "git clean -fdx" and run "make" again, which might fix
+# the problem if it was not fixed by "make bootstrap"
+# !BEWARE! "git clean -fdx" restores the local repository in its
+# !BEWARE! pristine state, it deletes all local changes and all
+# !BEWARE! untracked files
+# - run "make V=1", which displays the full commandes invoked by
+# make, to further investigate the problem
+# ADVICE-ON-FAILURE-END
+
+sanity-check:
+ @v=$$(src/emacs${EXEEXT} --batch --eval \
+ '(progn (defun f (n) (if (= 0 n) 1 (* n (f (- n 1))))) (princ (f 10)))' \
+ 2> /dev/null); \
+ [ "X$$v" == "X3628800" ] && exit 0; \
+ echo; \
+ echo " Make succeeded, but Emacs is not functional."; \
+ cat Makefile | \
+ sed -n '/^# ADVICE-ON-FAILURE-BEGIN/,$${p;/^# ADVICE-ON-FAILURE-END/q};' | \
+ sed 's/^# //' | grep -v '^ADVICE-ON-FAILURE-'; \
+ echo; \
+ exit 1
.PHONY: all ${SUBDIR} blessmail epaths-force epaths-force-w32 epaths-force-ns-self-contained etc-emacsver
--
2.35.1
next prev parent reply other threads:[~2022-09-17 10:46 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 2:19 src/Makefile unhelpful Richard Stallman
2022-09-07 2:38 ` Po Lu
2022-09-07 2:41 ` Eli Zaretskii
2022-09-08 3:00 ` Richard Stallman
2022-09-08 4:51 ` Sam James
2022-09-11 3:38 ` Richard Stallman
2022-09-11 5:34 ` Eli Zaretskii
2022-09-11 9:57 ` Lars Ingebrigtsen
2022-09-11 11:59 ` Po Lu
2022-09-11 12:07 ` Eli Zaretskii
2022-09-11 12:16 ` Lars Ingebrigtsen
2022-09-13 4:07 ` Richard Stallman
2022-09-13 16:11 ` Eli Zaretskii
2022-09-14 20:02 ` Alfred M. Szmidt
2022-09-14 20:05 ` Lars Ingebrigtsen
2022-09-14 20:47 ` Gregory Heytings
2022-09-15 7:14 ` Lars Ingebrigtsen
2022-09-15 7:28 ` Gregory Heytings
2022-09-15 7:32 ` Eli Zaretskii
2022-09-15 7:41 ` Gregory Heytings
2022-09-15 9:07 ` Eli Zaretskii
2022-09-15 14:33 ` Óscar Fuentes
2022-09-15 16:04 ` Gregory Heytings
2022-09-17 10:46 ` Gregory Heytings [this message]
2022-09-17 11:20 ` Alan Mackenzie
2022-09-17 16:41 ` Michael Welsh Duggan
2022-09-17 22:59 ` Gregory Heytings
2022-09-17 22:58 ` Gregory Heytings
2022-09-18 10:37 ` Lars Ingebrigtsen
2022-09-18 11:38 ` Gerd Möllmann
2022-09-18 11:53 ` Andreas Schwab
2022-09-18 12:05 ` Gerd Möllmann
2022-09-18 13:48 ` Robert Pluim
2022-09-18 16:40 ` Gregory Heytings
2022-09-18 16:59 ` Andreas Schwab
2022-09-18 21:50 ` Gregory Heytings
2022-09-19 17:20 ` chad
2022-09-19 17:25 ` Eli Zaretskii
2022-09-19 20:42 ` Stefan Monnier
2022-09-18 21:39 ` Gregory Heytings
2022-09-15 13:13 ` Ken Brown
2022-09-15 14:01 ` Gregory Heytings
2022-09-11 15:16 ` Werner LEMBERG
2022-09-12 4:35 ` Richard Stallman
2022-09-08 6:14 ` Eli Zaretskii
2022-09-08 7:29 ` Andreas Schwab
2022-09-08 13:18 ` Stefan Monnier
2022-09-11 3:38 ` Richard Stallman
2022-09-11 5:42 ` Eli Zaretskii
2022-09-14 4:12 ` Richard Stallman
2022-09-14 11:33 ` Eli Zaretskii
2022-09-07 3:11 ` Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0b5f34d9bc43b17dd0df@heytings.org \
--to=gregory@heytings.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.