]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Implement EXTRA_maude_DEPENDENCIES for programs and libraries.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 2 Oct 2010 18:25:53 +0000 (20:25 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 2 Oct 2010 18:25:53 +0000 (20:25 +0200)
* automake.in (handle_programs, handle_libraries)
(handle_ltlibraries): Mark EXTRA_*_DEPENDENCIES as recognized.
* doc/automake.texi (Linking, Program and Library Variables)
(LIBOBJS): Document EXTRA_*_DEPENDENCIES.
* lib/am/library.am (%LIBRARY%): Also depend on
$(EXTRA_%XLIBRARY%_DEPENDENCIES).
* lib/am/ltlibrary.am (%LTLIBRARY%): Also depend on
(%XLTLIBRARY%_DEPENDENCIES).
* lib/am/program.am (%PROGRAM%%EXEEXT%): Also depend on
$(EXTRA_%XPROGRAM%_DEPENDENCIES).
* tests/extradep.test, tests/extradep2.test: New tests.
* tests/Makefile.am (TESTS): Update.
* NEWS: Update.
Suggested by Eric Blake.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
automake.in
doc/automake.texi
lib/am/library.am
lib/am/ltlibrary.am
lib/am/program.am
tests/Makefile.am
tests/Makefile.in
tests/extradep.test [new file with mode: 0755]
tests/extradep2.test [new file with mode: 0755]

index 90286ac31c237f873ca2e9f2ba2bb2b382c4fa93..356a9fc0d47fbfc1a90cabbd77bc4e1a49a62dc5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2010-10-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Implement EXTRA_maude_DEPENDENCIES for programs and libraries.
+       * automake.in (handle_programs, handle_libraries)
+       (handle_ltlibraries): Mark EXTRA_*_DEPENDENCIES as recognized.
+       * doc/automake.texi (Linking, Program and Library Variables)
+       (LIBOBJS): Document EXTRA_*_DEPENDENCIES.
+       * lib/am/library.am (%LIBRARY%): Also depend on
+       $(EXTRA_%XLIBRARY%_DEPENDENCIES).
+       * lib/am/ltlibrary.am (%LTLIBRARY%): Also depend on
+       (%XLTLIBRARY%_DEPENDENCIES).
+       * lib/am/program.am (%PROGRAM%%EXEEXT%): Also depend on
+       $(EXTRA_%XPROGRAM%_DEPENDENCIES).
+       * tests/extradep.test, tests/extradep2.test: New tests.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+       Suggested by Eric Blake.
+
        tests: avoid running into timing issues due to sanity change.
        * tests/acloca10.test, tests/acloca18.test, tests/aclocal9.test:
        Insert strategic sleep before aclocal reruns, to ensure files
diff --git a/NEWS b/NEWS
index 9314bdd0a5995ec456b9f5823ee57153ff8f1deb..121989fa448764e5b70265ccd81e458b3844dcef 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,10 @@ New in 1.11a:
     at least one second has passed, to avoid time stamp issues with makefile
     rules rerunning autotools programs.
 
+  - For programs and libraries, automake now detects EXTRA_foo_DEPENDENCIES and
+    adds them to the normal list of dependencies, but without overwriting the
+    foo_DEPENDENCIES variable, which is normally computed by automake.
+
 Bugs fixed in 1.11a:
 
   - Lots of minor bugfixes.
index 9cbe6c16901251924a1f7b258cfd77c5812178c8..52add361c8d09b9d1050a58a14f6540ab0b129a4 100644 (file)
@@ -2678,6 +2678,7 @@ sub handle_programs
                  "use `${xname}_LDADD', not `${xname}_LIBADD'");
 
       set_seen ($xname . '_DEPENDENCIES');
+      set_seen ('EXTRA_' . $xname . '_DEPENDENCIES');
       set_seen ($xname . '_LDFLAGS');
 
       # Determine program to use for link.
@@ -2789,6 +2790,7 @@ sub handle_libraries
 
       # Make sure we at look at this.
       set_seen ($xlib . '_DEPENDENCIES');
+      set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
 
       &handle_source_transform ($xlib, $onelib, $obj, $where,
                                NONLIBTOOL => 1, LIBTOOL => 0);
@@ -2968,6 +2970,7 @@ sub handle_ltlibraries
       # Make sure we look at these.
       set_seen ($xlib . '_LDFLAGS');
       set_seen ($xlib . '_DEPENDENCIES');
+      set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
 
       # Generate support for conditional object inclusion in
       # libraries.
index 1bd327dd6096f4f97270aeffc445601683ce9fa0..487f230ccfa7cfb28b36df347131cb957e8f99c7 100644 (file)
@@ -4698,11 +4698,12 @@ this purpose.
 
 @cindex @code{_DEPENDENCIES}, defined
 @vindex maude_DEPENDENCIES
+@vindex EXTRA_maude_DEPENDENCIES
 It is also occasionally useful to have a program depend on some other
 target that is not actually part of that program.  This can be done
-using the @code{@var{prog}_DEPENDENCIES} variable.  Each program
-depends on the contents of such a variable, but no further
-interpretation is done.
+using either the @code{@var{prog}_DEPENDENCIES} or the
+@code{EXTRA_@var{prog}_DEPENDENCIES} variable.  Each program depends on
+the contents both variables, but no further interpretation is done.
 
 Since these dependencies are associated to the link rule used to
 create the programs they should normally list files used by the link
@@ -4725,6 +4726,10 @@ generated.
 @ref{Conditional Sources} shows a situation where @code{_DEPENDENCIES}
 may be used.
 
+The @code{EXTRA_@var{prog}_DEPENDENCIES} may be useful for cases where
+you merely want to augment the @command{automake}-generated
+@code{@var{prog}_DEPENDENCIES} rather than replacing it.
+
 @cindex @code{LDADD} and @option{-l}
 @cindex @option{-l} and @code{LDADD}
 We recommend that you avoid using @option{-l} options in @code{LDADD}
@@ -5592,6 +5597,7 @@ option, so they should not be mode-specific options (those belong to
 the compiler or linker flags).  @xref{Libtool Flags}.
 
 @item maude_DEPENDENCIES
+@itemx EXTRA_maude_DEPENDENCIES
 It is also occasionally useful to have a target (program or library)
 depend on some other file that is not actually part of that target.
 This can be done using the @code{_DEPENDENCIES} variable.  Each
@@ -5622,6 +5628,10 @@ compilation using an @code{AC_SUBST} variable that contains a list of
 objects.  @xref{Conditional Sources}, and @ref{Conditional Libtool
 Sources}.
 
+The @code{EXTRA_*_DEPENDENCIES} variable may be useful for cases where
+you merely want to augment the @command{automake}-generated
+@code{_DEPENDENCIES} variable rather than replacing it.
+
 @item maude_LINK
 You can override the linker on a per-program basis.  By default the
 linker is chosen according to the languages used by the program.  For
@@ -5832,9 +5842,10 @@ However there is no need to list the corresponding sources in
 automatically adds @samp{$(LIBOBJS)} and @samp{$(ALLOCA)} to the
 dependencies, and it will discover the list of corresponding source
 files automatically (by tracing the invocations of the
-@code{AC_LIBSOURCE} Autoconf macros).  However, if you have already
-defined @samp{*_DEPENDENCIES} explicitly for an unrelated reason, then
-you have to add these variables manually.
+@code{AC_LIBSOURCE} Autoconf macros).  If you have already defined
+@samp{*_DEPENDENCIES} explicitly for an unrelated reason, then you
+either need to add these variables manually, or use
+@samp{EXTRA_*_DEPENDENCIES} instead of @samp{*_DEPENDENCIES}.
 
 These variables are usually used to build a portability library that
 is linked with all the programs of the project.  We now review a
index ce94e5e8fee91f02025e21e3a91c56e837f6af11..db096c762eeedcaf0c18cfa5b2149a0567a71fd8 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1999, 2003, 2009 Free Software
+## Copyright (C) 1994, 1995, 1996, 1999, 2003, 2009, 2010 Free Software
 ## Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
 
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
-%LIBRARY%: $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_DEPENDENCIES) %DIRSTAMP%
+%LIBRARY%: $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_DEPENDENCIES) $(EXTRA_%XLIBRARY%_DEPENDENCIES) %DIRSTAMP%
        %SILENT%-rm -f %LIBRARY%
        %VERBOSE%$(%XLIBRARY%_AR) %LIBRARY% $(%XLIBRARY%_OBJECTS) $(%XLIBRARY%_LIBADD)
        %SILENT%$(RANLIB) %LIBRARY%
index 9455234683b6251cdde5d2dbfedc0799efc87952..3cd2941dc24889a2f6741b7c0ecd1f476dd37b68 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 2003, 2005, 2008, 2009 Free Software
+## Copyright (C) 1994, 1995, 1996, 2003, 2005, 2008, 2009, 2010 Free Software
 ## Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -14,5 +14,5 @@
 
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
-%LTLIBRARY%: $(%XLTLIBRARY%_OBJECTS) $(%XLTLIBRARY%_DEPENDENCIES) %DIRSTAMP%
+%LTLIBRARY%: $(%XLTLIBRARY%_OBJECTS) $(%XLTLIBRARY%_DEPENDENCIES) $(EXTRA_%XLTLIBRARY%_DEPENDENCIES) %DIRSTAMP%
        %VERBOSE%$(%XLINK%) %RPATH% $(%XLTLIBRARY%_OBJECTS) $(%XLTLIBRARY%_LIBADD) $(LIBS)
index 7e568e79ad37225a153bc789e60f652834f66786..c0e188f968c2fa1c49fc552150256cbd4279929e 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 2001, 2003, 2005, 2009
+## Copyright (C) 1994, 1995, 1996, 1997, 2001, 2003, 2005, 2009, 2010
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -14,7 +14,7 @@
 
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
-%PROGRAM%%EXEEXT%: $(%XPROGRAM%_OBJECTS) $(%XPROGRAM%_DEPENDENCIES) %DIRSTAMP%
+%PROGRAM%%EXEEXT%: $(%XPROGRAM%_OBJECTS) $(%XPROGRAM%_DEPENDENCIES) $(EXTRA_%XPROGRAM%_DEPENDENCIES) %DIRSTAMP%
 ## Remove program before linking.  Otherwise the link will fail if the
 ## program is running somewhere.  FIXME: this could be a loss if
 ## you're using an incremental linker.  Maybe we should think twice?
index 6352a1152f6834e329aef887bdfbc847b35e51c4..8b2ca8440d0e436b0fc5029cd26abed55e4a923a 100644 (file)
@@ -345,6 +345,8 @@ extra9.test \
 extra10.test \
 extra11.test \
 extra12.test \
+extradep.test \
+extradep2.test \
 f90only.test \
 flavor.test \
 flibs.test \
index 8d5622c7e00b27f3319cff9db65394db7e6ad7b0..4bb1e914de8941a598699ffc49c1d53ec4468248 100644 (file)
@@ -556,6 +556,8 @@ extra9.test \
 extra10.test \
 extra11.test \
 extra12.test \
+extradep.test \
+extradep2.test \
 f90only.test \
 flavor.test \
 flibs.test \
diff --git a/tests/extradep.test b/tests/extradep.test
new file mode 100755 (executable)
index 0000000..d84182d
--- /dev/null
@@ -0,0 +1,104 @@
+#! /bin/sh
+# Copyright (C) 2010 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test EXTRA_*_DEPENDENCIES.  See extradep2 for libtool variant.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_SUBST([deps], [bardep])
+AM_CONDITIONAL([COND], [test -n "$cond"])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libfoo.a
+EXTRA_libfoo_a_DEPENDENCIES = libfoodep
+libfoodep:
+       @echo making $@
+       @: > $@
+CLEANFILES = libfoodep
+
+bin_PROGRAMS = foo bar
+EXTRA_foo_DEPENDENCIES = foodep
+if COND
+EXTRA_foo_DEPENDENCIES += foodep2
+endif
+bar_LDADD = libfoo.a
+EXTRA_bar_DEPENDENCIES = $(deps)
+
+EXTRA_DIST = foodep bardep
+
+bar-is-newer-than-libfoo.a:
+       test `ls -1t bar$(EXEEXT) libfoo.a | sed q` = bar$(EXEEXT)
+END
+
+cat >libfoo.c <<'END'
+int libfoo () { return 0; }
+END
+
+cat >foo.c <<'END'
+int main () { return 0; }
+END
+
+cat >bar.c <<'END'
+extern int libfoo ();
+int main () { return libfoo (); }
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure cond=yes
+
+# hypotheses:
+# EXTRA_*_DEPENDENCIES are honored.
+# conditionals and substitutions are honored.
+# *_DEPENDENCIES are not overwritten by their EXTRA_* counterparts.
+
+: >foodep
+: >foodep2
+: >bardep
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'making libfoodep' stdout
+
+rm -f foodep
+$MAKE && Exit 1
+: >foodep
+
+rm -f foodep2
+$MAKE && Exit 1
+: >foodep2
+
+rm -f bardep
+$MAKE && Exit 1
+: >bardep
+
+$MAKE
+$sleep
+touch libfoo.a
+$MAKE
+$MAKE bar-is-newer-than-libfoo.a
+
+$MAKE distcheck
+
+:
diff --git a/tests/extradep2.test b/tests/extradep2.test
new file mode 100755 (executable)
index 0000000..7d72e82
--- /dev/null
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 2010 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test EXTRA_*_DEPENDENCIES, libtool version; see extradep.test.
+
+required=libtoolize
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AC_SUBST([deps], [bardep])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LTLIBRARIES = libfoo.la
+EXTRA_libfoo_la_DEPENDENCIES = libfoodep
+libfoodep:
+       @echo making $@
+       @: > $@
+CLEANFILES = libfoodep
+
+bin_PROGRAMS = bar
+bar_LDADD = libfoo.la
+EXTRA_bar_DEPENDENCIES = $(deps)
+
+EXTRA_DIST = bardep
+
+bar-is-newer-than-libfoo.la:
+       test `ls -1t bar$(EXEEXT) libfoo.la | sed q` = bar$(EXEEXT)
+END
+
+cat >libfoo.c <<'END'
+int libfoo () { return 0; }
+END
+
+cat >bar.c <<'END'
+extern int libfoo ();
+int main () { return libfoo (); }
+END
+
+libtoolize
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure
+
+# hypothesis: EXTRA_*_DEPENDENCIES are honored.
+
+: >foodep
+: >foodep2
+: >bardep
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'making libfoodep' stdout
+
+rm -f bardep
+$MAKE && Exit 1
+: >bardep
+
+$MAKE
+$sleep
+touch libfoo.la
+$MAKE
+$MAKE bar-is-newer-than-libfoo.la
+
+$MAKE distcheck
+
+: