diff options
author | Gregory Heytings <gregory@heytings.org> | 2022-09-18 21:22:13 +0000 |
---|---|---|
committer | Gregory Heytings <gregory@heytings.org> | 2022-09-18 23:35:57 +0200 |
commit | 7c8a131984ab47349381975dead1712ae25ae2c6 (patch) | |
tree | ff30c0ed6f006503b6c2a740b4f9055ebb5aa666 /Makefile.in | |
parent | 1bdac41e4d9bbc23b654b90d593a8a3588052868 (diff) | |
download | emacs-7c8a131984ab47349381975dead1712ae25ae2c6.tar.gz |
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.
(bootstrap-all): New target, identical to 'all' but meant for the
'bootstrap' target in GNUmakefile.
(actual-bootstrap): New target, replacing the former 'bootstrap'
target. Use the 'actual-all' target instead of the 'all' target.
(bootstrap): Use the new targets.
* GNUmakefile (bootstrap): Use the new 'bootstrap-all' target.
Diffstat (limited to 'Makefile.in')
-rw-r--r-- | Makefile.in | 63 |
1 files changed, 59 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in index 3f811ea60fd..de263c6858b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -366,7 +366,58 @@ endif 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 make-target=all exit-status=$$? + $(MAKE) sanity-check make-target=all + +# This target is used by the 'bootstrap' target in GNUmakefile, instead of 'all'. +bootstrap-all: + $(MAKE) actual-all || $(MAKE) advice-on-failure make-target=bootstrap exit-status=$$? + $(MAKE) sanity-check make-target=bootstrap + +.PHONY: bootstrap-all actual-all advice-on-failure sanity-check + +actual-all: ${SUBDIR} info $(gsettings_SCHEMAS:.xml=.valid) src-depending-on-lisp + +# ADVICE-ON-FAILURE-BEGIN:all +# You might try to: +# - run "make bootstrap", which might fix the problem +# - run "make V=1", which displays the full commands invoked by make, +# to further investigate the problem +# ADVICE-ON-FAILURE-END:all + +# ADVICE-ON-FAILURE-BEGIN:bootstrap +# You might try to: +# - run "git clean -fdx" and run "make bootstrap" again, which might +# fix the problem +# !BEWARE! "git clean -fdx" deletes all files that are not under +# !BEWARE! version control, which means that all changes to such +# !BEWARE! files will be lost and cannot be restored later +# - run "make V=1", which displays the full commands invoked by make, +# to further investigate the problem +# ADVICE-ON-FAILURE-END:bootstrap + +advice-on-failure: + @echo + @echo " \"make ${make-target}\" failed with exit status ${exit-status}." + @cat Makefile | \ + sed -n '/^# ADVICE-ON-FAILURE-BEGIN:${make-target}/,$${p;/^# ADVICE-ON-FAILURE-END:${make-target}/q};' | \ + sed 's/^# //' | grep -v '^ADVICE-ON-FAILURE-' + @echo + @exit ${exit-status} + +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 ${make-target}\" succeeded, but Emacs is not functional."; \ + cat Makefile | \ + sed -n '/^# ADVICE-ON-FAILURE-BEGIN:${make-target}/,$${p;/^# ADVICE-ON-FAILURE-END:${make-target}/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 @@ -1170,7 +1221,11 @@ check-info: info ### This first cleans the lisp subdirectory, removing all compiled ### Lisp files. Then re-run make to build all the files anew. -.PHONY: bootstrap +.PHONY: bootstrap actual-bootstrap + +bootstrap: + $(MAKE) actual-bootstrap || $(MAKE) advice-on-failure make-target=bootstrap exit-status=$$? + $(MAKE) sanity-check make-target=bootstrap # Without a 'configure' variable, bootstrapping does the following: # * Remove files to start from a bootstrap-clean slate. @@ -1181,7 +1236,7 @@ check-info: info # * Remove files to start from an extraclean slate. # * Do the actual build, during which the 'configure' variable is # used (see the Makefile goal in GNUmakefile). -bootstrap: +actual-bootstrap: ifndef configure $(MAKE) bootstrap-clean cd $(srcdir) && ./autogen.sh autoconf @@ -1189,7 +1244,7 @@ ifndef configure else $(MAKE) extraclean endif - $(MAKE) all + $(MAKE) actual-all .PHONY: ChangeLog change-history change-history-commit change-history-nocommit .PHONY: preferred-branch-is-current unchanged-history-files |