elisp-comp 2.6 KB

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