]> sourceware.org Git - automake.git/commitdiff
Do variable interpolation
authorTom Tromey <tromey@redhat.com>
Tue, 27 Aug 1996 05:19:28 +0000 (05:19 +0000)
committerTom Tromey <tromey@redhat.com>
Tue, 27 Aug 1996 05:19:28 +0000 (05:19 +0000)
ChangeLog
NEWS
TODO
automake.in
automake.texi
tests/ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/interp.test [new file with mode: 0755]

index 14a34190faa833938600052ec8295cc1c0992cec..272cfa2d89398c8def1a2d5165e9420021ce3ed7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Mon Aug 26 21:37:32 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       * automake.in (variable_value_as_list): New sub.
+       (handle_source_transform): Use it.
+       (handle_lib_objects): Ditto.
+       (handle_libraries): Ditto.
+       (handle_texinfo): Ditto.
+       (handle_man_pages): Ditto.
+       (am_install_var): Ditto.
+       (handle_options): Ditto.
+
 Sat Aug 24 09:30:46 1996  Tom Tromey  <tromey@creche.cygnus.com>
 
        Reported by Jim Meyering:
diff --git a/NEWS b/NEWS
index 5900bb8ec93d8942458bc2b28481197f9bc504bf..171b13432c8b54c099caed98c28cd3297c510d42 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ New in 1.1d:
 * Better C++, yacc, lex support
 * Random files listed in AC_OUTPUT now removed by "make clean"
 * Will compute _DEPENDENCIES variables automatically if not supplied
+* Will interpolate $(...) and ${...} when examining contents of a variable
 \f
 New in 1.0:
 * Bug fixes
diff --git a/TODO b/TODO
index 25b2bf82b4827fe7acb7f7d9494b0f146a45cacd..195987de8ede5a1b1613120a38cf7b5528c4b04d 100644 (file)
--- a/TODO
+++ b/TODO
@@ -286,6 +286,12 @@ autosystem...
 
 Document:
 
+go through handle_configure and make sure each macro is documented in
+the appropriate place.  Clean up ordering in document.  Add info about
+AM_ macros.
+
+finish yacc, lex, c++ nodes
+
 Document customary ordering of Makefile.am.  From François.
 
 must document that @ALLOCA@ works in _LDADD
index a5421385853c741a66d3eab5d96107274f905cb9..406df90ce0ae7ef171568675ac059f569b45475a 100755 (executable)
@@ -461,7 +461,7 @@ sub handle_options
 {
     return if ! &variable_defined ('AUTOMAKE_OPTIONS');
 
-    foreach (split (' ', $contents{'AUTOMAKE_OPTIONS'}))
+    foreach (&variable_value_as_list ('AUTOMAKE_OPTIONS'))
     {
        last if /^#/;
 
@@ -722,34 +722,34 @@ sub handle_source_transform
        return;
     }
 
-    local ($source_list);
+    local (@files);
     local ($prefix);
     foreach $prefix ('', 'EXTRA_')
     {
-       $source_list = '';
+       @files = ();
        if (&variable_defined ($prefix . $one_file . "_SOURCES"))
        {
            push (@sources, '$(' . $prefix . $one_file . "_SOURCES)");
            push (@objects, '$(' . $prefix . $one_file . "_OBJECTS)")
                unless $prefix eq 'EXTRA_';
-           $source_list = $contents{$prefix . $one_file . "_SOURCES"};
+           @files = &variable_value_as_list ($prefix
+                                             . $one_file . "_SOURCES");
        }
        elsif ($prefix eq '')
        {
            $output_vars .= $one_file . "_SOURCES = " . $unxformed . ".c\n";
            push (@sources, $unxformed . '.c');
            push (@objects, $unxformed . $obj);
-           $source_list = $unxformed . ".c ";
+           push (@files, $unxformed . ".c ");
        }
        else
        {
            $output_vars .= "EXTRA_" . $one_file . "_SOURCES =\n";
        }
 
-       if ($source_list)
+       if (length (@files))
        {
            # Turn sources into objects.
-           local (@files) = split (' ', $source_list);
            local (@result) = ();
            foreach (@files)
            {
@@ -761,9 +761,6 @@ sub handle_source_transform
                next if /\.h\+\+$/;
                next if /\.hh$/;
                next if /\.hpp$/;
-               # Skip things that look like macro references.
-               next if /^\$\(.*\)$/;
-               next if /^\$\{.*\}$/;
                # Skip things that look like configure substitutions.
                next if /^\@.*\@$/;
 
@@ -849,7 +846,7 @@ sub handle_lib_objects
     local ($lsearch);
     local (@dep_list) = ();
 
-    foreach $lsearch (split (' ', $contents{$var}))
+    foreach $lsearch (&variable_value_as_list ($var))
     {
        # Skip -lfoo and -Ldir.
        next if /^-[lL]/;
@@ -999,7 +996,7 @@ sub handle_libraries
        if (&variable_defined ($onedir . '_LIBRARIES'))
        {
            @outlist = ();
-           foreach $onelib (split (' ', $contents{$onedir . '_LIBRARIES'}))
+           foreach $onelib (&variable_value_as_list ($onedir . '_LIBRARIES'))
            {
                push (@outlist, 'lib' . $onelib . '.a');
            }
@@ -1145,7 +1142,7 @@ sub handle_texinfo
     return if (! &variable_defined ('info_TEXINFOS')
               && ! &variable_defined ('html_TEXINFOS'));
 
-    local (@texis) = split (' ', $contents{'info_TEXINFOS'});
+    local (@texis) = &variable_value_as_list ('info_TEXINFOS');
 
     local (@infos_list, @info_deps_list, @dvis_list, @texi_deps);
     local ($infobase, $info_cursor);
@@ -1283,7 +1280,7 @@ sub handle_man_pages
 
     # We generate the manpage install code by hand to avoid the use of
     # basename in the generated Makefile.
-    local (@mans) = split (' ', $contents{'man_MANS'});
+    local (@mans) = &variable_value_as_list ('man_MANS');
     local (%sections, %inames, %mbases, %secmap, %fullsecmap);
     local ($i) = 1;
     foreach (@mans)
@@ -1703,7 +1700,7 @@ sub handle_subdirs
 
     # Make sure each directory mentioned in SUBDIRS actually exists.
     local ($dir);
-    foreach $dir (split (' ', $contents{'SUBDIRS'}))
+    foreach $dir (&variable_value_as_list ('SUBDIRS'))
     {
        # Skip directories substituted by configure.
        next if $dir =~ /^\@.*\@$/;
@@ -2742,6 +2739,42 @@ sub variable_defined
     return (defined $contents{$var} && ! defined $targets{$var});
 }
 
+# Return contents of variable as list, split as whitespace.  This will
+# recursively follow $(...) and ${...} inclusions.  It preserves @...@
+# substitutions.  If PARENT is specified, it is the name of the
+# including variable; this is only used for error reports.
+sub variable_value_as_list
+{
+    local ($var, $parent) = @_;
+    local (@result);
+
+    if (defined $targets{$var})
+    {
+       &am_line_error ($var, "\`$var' is target; expected variable");
+    }
+    elsif (! defined $contents{$var})
+    {
+       &am_error ($parent, "variable \`$var' not defined");
+    }
+    else
+    {
+       foreach (split (' ', $contents{$var}))
+       {
+           # Handle variable substitutions.
+           if (/^\$\{(.*)\}$/ || /^\$\((.*)\)$/)
+           {
+               push (@result, &variable_value_as_list ($1, $var));
+           }
+           else
+           {
+               push (@result, $_);
+           }
+       }
+    }
+
+    return @result;
+}
+
 # Read Makefile.am and set up %contents.  Simultaneously copy lines
 # from Makefile.am into $output_trailer or $output_vars as
 # appropriate.  NOTE we put rules in the trailer section.  We want
@@ -3305,7 +3338,7 @@ sub am_install_var
            # Append actual contents of where_PRIMARY variable to
            # result.
            local ($rcurs);
-           foreach $rcurs (split (' ', $contents{$one_name}))
+           foreach $rcurs (&variable_value_as_list ($one_name))
            {
                # Skip configure substitutions.  Possibly bogus.
                next if $rcurs =~ /^\@.*\@$/;
index 91d28d47dc67a7301ad090148403b862a67a8a5a..0c03b345fe0085625330cc859cdb62bf0e65820e 100644 (file)
@@ -501,9 +501,12 @@ Automake will also detect statements which put @samp{.o} files into
 This is required if any libraries are built in the package.
 @cvindex AC_PROG_RANLIB
 
+@item AC_PROG_CXX
+This is required if any C++ source is included.
+@cvindex AC_PROG_CXX
+
 @item AC_PROG_INSTALL
 @item AM_PROG_INSTALL
-
 @code{AM_PROG_INSTALL} is required if any scripts (@pxref{Scripts}) are
 installed by the package.  Otherwise, @code{AC_PROG_INSTALL} is
 required.  @code{AM_INIT_AUTOMAKE} automatically calls
@@ -518,6 +521,21 @@ Libtool Manual, libtool.info, The Libtool Manual}).  This work is
 still preliminary.
 @cvindex AM_PROG_LIBTOOL
 
+@item AC_PROG_YACC
+If a Yacc source file is seen, then you must either use this macro or
+declare the variable @samp{YACC} in @file{configure.in}.  The former is
+preferred.
+@cvindex AC_PROG_YACC
+@cvindex YACC
+
+@item AC_DECL_YYTEXT
+This macro is required if there is Yacc source in the package.
+@cvindex AC_DECL_YYTEXT
+
+@item AC_PROG_LEX
+If a Lex source file is seen, then this macro must be used.
+@cvindex AC_PROG_LEX
+
 @item ALL_LINGUAS
 If Automake sees that this variable is set in @file{configure.in}, it
 will check the @file{po} directory to ensure that all the named
@@ -736,26 +754,38 @@ handled in the dependency-tracking scheme, see @xref{Dependencies}.
 @node Program variables
 @section Variables used when building a program
 
-@table @code
-@item CC
-@item CFLAGS
-@item CPPFLAGS
-@item CXX
-@item CXXFLAGS
-@item DEFS
-@item LDFLAGS
-@item LIBS
+Occasionally it is useful to know which @file{Makefile} variables
+Automake uses for compilations; for instance you might need to do your
+own compilation in some special cases.
+
+Some variables are inherited from Autoconf; these are @code{CC},
+@code{CFLAGS}, @code{CPPFLAGS}, @code{CXX}, @code{CXXFLAGS},
+@code{DEFS}, @code{LDFLAGS}, and @code{LIBS}.
+
 
+There are some additional variables which Automake itself defines:
+
+@table @code
 @item INCLUDES
+A list of @samp{-I} options.  This can be set in your @file{Makefile.am}
+if you have special directories you want to look in.
+
 @item COMPILE
+This is the command used to actually compile a C source file.  The
+filename is appended to form the complete command line.
+
 @item LINK
+This is the command used to actually link a C program.
 @end table
 
 
 @node Yacc and Lex
 @section Yacc and Lex support
 
-Y
+Automake has somewhat idiosyncratic support for Yacc and Lex.
+
+
+
 
 @node C++
 @section C++ and other languages
@@ -764,7 +794,11 @@ Automake includes full support for C++, and rudimentary support for
 other languages.  Support for other languages will be improved based on
 demand.
 
+Any package including C++ code must use @code{AC_PROG_CXX} in its
+@file{configure.in}.
+
 
+A few additional variables are defined when a C++ source file is seen.
 
 
 @node ANSI
index f2ade8edcec5595dc8678bdc801d689f00f501e5..35d8eb685d850567d349fd137691379eabc3866e 100644 (file)
@@ -1,3 +1,7 @@
+Mon Aug 26 23:04:01 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       * interp.test: New file.
+
 Mon Aug 12 13:58:55 1996  Tom Tromey  <tromey@creche.cygnus.com>
 
        * libobj2.test: New file.
index 430d1a4ef189aedc4147c5d158676a97be4b6747..08f197a0bb8a1266bb512f19e6ae684fa3c59ae5 100644 (file)
@@ -13,6 +13,6 @@ yacc.test mkinstall2.test texinfo2.test ansi.test depacl.test depacl2.test \
 error.test colon.test vtexi2.test tags.test comment.test libfiles.test \
 man.test info.test obsolete.test lex.test scripts.test subdir2.test \
 exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \
-order.test libobj2.test
+order.test libobj2.test interp.test
 
 EXTRA_DIST = defs $(TESTS)
index 76fb31cb22fe543b5c45cce70f7a8d8972b060e8..2f5698a712f9f37d4b269f2465bcb19a8a59d02b 100644 (file)
@@ -51,7 +51,7 @@ yacc.test mkinstall2.test texinfo2.test ansi.test depacl.test depacl2.test \
 error.test colon.test vtexi2.test tags.test comment.test libfiles.test \
 man.test info.test obsolete.test lex.test scripts.test subdir2.test \
 exsource.test canon4.test dup.test defun.test cxxlink.test cxxnoc.test \
-order.test libobj2.test
+order.test libobj2.test interp.test
 
 EXTRA_DIST = defs $(TESTS)
 mkinstalldirs = $(top_srcdir)/mkinstalldirs
diff --git a/tests/interp.test b/tests/interp.test
new file mode 100755 (executable)
index 0000000..e593b68
--- /dev/null
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+# Test to make sure variable interpolation works.
+
+. $srcdir/defs || exit 1
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = qqq
+s1 = z.c
+qqq_SOURCES = $(s1)
+END
+
+$AUTOMAKE || exit 1
+
+grep 'z\.o' Makefile.in
This page took 0.084315 seconds and 5 git commands to generate.