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 (setq autoload-package-name package)
130 (add-to-list 'command-line-args-left dir)
131 (batch-update-directory)
133 (add-to-list 'command-line-args-left dir)
134 (Custom-make-dependencies)
136 (byte-compile-file (expand-file-name "auto-autoloads.el" dir))
137 (byte-compile-file (expand-file-name "custom-load.el" dir)))))
139 (defun config-liece-package-directory ()
140 (if (boundp 'early-packages)
141 (let ((dirs (append (if early-package-load-path
143 (if late-package-load-path
145 (if last-package-load-path
148 (while (not (file-exists-p
149 (setq dir (car dirs))))
150 (setq dirs (cdr dirs)))
151 (defvar PACKAGEDIR dir)
152 (princ (format "PACKAGEDIR=%s\n" PACKAGEDIR)))))
154 (defun config-liece-package ()
156 (and (setq package-dir (car command-line-args-left))
157 (or (string= "NONE" package-dir)
158 (defvar PACKAGEDIR package-dir)))
160 (config-liece-package-directory)
161 (setq command-line-args-left (cdr command-line-args-left))))
163 (defun compile-liece-package ()
164 (config-liece-package)
165 (compile-elisp-modules liece-modules-to-compile "."))
167 (defun install-liece-package ()
168 (config-liece-package)
169 (let ((just-print (install-just-print-p))
170 (dir (expand-file-name "lisp/liece" PACKAGEDIR))
171 (pkginfo-dir (expand-file-name "pkginfo" PACKAGEDIR)))
172 (install-elisp-modules liece-modules "." dir just-print)
173 (install-update-package-files "liece" dir just-print)
174 (install-update-manifest-file "liece" pkginfo-dir just-print)))
176 (defun autoload-liece ()
179 (let* ((generated-autoload-file "liece-setup.el")
180 (generate-autoload-cookie ";;;###liece-autoload")
181 (buf (find-file-noselect generated-autoload-file))
184 (delete-region (point-min) (point-max))
186 (format "(if (not (featurep '%s)) (progn\n"
187 (file-name-sans-extension generated-autoload-file)))
191 (generate-file-autoloads
192 (concat (symbol-name file) ".el"))))
193 liece-modules-to-compile)
194 (goto-char (point-max))
196 (format "(provide '%s)))\n"
197 (file-name-sans-extension generated-autoload-file)))
200 (provide 'liece-make)
202 ;;; liece-make.el ends here