1 ;;; liece-make.el --- Generic make procedures.
2 ;; Copyright (C) 1998-2000 Daiki Ueno
4 ;; Author: Daiki Ueno <ueno@unixuser.org>
7 ;; Keywords: IRC, liece, APEL
9 ;; This file is part of Liece.
11 ;; This program 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 2, or (at your option)
16 ;; This program 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 GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
34 (defun install-just-print-p ()
35 (let ((flag (getenv "MAKEFLAGS"))
37 (princ (format "%s\n" flag))
39 (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag))))
41 (defun config-liece ()
42 (let (prefix exec-prefix lisp-dir version-specific-lisp-dir)
43 (and (setq prefix (car command-line-args-left))
44 (or (string-equal "NONE" prefix)
45 (setq PREFIX prefix)))
46 (setq command-line-args-left (cdr command-line-args-left))
47 (and (setq lisp-dir (car command-line-args-left))
48 (or (string-equal "NONE" lisp-dir)
49 (setq LISPDIR lisp-dir)))
50 (setq command-line-args-left (cdr command-line-args-left))
51 (and (setq version-specific-lisp-dir (car command-line-args-left))
52 (or (string-equal "NONE" version-specific-lisp-dir)
54 (defvar VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir)
55 (princ (format "VERSION_SPECIFIC_LISPDIR=%s\n"
56 VERSION_SPECIFIC_LISPDIR)))))
57 (setq command-line-args-left (cdr command-line-args-left))
58 (setq load-path (cons (expand-file-name ".") load-path))
60 (or (boundp 'liece-modules-to-compile)
61 (load "liece-modules"))
62 (princ (format "PREFIX=%s\tLISPDIR=%s\n" PREFIX LISPDIR))))
64 (defun compile-liece ()
65 ;;(setq byte-compile-dynamic t)
67 (compile-elisp-modules liece-modules-to-compile "."))
69 (defun install-liece ()
71 (let ((just-print (install-just-print-p))
72 (dir (expand-file-name "liece" LISPDIR)))
73 (princ (format "%s\n" emacs-version))
74 (install-elisp-modules liece-modules "." dir just-print)))
76 (defun install-update-manifest-file (package dir &optional just-print)
77 (message "Generating MANIFEST.%s for the package..." package)
80 (insert "pkginfo/MANIFEST." package "\n"
84 (mapcar (lambda (symbol)
85 (format "%s.el\nlisp/%s/%s.elc"
86 symbol package symbol))
87 liece-modules-to-compile)
89 (concat "\nlisp/" package "/"))
91 (when (file-directory-p "../doc")
96 "../doc" nil liece-config-info-file-regexp)
100 (let ((dirs '("icons" "po" "styles")))
102 (when (file-directory-p (concat "../etc/" dir))
103 (insert "etc/" package "/" dir "/"
104 (mapconcat #'identity
105 (sort (directory-files (concat "../etc/" dir)
108 (concat "\netc/" package "/" dir "/"))
110 (write-file (expand-file-name (concat "MANIFEST." package) dir)))))
112 (defun install-update-package-files (package dir &optional just-print)
114 (princ (format "Updating autoloads in directory %s..\n\n" dir))
116 (princ (format "Processing %s\n" dir))
117 (princ "Generating custom-load.el...\n\n")
119 (princ (format "Compiling %s...\n"
120 (expand-file-name "auto-autoloads.el" dir)))
121 (princ (format "Wrote %s\n"
122 (expand-file-name "auto-autoloads.elc" dir)))
124 (princ (format "Compiling %s...\n"
125 (expand-file-name "custom-load.el" dir)))
126 (princ (format "Wrote %s\n"
127 (expand-file-name "custom-load.elc" dir))))
129 (if (fboundp 'batch-update-directory-autoloads)
131 (setq command-line-args-left
132 (cons package (cons dir command-line-args-left)))
133 (batch-update-directory-autoloads))
134 (setq autoload-package-name package)
135 (add-to-list 'command-line-args-left dir)
136 (batch-update-directory))
138 (add-to-list 'command-line-args-left dir)
139 (Custom-make-dependencies)
141 (byte-compile-file (expand-file-name "auto-autoloads.el" dir))
142 (byte-compile-file (expand-file-name "custom-load.el" dir)))))
144 (defun config-liece-package-directory ()
145 (if (boundp 'early-packages)
146 (let ((dirs (append (if early-package-load-path
148 (if late-package-load-path
150 (if last-package-load-path
153 (while (and dirs (not (file-exists-p
154 (setq dir (car dirs)))))
155 (setq dirs (cdr dirs)))
156 (defvar PACKAGEDIR dir)
157 (princ (format "PACKAGEDIR=%s\n" PACKAGEDIR)))))
159 (defun config-liece-package ()
161 (and (setq package-dir (car command-line-args-left))
162 (or (string= "NONE" package-dir)
163 (defvar PACKAGEDIR package-dir)))
165 (config-liece-package-directory)
166 (setq command-line-args-left (cdr command-line-args-left))))
168 (defun compile-liece-package ()
169 (config-liece-package)
170 (compile-elisp-modules liece-modules-to-compile "."))
172 (defun install-liece-package ()
173 (config-liece-package)
174 (let ((just-print (install-just-print-p))
175 (dir (expand-file-name "lisp/liece" PACKAGEDIR))
176 (pkginfo-dir (expand-file-name "pkginfo" PACKAGEDIR)))
177 (install-elisp-modules liece-modules "." dir just-print)
178 (install-update-package-files "liece" dir just-print)
179 (install-update-manifest-file "liece" pkginfo-dir just-print)))
181 (defun autoload-liece ()
184 (let* ((generated-autoload-file "liece-setup.el")
185 (generate-autoload-cookie ";;;###liece-autoload")
186 (buf (find-file-noselect generated-autoload-file))
189 (delete-region (point-min) (point-max))
191 (format "(if (not (featurep '%s)) (progn\n"
192 (file-name-sans-extension generated-autoload-file)))
196 (generate-file-autoloads
197 (concat (symbol-name file) ".el"))))
198 liece-modules-to-compile)
199 (goto-char (point-max))
201 (format "(provide '%s)))\n"
202 (file-name-sans-extension generated-autoload-file)))
205 (provide 'liece-make)
207 ;;; liece-make.el ends here