Merge apel-mcs-2-9_12_2.
[elisp/apel.git] / APEL-MK
1 ;;; -*-Emacs-Lisp-*-
2
3 ;; APEL-MK: installer for APEL.
4
5 ;;; Code:
6
7 (defun install-just-print-p ()
8   (let ((flag (getenv "MAKEFLAGS"))
9         case-fold-search)
10     (princ (format "%s\n" flag))
11     (if flag
12         (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag)
13       )))
14
15 (defun config-apel ()
16   (let (prefix lisp-dir version-specific-lisp-dir)
17     (and (setq prefix (car command-line-args-left))
18          (or (string-equal "NONE" prefix)
19              (defvar PREFIX prefix)
20              ))
21     (setq command-line-args-left (cdr command-line-args-left))
22     (and (setq lisp-dir (car command-line-args-left))
23          (or (string-equal "NONE" lisp-dir)
24              (defvar LISPDIR lisp-dir)
25              ))
26     (setq command-line-args-left (cdr command-line-args-left))
27     (and (setq version-specific-lisp-dir (car command-line-args-left))
28          (or (string-equal "NONE" version-specific-lisp-dir)
29              (progn
30                (defvar VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir)
31                (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n"
32                               VERSION_SPECIFIC_LISPDIR)))
33              ))
34     (setq command-line-args-left (cdr command-line-args-left))
35     (load-file "APEL-CFG")
36     (or (boundp 'apel-modules)
37         (load-file "APEL-ELS")
38         )
39     (princ (format "PREFIX=%s\n" PREFIX))
40     ))
41
42 (defun compile-apel ()
43   (config-apel)
44   (load "EMU-ELS")
45   (load-file "APEL-ELS")
46   (compile-elisp-modules emu-modules    ".")
47   (compile-elisp-modules apel-modules   ".")
48   )
49
50 (defun install-apel ()
51   (compile-apel)
52   (let ((just-print (install-just-print-p)))
53     (install-elisp-modules emu-modules  "." EMU_DIR     just-print)
54     (install-elisp-modules apel-modules "." APEL_DIR    just-print)
55     ))
56
57 (defun config-apel-package ()
58   (let (package-dir)
59     (and (setq package-dir (car command-line-args-left))
60          (or (string= "NONE" package-dir)
61              (defvar PACKAGEDIR package-dir)
62              ))
63     (setq command-line-args-left (cdr command-line-args-left))
64     (load-file "APEL-CFG")
65     (load-file "APEL-ELS")
66                                           
67     (princ (format "PACKAGEDIR=%s\n" PACKAGEDIR))
68     ))
69
70 (defun install-apel-package ()
71   (config-apel-package)
72   (load "EMU-ELS")
73   
74   (let ((just-print (install-just-print-p)))
75     (compile-elisp-modules emu-modules  ".")
76     (compile-elisp-modules apel-modules ".")
77     
78     (let ((dir (expand-file-name APEL_PREFIX
79                                  (expand-file-name "lisp"
80                                                    PACKAGEDIR))))
81       (install-elisp-modules emu-modules        "." dir just-print)
82       (install-elisp-modules apel-modules       "." dir just-print)
83     
84       (if just-print
85           (progn
86             (princ (format "Updating autoloads in directory %s..\n\n" dir))
87             
88             (princ (format "Processing %s\n" dir))
89             (princ "Generating custom-load.el...\n\n")
90             
91             (princ (format "Compiling %s...\n"
92                            (expand-file-name "auto-autoloads.el" dir)))
93             (princ (format "Wrote %s\n"
94                            (expand-file-name "auto-autoloads.elc" dir)))
95             
96             (princ (format "Compiling %s...\n"
97                            (expand-file-name "custom-load.el" dir)))
98             (princ (format "Wrote %s\n"
99                            (expand-file-name "custom-load.elc" dir)))
100             )
101         (setq autoload-package-name "apel")
102         (add-to-list 'command-line-args-left dir)
103         (batch-update-directory)
104         
105         (add-to-list 'command-line-args-left dir)
106         (Custom-make-dependencies)
107         
108         (byte-compile-file (expand-file-name "auto-autoloads.el" dir))
109         (byte-compile-file (expand-file-name "custom-load.el" dir))
110         )
111       )))
112
113 (defun what-where-apel ()
114   (config-apel)
115   (load "EMU-ELS")
116   (princ (format "
117 The files that belong to the EMU modules:
118   %s
119   -> %s
120
121 The files that belong to the APEL modules:
122   %s
123   -> %s
124 "
125                  (mapconcat 'symbol-name emu-modules ", ")
126                  EMU_DIR
127                  (mapconcat 'symbol-name apel-modules ", ")
128                  APEL_DIR)))
129
130 ;;; APEL-MK ends here