;;; -*- Emacs-Lisp -*- (defun mixi-compile-modules (modules) (let ((load-path (cons nil load-path)) error-modules) (while modules (let ((source (expand-file-name (car modules)))) (if (file-newer-than-file-p source (concat source "c")) (condition-case error (byte-compile-file source) (error (setq error-modules (cons (car modules) error-modules)))))) (setq modules (cdr modules))) (if error-modules (princ (concat "\n\ WARNING: --------------------------------------------------------- WARNING: Couldn't compile following modules: WARNING: WARNING: " (mapconcat #'identity error-modules ", ") "\n\ WARNING: WARNING: You should probably stop here, try \"make distclean\" to clear WARNING: the last build, and then reconfigure. WARNING: ---------------------------------------------------------\n\n"))))) (defun mixi-install-modules (modules dest just-print) (unless (or just-print (file-exists-p dest)) (make-directory dest t)) (while modules (let ((name (car modules))) (princ (format "%s -> %s\n" name dest)) (unless just-print (copy-file (expand-file-name name) (expand-file-name name dest) t t)) (princ (format "%sc -> %s\n" name dest)) (unless just-print (if (file-exists-p (expand-file-name (concat name "c"))) (copy-file (expand-file-name (concat name "c")) (expand-file-name (concat name "c") dest) t t) (princ (format "(%s was not successfully compiled, ignored)\n" name))))) (setq modules (cdr modules)))) (defun mixi-install-just-print-p () (let ((flag (getenv "MAKEFLAGS")) case-fold-search) (if flag (string-match "^\\(\\(--[^ ]+ \\)+-\\|[^ =-]\\)*n" flag)))) (defun mixi-compile () (mixi-compile-modules command-line-args-left)) (defun mixi-install () (mixi-install-modules (cdr command-line-args-left) (expand-file-name "mixi" (car command-line-args-left)) (mixi-install-just-print-p))) (defun mixi-compile-package () (let ((modules (cdr command-line-args-left)) command-line-args-left) (setq autoload-package-name "mixi") (add-to-list 'command-line-args-left ".") (batch-update-directory) (add-to-list 'command-line-args-left ".") (Custom-make-dependencies) (mixi-compile-modules (append modules '("auto-autoloads.el" "custom-load.el"))))) (defun mixi-install-package () (mixi-install-modules (append (cdr command-line-args-left) '("auto-autoloads.el" "custom-load.el")) (expand-file-name "lisp/mixi" (car command-line-args-left)) (mixi-install-just-print-p)))