summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/comp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r--lisp/emacs-lisp/comp.el25
1 files changed, 16 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 7c93ebd6300..83605ca5a77 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -4191,20 +4191,27 @@ form, return the compiled function."
(comp--native-compile function-or-file nil output))
;;;###autoload
-(defun batch-native-compile ()
+(defun batch-native-compile (&optional for-tarball)
"Perform batch native compilation of remaining command-line arguments.
Native compilation equivalent of `batch-byte-compile'.
Use this from the command line, with ‘-batch’; it won’t work
-in an interactive Emacs session."
+in an interactive Emacs session.
+Optional argument FOR-TARBALL non-nil means the file being compiled
+as part of building the source tarball, in which case the .eln file
+will be placed under the native-lisp/ directory (actually, in the
+last directory in `native-comp-eln-load-path')."
(comp-ensure-native-compiler)
- (cl-loop for file in command-line-args-left
- if (or (null byte+native-compile)
- (cl-notany (lambda (re) (string-match re file))
- native-comp-bootstrap-deny-list))
- do (comp--native-compile file)
- else
- do (byte-compile-file file)))
+ (let ((native-compile-target-directory
+ (if for-tarball
+ (car (last native-comp-eln-load-path)))))
+ (cl-loop for file in command-line-args-left
+ if (or (null byte+native-compile)
+ (cl-notany (lambda (re) (string-match re file))
+ native-comp-bootstrap-deny-list))
+ do (comp--native-compile file)
+ else
+ do (byte-compile-file file))))
;;;###autoload
(defun batch-byte+native-compile ()