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