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