1#!/bin/sh 2# Copyright (C) 1995-2012 Free Software Foundation, Inc. 3 4scriptversion=2010-02-06.18; # UTC 5 6# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1995. 7# 8# This program is free software; you can redistribute it and/or modify 9# it under the terms of the GNU General Public License as published by 10# the Free Software Foundation; either version 2, or (at your option) 11# any later version. 12# 13# This program is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17# 18# You should have received a copy of the GNU General Public License 19# along with this program. If not, see <http://www.gnu.org/licenses/>. 20 21# As a special exception to the GNU General Public License, if you 22# distribute this file as part of a program that contains a 23# configuration script generated by Autoconf, you may include it under 24# the same distribution terms that you use for the rest of that program. 25 26# This file is maintained in Automake, please report 27# bugs to <bug-automake@gnu.org> or send patches to 28# <automake-patches@gnu.org>. 29 30case $1 in 31 '') 32 echo "$0: No files. Try '$0 --help' for more information." 1>&2 33 exit 1; 34 ;; 35 -h | --h*) 36 cat <<\EOF 37Usage: elisp-comp [--help] [--version] FILES... 38 39This script byte-compiles all '.el' files listed as FILES using GNU 40Emacs, and put the resulting '.elc' files into the current directory, 41so disregarding the original directories used in '.el' arguments. 42 43This script manages in such a way that all Emacs LISP files to 44be compiled are made visible between themselves, in the event 45they require or load-library one another. 46 47Report bugs to <bug-automake@gnu.org>. 48EOF 49 exit $? 50 ;; 51 -v | --v*) 52 echo "elisp-comp $scriptversion" 53 exit $? 54 ;; 55esac 56 57if test -z "$EMACS" || test "$EMACS" = "t"; then 58 # Value of "t" means we are running in a shell under Emacs. 59 # Just assume Emacs is called "emacs". 60 EMACS=emacs 61fi 62 63tempdir=elc.$$ 64 65# Cleanup the temporary directory on exit. 66trap 'ret=$?; rm -rf "$tempdir" && exit $ret' 0 67do_exit='(exit $ret); exit $ret' 68trap "ret=129; $do_exit" 1 69trap "ret=130; $do_exit" 2 70trap "ret=141; $do_exit" 13 71trap "ret=143; $do_exit" 15 72 73mkdir $tempdir 74cp "$@" $tempdir 75 76( 77 cd $tempdir 78 echo "(setq load-path (cons nil load-path))" > script 79 $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $? 80 mv *.elc .. 81) || exit $? 82 83(exit 0); exit 0 84 85# Local Variables: 86# mode: shell-script 87# sh-indentation: 2 88# eval: (add-hook 'write-file-hooks 'time-stamp) 89# time-stamp-start: "scriptversion=" 90# time-stamp-format: "%:y-%02m-%02d.%02H" 91# time-stamp-time-zone: "UTC" 92# time-stamp-end: "; # UTC" 93# End: 94