[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: byte-compile all elisp files at once
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: byte-compile all elisp files at once |
Date: |
Fri, 10 Jan 2003 18:16:12 +0100 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) |
I'm installing this on HEAD and branch-1-7. (This is a
branch-1-7 patch, I posted the HEAD patch on address@hidden
two days ago.) In addition to test-case, I tested this on the
Autoconf tree.
2003-01-10 Alexandre Duret-Lutz <address@hidden>
Build elisp files all at once instead of one by one.
* automake.in (handle_emacs_lisp): Define am__ELFILES. Add
elc-stamp to all's dependencies.
* lib/am/lisp.am (elc-stamp): New rule, build all *.elc files.
(.el.elc): Rewrite to call elc-stamp if $@ doesn't exist.
(clean-lisp): Clean elc-stamp.
* lib/elisp-comp: Reindent. Erase the temporatry directory
from a trap. Propagate Emacs's exit status.
* tests/lisp3.test: New file.
* tests/Makefile.am (TESTS): Add lisp3.test.
Reported by Ryan T. Sammartino.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1365.2.27
diff -u -r1.1365.2.27 automake.in
--- automake.in 5 Jan 2003 22:51:47 -0000 1.1365.2.27
+++ automake.in 10 Jan 2003 17:11:16 -0000
@@ -5058,7 +5058,13 @@
my @elcfiles = map { $_ . 'c' } @elfiles;
define_pretty_variable ('ELCFILES', '', @elcfiles);
- push (@all, '$(ELCFILES)');
+ define_pretty_variable ('am__ELFILES', '', @elfiles);
+
+ # It's important that all depends on elc-stamp so that
+ # all .elc files get recompiled whenever a .el changes.
+ # It's important that all depends on $(ELCFILES) so that
+ # we can recover if any of them is deleted.
+ push (@all, 'elc-stamp', '$(ELCFILES)');
require_variables ("$am_file.am", "Emacs Lisp sources seen", 'TRUE',
'EMACS', 'lispdir');
Index: lib/elisp-comp
===================================================================
RCS file: /cvs/automake/automake/lib/elisp-comp,v
retrieving revision 1.5
diff -u -r1.5 elisp-comp
--- lib/elisp-comp 17 Jul 2001 06:00:37 -0000 1.5
+++ lib/elisp-comp 10 Jan 2003 17:11:17 -0000
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright 1995 Free Software Foundation, Inc.
+# Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc.
# François Pinard <address@hidden>, 1995.
#
# This program is free software; you can redistribute it and/or modify
@@ -31,24 +31,30 @@
# they require or load-library one another.
if test $# = 0; then
- echo 1>&2 "No files given to $0"
- exit 1
-else
- if test -z "$EMACS" || test "$EMACS" = "t"; then
- # Value of "t" means we are running in a shell under Emacs.
- # Just assume Emacs is called "emacs".
- EMACS=emacs
- fi
-
- tempdir=elc.$$
- mkdir $tempdir
- cp $* $tempdir
- cd $tempdir
-
- echo "(setq load-path (cons nil load-path))" > script
- $EMACS -batch -q -l script -f batch-byte-compile *.el
- mv *.elc ..
+ echo 1>&2 "No files given to $0"
+ exit 1
+fi
- cd ..
- rm -fr $tempdir
+if test -z "$EMACS" || test "$EMACS" = "t"; then
+ # Value of "t" means we are running in a shell under Emacs.
+ # Just assume Emacs is called "emacs".
+ EMACS=emacs
fi
+
+tempdir=elc.$$
+
+# Cleanup the temporary directory on exit.
+trap 'status=$?; rm -rf "$tempdir" && exit $status' 0
+trap '(exit $?); exit' 1 2 13 15
+
+mkdir $tempdir
+cp "$@" $tempdir
+
+(
+ cd $tempdir
+ echo "(setq load-path (cons nil load-path))" > script
+ $EMACS -batch -q -l script -f batch-byte-compile *.el || exit $?
+ mv *.elc ..
+) || exit $?
+
+(exit 0); exit
Index: lib/am/lisp.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/lisp.am,v
retrieving revision 1.33
diff -u -r1.33 lisp.am
--- lib/am/lisp.am 8 Jul 2002 19:41:23 -0000 1.33
+++ lib/am/lisp.am 10 Jan 2003 17:11:17 -0000
@@ -1,5 +1,6 @@
## automake - create Makefile.in from Makefile.am
-## Copyright 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+## Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003
+## Free Software Foundation, Inc.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -21,10 +22,28 @@
## Building. ##
## ---------- ##
-.el.elc:
+elc-stamp: $(am__ELFILES)
@echo 'WARNING: Warnings can be ignored. :-)'
if test $(EMACS) != no; then \
- EMACS=$(EMACS) $(SHELL) $(elisp_comp) $<; \
+## Make sure "$@" isn't empty initialy.
+ set x; \
+## Populate "$@" whith elisp files (found in the current directory
+## or in $srcdir).
+ list='$(am__ELFILES)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ set x "$$@" "$$d$$p"; shift; \
+ done; \
+## Finally call elisp-comp for all files.
+ shift; \
+ EMACS=$(EMACS) $(SHELL) $(elisp_comp) "$$@" || exit 1; \
+ else : ; fi
+ touch $@
+
+.el.elc:
+## Recover from the removal of $@
+ @if test ! -f $@; then \
+ rm -f elc-stamp; \
+ $(MAKE) $(AM_MAKEFLAGS) elc-stamp; \
else : ; fi
## ------------ ##
@@ -87,7 +106,7 @@
.PHONY clean-am: clean-lisp
clean-lisp:
- -test -z "$(ELCFILES)" || rm -f $(ELCFILES)
+ -rm -f elc-stamp $(ELCFILES)
## -------------- ##
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.443.2.14
diff -u -r1.443.2.14 Makefile.am
--- tests/Makefile.am 3 Dec 2002 20:40:52 -0000 1.443.2.14
+++ tests/Makefile.am 10 Jan 2003 17:11:17 -0000
@@ -248,6 +248,7 @@
link_f_only.test \
lisp.test \
lisp2.test \
+lisp3.test \
listval.test \
ltdeps.test \
ltlibobjs.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.576.2.22
diff -u -r1.576.2.22 Makefile.in
--- tests/Makefile.in 5 Dec 2002 22:13:41 -0000 1.576.2.22
+++ tests/Makefile.in 10 Jan 2003 17:11:19 -0000
@@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.7.2a from Makefile.am.
# @configure_input@
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -341,6 +341,7 @@
link_f_only.test \
lisp.test \
lisp2.test \
+lisp3.test \
listval.test \
ltdeps.test \
ltlibobjs.test \
Index: tests/lisp3.test
===================================================================
RCS file: tests/lisp3.test
diff -N tests/lisp3.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/lisp3.test 10 Jan 2003 17:11:19 -0000
@@ -0,0 +1,73 @@
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test that compilings interdependent elisp files works.
+
+required=emacs
+. ./defs || exit 1
+
+set -e
+
+cat > Makefile.am << 'EOF'
+lisp_LISP = am-one.el am-two.el am-three.el
+EXTRA_DIST = am-one.el am-two.el
+am-three.el:
+ echo "(provide 'am-three)" > $@
+CLEANFILES = am-three.el
+EOF
+
+cat >> configure.in << 'EOF'
+AM_PATH_LISPDIR
+AC_OUTPUT
+EOF
+
+echo "(require 'am-two)" > am-one.el
+echo "(require 'am-three) (provide 'am-two)" > am-two.el
+# am-tree.el is a built source
+
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+./configure
+
+$MAKE
+
+test -f am-one.elc
+test -f am-two.elc
+test -f am-three.elc
+test -f elc-stamp
+
+# Make sure we can recover from a deletion.
+rm -f am-one.elc
+$MAKE
+test -f am-one.elc
+
+# Make sure we build all files when any of them change.
+# (We grep a message to make sure the compilation happens.)
+unique=0a3346e2af8a689b85002b53df09142a
+sleep 2
+echo "(message \"$unique\")(provide 'am-three)" > am-three.el
+$MAKE >output 2>&1
+cat output
+grep $unique output
+
+# It should also work for VPATH-builds.
+$MAKE distcheck
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: byte-compile all elisp files at once,
Alexandre Duret-Lutz <=