automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 3/7] [ng] refactor: new make variables am__all_libs


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 3/7] [ng] refactor: new make variables am__all_libs and am__all_ltlibs
Date: Wed, 6 Jun 2012 00:21:03 +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 <address@hidden>
---
 automake.in                          |    8 ++++++--
 t/{all-progs.sh => all-prog-libs.sh} |   33 ++++++++++++++++++++++++++++-----
 2 files changed, 34 insertions(+), 7 deletions(-)
 rename t/{all-progs.sh => all-prog-libs.sh} (56%)

diff --git a/automake.in b/automake.in
index 7145ded..ca30da7 100644
--- a/automake.in
+++ b/automake.in
@@ -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.
diff --git a/t/all-progs.sh b/t/all-prog-libs.sh
similarity index 56%
rename from t/all-progs.sh
rename to t/all-prog-libs.sh
index 3b8050a..1857a45 100755
--- a/t/all-progs.sh
+++ b/t/all-prog-libs.sh
@@ -14,12 +14,19 @@
 # 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
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]