]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] refactor: new make variables am__all_libs and am__all_ltlibs
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 5 Jun 2012 16:31:58 +0000 (18:31 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 5 Jun 2012 19:29:19 +0000 (21:29 +0200)
This change is only a preparatory refactoring in view of future changes.

* t/all-progs.sh: Renamed ...
* t/all-prog-libs.sh: ... like this, and extended.
* automake.in (generate_makefile): Define the make vars 'am__all_libs'
and 'am__all_ltlibs' respectively from the sorted keys of the hashes
'%known_libraries' and '%known_ltlibraries'.  For consistency, and for
offering a better stability of the output Makefiles, sort the keys of
the '%known_programs' hash before using them to define the make variable
'am__all_progs'.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
automake.in
t/all-prog-libs.sh [moved from t/all-progs.sh with 56% similarity]

index 7145dedf68544c2f7135dad9a266f3a9f1518090..ca30da7b330dc94e64bcd74486068dac58657045 100644 (file)
@@ -7491,8 +7491,12 @@ sub generate_makefile ($$)
   handle_tags;
   handle_minor_options;
 
-  # Must come after handle_programs so that %known_programs is up-to-date.
-  define_variable ('am__all_progs', INTERNAL, keys %known_programs);
+  # Must come after invocation of handle_programs, handle_libraries and
+  # handle_ltlibraries, so that %known_programs and %known_libraries are
+  # up-to-date.
+  define_variable 'am__all_progs',  INTERNAL, sort keys %known_programs;
+  define_variable 'am__all_libs',   INTERNAL, sort keys %known_libraries;
+  define_variable 'am__all_ltlibs', INTERNAL, sort keys %known_ltlibraries;
   handle_tests;
 
   # This must come after most other rules.
similarity index 56%
rename from t/all-progs.sh
rename to t/all-prog-libs.sh
index 3b8050a0180e3f7ed38e77ecec1e344959caf3f2..1857a45e26efcff8c2ebba3561f266f7ea465dd0 100755 (executable)
 # 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 internal automake variable $(am__all_progs).
+# Test internal automake variables:
+#  - $(am__all_progs).
+#  - $(am__all_libs).
+#  - $(am__all_ltlibs).
 
 . ./defs || Exit 1
 
 cat >> configure.ac << 'END'
-AC_SUBST([CC], ['whocares'])
+AC_SUBST([CC], [who-cares])
+m4_define([AM_PROG_AR], [AC_SUBST([AR], [who-cares])])
+AM_PROG_AR
+AC_SUBST([RANLIB], [who-cares])
+AC_SUBST([LIBTOOL], [who-cares])
 AC_SUBST([EXEEXT], [''])
 AC_OUTPUT
 END
@@ -28,31 +35,47 @@ cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = no-dependencies
 
 check_PROGRAMS = p1
+check_LIBRARIES = lib01.a
+check_LTLIBRARIES = lib1.la
 check_SCRIPTS = x1
 
 EXTRA_PROGRAMS = p2
+EXTRA_LIBRARIES = lib02.a
+EXTRA_LTLIBRARIES = lib2.la
 EXTRA_SCRIPTS = x2
 
 bin_PROGRAMS = p3
+lib_LIBRARIES = lib03.a
+lib_LTLIBRARIES = lib3.la
 bin_SCRIPTS = x3
 
 noinst_PROGRAMS = p4
+noinst_LIBRARIES = lib04.a
+noinst_LTLIBRARIES = lib4.la
 noinst_SCRIPTS = x4
 
 mydir = $(prefix)
 my_PROGRAMS = p5
+my_LIBRARIES = lib05.a
+my_LTLIBRARIES = lib5.la
 my_SCRIPTS = x5
 
 .PHONY: debug test
 debug:
-       @echo BEG: $(am__all_progs) :END
+       @echo  PROGS-BEG:  $(am__all_progs)   :PROGS-END
+       @echo   LIBS-BEG:  $(am__all_libs)    :LIBS-END
+       @echo LTLIBS-BEG:  $(am__all_ltlibs)  :LTLIBS-END
 test: debug
-       test '$(sort $(am__all_progs))' = 'p1 p2 p3 p4 p5'
+       test '$(am__all_progs)'  = 'p1 p2 p3 p4 p5'
+       test '$(am__all_libs)'   = 'lib01.a lib02.a lib03.a lib04.a lib05.a'
+       test '$(am__all_ltlibs)' = 'lib1.la lib2.la lib3.la lib4.la lib5.la'
 END
 
+: > ltmain.sh
+
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --add-missing
 
 ./configure
 $MAKE test