* mixi-el: Version 1.4.1 released.
[elisp/mixi.git] / COMPILE.in
1 ;;; -*- Emacs-Lisp -*-
2
3 (defvar mixi-modules
4   '(@MODULES@))
5
6 (defun mixi-compile-modules (modules)
7   (let ((load-path (cons nil load-path))
8         error-modules)
9     (while modules
10       (let ((source (expand-file-name
11                      (symbol-name (car modules)))))
12         (if (file-newer-than-file-p source (concat source "c"))
13             (condition-case error
14                 (byte-compile-file source)
15               (error
16                (setq error-modules (cons (car modules) error-modules))))))
17       (setq modules (cdr modules)))
18     (if error-modules
19         (princ (concat "\n\
20   WARNING: ---------------------------------------------------------
21   WARNING: Couldn't compile following modules:
22   WARNING: 
23   WARNING:   " (mapconcat #'symbol-name error-modules ", ") "\n\
24   WARNING: 
25   WARNING: You should probably stop here, try \"make distclean\" to clear
26   WARNING: the last build, and then reconfigure.
27   WARNING: ---------------------------------------------------------\n\n")))))
28
29 (defun mixi-compile-module ()
30   (let ((load-path (cons nil load-path)))
31     (let ((source (expand-file-name
32                    (car command-line-args-left))))
33       (if (file-newer-than-file-p source (concat source "c"))
34           (byte-compile-file source)))))
35
36 (defun mixi-install-modules (modules dest just-print)
37   (unless (or just-print (file-exists-p dest))
38     (make-directory dest t))
39   (while modules
40     (let ((name (symbol-name (car modules))))
41       (princ (format "%s -> %s\n" name dest))
42       (unless just-print
43         (copy-file (expand-file-name name)
44                    (expand-file-name name dest)
45                    t t))
46       (princ (format "%sc -> %s\n" name dest))
47       (unless just-print
48         (if (file-exists-p (expand-file-name (concat name "c")))
49             (copy-file (expand-file-name (concat name "c"))
50                        (expand-file-name (concat name "c") dest)
51                        t t)
52           (princ (format "(%s was not successfully compiled, ignored)\n"
53                          name)))))
54     (setq modules (cdr modules))))
55
56 (defun mixi-install-just-print-p ()
57   (let ((flag (getenv "MAKEFLAGS"))
58         case-fold-search)
59     (if flag
60         (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag))))
61
62 (defun mixi-examine ()
63   (princ (mapconcat #'symbol-name mixi-modules " ")))
64
65 (defun mixi-compile ()
66   (mixi-compile-modules mixi-modules))
67
68 (defun mixi-install ()
69   (mixi-install-modules
70    mixi-modules
71    (expand-file-name "mixi" (car command-line-args-left))
72    (mixi-install-just-print-p)))
73
74 (defun mixi-compile-package ()
75   (setq autoload-package-name "mixi")
76   (add-to-list 'command-line-args-left ".")
77   (batch-update-directory)
78   (add-to-list 'command-line-args-left ".")
79   (Custom-make-dependencies)
80   (mixi-compile-modules
81    (append mixi-modules
82            '(auto-autoloads.el custom-load.el))))
83
84 (defun mixi-install-package ()
85   (mixi-install-modules
86    (append mixi-modules
87            '(auto-autoloads.el custom-load.el))
88    (expand-file-name "lisp/mixi" (car command-line-args-left))
89    (mixi-install-just-print-p)))