unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: 53024@debbugs.gnu.org
Cc: monnier@iro.umontreal.ca
Subject: bug#53024: 29.0.50; Wishlist: Byte-compile loaddefs.el?
Date: Sun, 31 Jul 2022 18:35:32 +0200	[thread overview]
Message-ID: <87a68p2qaz.fsf@gnus.org> (raw)
In-Reply-To: <87k07t36e8.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 31 Jul 2022 12:47:59 +0200")

With the following, Emacs builds successfully.  The problem is that we
need to generate the loaddefs files before compile-main (so that it
picks up the .el files for compilation), but we do this after we've
built Emacs, so a change that updates loaddefs.el will first compile the
.elc file, and then the next "make" will rebuild src/emacs, which is
backwards.

But I'm unable to follow the logic completely in the relevant Makefiles.
I've tried a number of things here, but I seem to be unable to make the
src/Makefile depend on the lisp/loaddefs.elc file in any sensible way --
I either end up with generating the .elc file twice or none at all,
which is frustrating.

diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 9516f2fc36..8f08195df8 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -196,13 +196,16 @@ org-manuals:
 # from ../src rules, but that doesn't seem possible due to the various
 # non-trivial dependencies.
 
-# We make $(lisp)/loaddefs.el a dependency of .PHONY to cause Make to
+# We make autoloads a dependency of .PHONY to cause Make to
 # ignore its time stamp.  That's because the real dependencies of
 # loaddefs.el aren't known to Make, they are implemented in
 # loaddefs-generate--emacs-batch.
+autoloads .PHONY:
+	$(AM_V_GEN)$(emacs) \
+            -l $(lisp)/emacs-lisp/loaddefs-gen.elc \
+	    -f loaddefs-generate--emacs-batch ${SUBDIRS_ALMOST}
 
-autoloads .PHONY: $(lisp)/loaddefs.el
-$(lisp)/loaddefs.el: gen-lisp $(LOADDEFS) $(lisp)/emacs-lisp/loaddefs-gen.elc
+$(lisp)/loaddefs.el: $(LOADDEFS) $(lisp)/emacs-lisp/loaddefs-gen.elc
 	$(AM_V_GEN)$(emacs) \
             -l $(lisp)/emacs-lisp/loaddefs-gen.elc \
 	    -f loaddefs-generate--emacs-batch ${SUBDIRS_ALMOST}
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 261e44aece..830799ec36 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -459,7 +459,7 @@ loaddefs-generate--compute-prefixes
             (push name prefs)))))
     (loaddefs-generate--make-prefixes prefs load-name)))
 
-(defun loaddefs-generate--rubric (file &optional type feature)
+(defun loaddefs-generate--rubric (file &optional type feature compile)
   "Return a string giving the appropriate autoload rubric for FILE.
 TYPE (default \"autoloads\") is a string stating the type of
 information contained in FILE.  TYPE \"package\" acts like the default,
@@ -467,7 +467,9 @@ loaddefs-generate--rubric
 
 If FEATURE is non-nil, FILE will provide a feature.  FEATURE may
 be a string naming the feature, otherwise it will be based on
-FILE's name."
+FILE's name.
+
+If COMPILE, don't include a \"don't compile\" cookie."
   (let ((lp (and (equal type "package") (setq type "autoloads"))))
     (with-temp-buffer
       (generate-lisp-file-heading
@@ -481,6 +483,7 @@ loaddefs-generate--rubric
       (insert "\f\n;;; End of scraped data\n\n")
       (generate-lisp-file-trailer
        file :provide (and (stringp feature) feature)
+       :compile compile
        :inhibit-provide (not feature))
       (buffer-string))))
 
@@ -585,7 +588,8 @@ loaddefs-generate
           (with-temp-buffer
             (if (and updating (file-exists-p loaddefs-file))
                 (insert-file-contents loaddefs-file)
-              (insert (loaddefs-generate--rubric loaddefs-file nil t))
+              (insert (loaddefs-generate--rubric
+                       loaddefs-file nil t include-package-version))
               (search-backward "\f")
               (when extra-data
                 (insert extra-data)
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 21a87dbd77..a65c1724ae 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -185,9 +185,10 @@
 ;; should be updated by overwriting it with an up-to-date copy of
 ;; loaddefs.el that is not corrupted by local changes.
 ;; admin/update_autogen can be used to update ldefs-boot.el periodically.
-(condition-case nil (load "loaddefs.el")
-  ;; In case loaddefs hasn't been generated yet.
-  (file-error (load "ldefs-boot.el")))
+(condition-case nil
+    (load "loaddefs")
+  (file-error
+   (load "ldefs-boot.el")))
 
 (let ((new (make-hash-table :test #'equal)))
   ;; Now that loaddefs has populated definition-prefixes, purify its contents.
diff --git a/src/Makefile.in b/src/Makefile.in
index 7d15b7afd5..feb809ea10 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -652,13 +652,11 @@ $(pdmp):
 ## for the first time, this prevents any variation between configurations
 ## in the contents of the DOC file.
 ##
-$(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(doc_obj) $(lispsource)/loaddefs.el
+$(etc)/DOC: $(libsrc)/make-docfile$(EXEEXT) $(doc_obj)
 	$(AM_V_GEN)$(MKDIR_P) $(etc)
 	$(AM_V_at)rm -f $(etc)/DOC
 	$(AM_V_at)$(libsrc)/make-docfile -d $(srcdir) \
 	  $(SOME_MACHINE_OBJECTS) $(doc_obj) > $(etc)/DOC
-	$(AM_V_at)$(libsrc)/make-docfile -a $(etc)/DOC -d $(lispsource) \
-	  loaddefs.el
 
 $(libsrc)/make-docfile$(EXEEXT) $(libsrc)/make-fingerprint$(EXEEXT): \
   $(lib)/libgnu.a





  reply	other threads:[~2022-07-31 16:35 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 15:53 bug#53024: 29.0.50; Wishlist: Byte-compile loaddefs.el? Lars Ingebrigtsen
2022-01-22 12:27 ` Lars Ingebrigtsen
2022-07-31 10:02   ` Lars Ingebrigtsen
2022-07-31 10:19     ` Lars Ingebrigtsen
2022-07-31 10:47       ` Lars Ingebrigtsen
2022-07-31 16:35         ` Lars Ingebrigtsen [this message]
2022-07-31 17:06           ` Andreas Schwab
2022-08-01 12:33             ` Lars Ingebrigtsen
2022-08-01 13:06               ` Eli Zaretskii
2022-08-02  9:52                 ` Lars Ingebrigtsen
2022-08-02 11:17                   ` Eli Zaretskii
2022-08-02 11:19                     ` Lars Ingebrigtsen
2022-08-03 12:24   ` Lars Ingebrigtsen
2022-08-03 12:41     ` Lars Ingebrigtsen
2022-08-04  6:07       ` Lars Ingebrigtsen
2022-08-04 21:45         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-05 11:46           ` Lars Ingebrigtsen
2022-08-05 12:18             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-05 12:22               ` Lars Ingebrigtsen
2022-08-05 13:44                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-08-06 12:10                   ` Lars Ingebrigtsen
2022-08-04 16:31     ` Andreas Schwab
2022-08-04 16:37       ` Lars Ingebrigtsen
2022-08-04 17:10       ` Eli Zaretskii
2022-08-04 17:14         ` Lars Ingebrigtsen
2022-08-04 17:22           ` Eli Zaretskii
2022-08-05 11:44             ` Lars Ingebrigtsen
2022-08-05 12:57               ` Eli Zaretskii
2022-08-06 12:09                 ` Lars Ingebrigtsen
2022-08-06 12:16                   ` Eli Zaretskii
2022-08-06 12:20                     ` Lars Ingebrigtsen
2022-08-04 18:08           ` Andreas Schwab
2022-08-04 18:11             ` Lars Ingebrigtsen
2022-08-04 19:15               ` Andreas Schwab
2022-08-04 19:20                 ` Lars Ingebrigtsen
2022-08-04 20:17                   ` Andreas Schwab
2022-08-04 20:31                     ` Lars Ingebrigtsen
2022-08-04 20:57                       ` Lars Ingebrigtsen
2022-08-05  5:44                   ` Eli Zaretskii
2022-08-05 11:51                     ` Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a68p2qaz.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=53024@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).