1 ;;; compile-core.el --- Bytecompile out-of-date dumped files
3 ;; Copyright (C) 2006 Sebastian Freundt
5 ;; Author: Sebastian Freundt <hroptatyr@sxemacs.org>
6 ;; Maintainer: SXEmacs Development Team
9 ;; This file is part of SXEmacs.
11 ;; SXEmacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; SXEmacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
24 ;;; Synched up with: Not in FSF.
31 (load "auto-autoloads.el")
32 (load "custom-defines.el")
34 (load "byte-optimize.el")
35 (when (featurep '(and mule (not mule-autoloads)))
36 (load-file "mule/auto-autoloads.el")
37 (load-file "mule/custom-defines.el"))
38 (when (and (fboundp #'ffi-defun)
39 (not (featurep 'ffi-autoloads)))
40 (load-file "ffi/auto-autoloads.el")
41 (load-file "ffi/custom-defines.el"))
43 (princ "Compiling core lisp files...")
48 (file-name-directory (locate-file "compile-core.el" load-path)))
49 (defvar lispdir-regexp
50 (compile-regexp "lisp/"))
52 (defun byte-compile-dest-file (filename)
53 "Convert an Emacs Lisp source file name to a compiled file name."
54 (let ((outfile (if (string-match lispdir-regexp filename)
55 (file-name-sans-extension
56 (substring filename (match-end 0)))
58 (expand-file-name (concat outfile ".elc") destdir)))
60 (defun parse-command-line (cmdl)
61 (let ((newcmdl (dllist))
62 (cmdlpl (make-skiplist))
63 (mm (compile-regexp "^--"))
64 (ign (compile-regexp "^-[^-]")))
66 (let* ((file (car cmdl))
67 (current (expand-file-name file sourcedir))
68 (current (if (file-exists-p current)
70 (expand-file-name file destdir))))
71 (cond ((string-match mm file)
72 (let ((key (intern file))
73 (val (car (cdr-safe cmdl))))
74 (put-skiplist cmdlpl key val)
75 (setq cmdl (cdr-safe cmdl))))
76 ((string-match ign file)
77 (setq cmdl (cdr-safe cmdl)))
78 ((string-match emacs-lisp-file-regexp current)
79 (dllist-append newcmdl current))
81 (setq cmdl (cdr-safe cmdl)))
82 (put newcmdl :tweaks cmdlpl)
85 (setq files (parse-command-line (cdr-safe command-line-args)))
86 (setq params (get files :tweaks))
88 (setq files-to-compile (dllist))
89 (if (get-skiplist params '--force)
90 (setq files-to-compile files)
93 (when (file-newer-than-file-p file (byte-compile-dest-file file))
94 (dllist-append files-to-compile file)))
97 (setq problem-files (dllist))
101 (byte-compile-file file)
104 (dllist-append problem-files file)
105 (message "Dinn work: %s" file)))))
110 ;; (condition-case nil
111 ;; (byte-compile-file file)
114 ;; (dllist-append problem-files file)
115 ;; (message "Dinn work: %s" file)))))
118 ;;; compile-core.el ends here