+2003-01-10 Alexandre Duret-Lutz <adl@gnu.org>
+
+ 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.
+
2003-01-09 Akim Demaille <akim@epita.fr>
* automake.texi: Prefer $(FOO) to @FOO@ in the documentation.
New in 1.7a:
+* elisp sources are compiled all at once, instead of one by one.
+ This allows interdependencies and speed up compilation.
* AM_PROG_CC_STDC is now empty. The content of this macro was
merged in AC_PROG_CC. If your code uses $am_cv_prog_cc_stdc,
you should adjust it to use $ac_cv_prog_cc_stdc instead.
-----
-Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software
-Foundation, Inc.
+Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+Free Software Foundation, Inc.
This file is part of GNU Automake.
# Generate .elc files.
my @elcfiles = map { $_->[1] . 'c' } @elfiles;
define_pretty_variable ('ELCFILES', TRUE, INTERNAL, @elcfiles);
-
- push (@all, '$(ELCFILES)');
+ define_pretty_variable ('am__ELFILES', TRUE, INTERNAL,
+ map { $_->[1] } @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 ($elfiles[0][0], "Emacs Lisp sources seen", TRUE,
'EMACS', 'lispdir');
## 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
## 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
## ------------ ##
.PHONY clean-am: clean-lisp
clean-lisp:
- -test -z "$(ELCFILES)" || rm -f $(ELCFILES)
+ -rm -f elc-stamp $(ELCFILES)
## -------------- ##
#!/bin/sh
-# Copyright 1995 Free Software Foundation, Inc.
+# Copyright (C) 1995, 2000, 2003 Free Software Foundation, Inc.
# François Pinard <pinard@iro.umontreal.ca>, 1995.
#
# This program is free software; you can redistribute it and/or modify
# 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 ..
-
- cd ..
- rm -fr $tempdir
+ echo 1>&2 "No files given to $0"
+ exit 1
fi
+
+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
link_f_only.test \
lisp.test \
lisp2.test \
+lisp3.test \
listval.test \
location.test \
ltdeps.test \
link_f_only.test \
lisp.test \
lisp2.test \
+lisp3.test \
listval.test \
location.test \
ltdeps.test \
--- /dev/null
+#! /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