]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Bug fixes
authorTom Tromey <tromey@redhat.com>
Wed, 6 Mar 1996 00:29:35 +0000 (00:29 +0000)
committerTom Tromey <tromey@redhat.com>
Wed, 6 Mar 1996 00:29:35 +0000 (00:29 +0000)
13 files changed:
ChangeLog
NEWS
TODO
automake.in
automake.texi
lib/am/program.am
program.am
tests/ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/badprog.test
tests/canon.test [new file with mode: 0755]
version.texi

index 37294696e8189b04b877fe295be6bddfa1788005..322ef8fa2409feb5dbc4a51a69e4e6d138147ac5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Tue Mar  5 16:12:04 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       * automake.in (OBJECT_PATTERN): Removed.
+       (am_install_var): No error if name is invalid.
+       (handle_programs): Canonicalize program names.
+       (BOGUS_MACRO_PATTERN): New variable.
+       (read_am_file): Error if bad macro name given.
+       (require_file_internal): Use am_line_error, not am_conf_error.
+
+       * program.am (@PROGRAM@): Recognize @PROGRAM@_DEPENDENCIES.
+
 Mon Mar  4 19:30:24 1996  Tom Tromey  <tromey@creche.cygnus.com>
 
        * automake.in (handle_lib_objects): New function.
diff --git a/NEWS b/NEWS
index fcf1f372dd2998723bd193b4fc0e83f1864af598..b023e24c1b348843f8a796477cc39b299b084b73 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ New in 0.31:
 * DIST_SUBDIRS is deprecated
 * @ALLOCA@ and @LIBOBJS@ now work in _LDADD variables
 * Better error messages in many cases
+* Program names are canonicalized
 \f
 New in 0.30:
 * Bug fixes
diff --git a/TODO b/TODO
index df1ab47613b36d2ee94b08c9cdcff78bff0ad0c6..4a513a33409a102c8aed53eea589d970c3da1902 100644 (file)
--- a/TODO
+++ b/TODO
@@ -6,7 +6,7 @@ Other priorities:
 * Must rewrite am_install_var.  Should break into multiple functions.
   This will allow the callers to be a little smarter.
 * Rewrite clean targets.
-* Expand test suite.
+* Must rewrite error handling code.  Right now it is a real mess
 
 Consider allowing mkinstalldirs, mdate-sh, and others to be put in
 AC_CONFIG_AUX_DIR.  Maybe even ansi2knr?
@@ -202,6 +202,9 @@ building utility?  Must check.  maybe it would be possible to deal
 with all the different package utilities somehow.  Lately I've been
 hearing good things about the RedHat packaging utilities.  Why are
 there so many of these?  Are they fun to write or something?
+The RedHat package utility is called RPM; see
+       ftp://ftp.redhat.com/pub/code/rpm
+It actually has problems, like no configure script and no documentation.
 
 ================================================================
 
index 73d635a0198fae8d462607dd5387155f6bdd81c5..13e346c2e143424422465d5a752fdd01ca0d838d 100755 (executable)
@@ -39,10 +39,7 @@ $WHITE_PATTERN = "^[ \t]*\$";
 $COMMENT_PATTERN = "^#";
 $RULE_PATTERN = "^([a-zA-Z_.][-.a-zA-Z0-9_.]*) *:";
 $MACRO_PATTERN = "^([A-Za-z][A-Za-z0-9_]*)[ \t]*=[ \t]*(.*)\$";
-
-# Valid syntax for a derived object, eg a program name.  This must
-# satisfy both the filesystem and make.
-$OBJECT_PATTERN = "^[A-Za-z_][-+.A-Za-z_0-9]+\$";
+$BOGUS_MACRO_PATTERN = "^([^ \t]*)[ \t]*=[ \t]*(.*)\$";
 
 # Constants to define the "strictness" level.
 $FOREIGN = 0;
@@ -605,25 +602,41 @@ sub handle_programs
     return if ! @proglist;
 
     local ($obj) = &get_object_extension;
-    local ($one_file, $munge);
+    local ($one_file, $xname, $munge);
 
     foreach $one_file (@proglist)
     {
-       &handle_source_transform ($one_file, $obj);
+       # Canonicalize names.
+       ($xname = $one_file) =~ tr/A-Za-z0-9_/_/c;
+       if ($xname ne $one_file)
+       {
+           local ($xt);
+           foreach $xt ('_LDADD', '_SOURCES', '_OBJECTS', '_DEPENDENCIES')
+           {
+               &am_line_error ($one_file . $xt,
+                               "invalid variable \`" . $one_file . $xt
+                               . "'; should be \`" . $xname . $xt . "'")
+                   if defined $contents{$one_file . $xt};
+           }
+       }
 
-       if (defined $contents{$one_file . "_LDADD"})
+       &handle_source_transform ($xname, $obj);
+
+       if (defined $contents{$xname . "_LDADD"})
        {
-           &handle_lib_objects ($one_file . '_LDADD');
+           &handle_lib_objects ($xname . '_LDADD');
        }
        else
        {
            # User didn't define prog_LDADD override.  So do it.
-           $output_vars .= $one_file . '_LDADD = $(LDADD)' . "\n";
+           $output_vars .= $xname . '_LDADD = $(LDADD)' . "\n";
        }
 
        $output_rules .=
-           &file_contents_with_transform ('s/\@PROGRAM\@/' . $one_file
-                                          . '/go', 'program');
+           &file_contents_with_transform
+               ('s/\@PROGRAM\@/' . $one_file . '/go;'
+                . 's/\@XPROGRAM\@/' . $xname . '/go;',
+                'program');
     }
 
     &handle_lib_objects ('LDADD')
@@ -2020,6 +2033,7 @@ sub read_am_file
     $comment = '';
     $spacing = "\n";
 
+    local ($is_ok_macro);
     while ($_)
     {
        if (/$IGNORE_PATTERN/o)
@@ -2069,9 +2083,9 @@ sub read_am_file
            $comment = $spacing = '';
            $saw_bk = /\\$/;
        }
-       elsif (/$MACRO_PATTERN/o)
+       elsif (($is_ok_macro = /$MACRO_PATTERN/o)
+              || /$BOGUS_MACRO_PATTERN/o)
        {
-           # warn "** Saw macro .$1.\n";
            # Found a macro definition.
            $was_rule = 0;
            $last_var_name = $1;
@@ -2087,6 +2101,10 @@ sub read_am_file
            $output_vars .= $comment . $spacing . $_;
            $comment = $spacing = '';
            $saw_bk = /\\$/;
+
+           # Error if bogus.
+           &am_line_error ($., "bad macro name \`$1'")
+               if ! $is_ok_macro;
        }
        else
        {
@@ -2444,17 +2462,13 @@ sub am_install_var
        if (defined $contents{$one_name})
        {
            # Append actual contents of where_PRIMARY variable to
-           # result.  Skip elements that look like configure
-           # substitutions.  Also, possibly check contents of
-           # variable for validity.
+           # result.
            local ($rcurs);
            foreach $rcurs (split (/\s+/, $contents{$one_name}))
            {
+               # Skip configure substitutions.  Possibly bogus.
                next if $rcurs =~ /^\@.*\@$/;
                push (@result, $rcurs);
-               &am_line_error ($one_name, "invalid object name \`$rcurs'")
-                   if $primary_uses_subobjects{$primary}
-                       && $rcurs !~ /$OBJECT_PATTERN/;
            }
 
            if ($do_clean)
@@ -2574,7 +2588,7 @@ sub require_file_internal
                }
                else
                {
-                   &am_conf_error
+                   &am_line_error
                        ($line, "required file \"$fullfile\" not found");
                }
            }
index 31062907210c208b4639f58ce346374023985065..d6fd37a2410d73fa08a2b562208f1bfaa5c9a1b7 100644 (file)
@@ -630,6 +630,20 @@ mt_SOURCES = @dots{}
 rmt_SOURCES = @dots{}
 @end example
 
+It is also occasionally useful to have a program depend on some other
+target which is not actually part of that program.  This can be done
+using the @samp{prog_DEPENDENCIES} variable.  Each program depends on
+the contents of such a variable, but no further interpretation is done.
+
+Since program names are rewritten into Makefile macro names, program
+names must follow Makefile macro syntax.  Sometimes it is useful to have
+a program whose name does not follow such rules.  In these cases,
+Automake canonicalizes the program name.  All characters in the name
+except for letters, numbers, and the underscore are turned into
+underscores when making macro references.  Eg, if your program is named
+@code{sniff-glue}, you would use @code{sniff_glue_SOURCES}, not
+@code{sniff-glue_SOURCES}.
+
 
 @node A Library
 @section Building a library
@@ -1216,6 +1230,7 @@ programs (@code{ctags} and @code{etags}) from the same source file
 bin_PROGRAMS = etags ctags
 ctags_SOURCES =
 ctags_LDADD = ctags.o
+ctags_DEPENDENCIES = ctags.o
 
 etags.o:
         $(COMPILE) -DETAGS_REGEXPS etags.c
@@ -1228,6 +1243,12 @@ Note that @code{ctags_SOURCES} is defined to be empty -- that way no
 implicit value is substituted.  The implicit value, however, is used to
 generate @code{etags} from @file{etags.o}.
 
+@code{ctags_LDADD} is used to get @file{ctags.o} into the link line,
+while @code{ctags_DEPENDENCIES} exists to make sure that @file{ctags.o}
+gets built in the first place.
+
+This is a somewhat pathological example.
+
 
 @node Automake
 @section Automake uses itself
index 089243eeb26e3fd8cd9a3c586fc388a539a98005..025248d80d40d70134bd3e778a534c52bbafee78 100644 (file)
@@ -15,5 +15,5 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
-@PROGRAM@: $(@PROGRAM@_OBJECTS)
+@PROGRAM@: $(@PROGRAM@_OBJECTS) $(@PROGRAM@_DEPENDENCIES)
        $(LINK) $(@PROGRAM@_OBJECTS) $(@PROGRAM@_LDADD) $(LIBS)
index 089243eeb26e3fd8cd9a3c586fc388a539a98005..025248d80d40d70134bd3e778a534c52bbafee78 100644 (file)
@@ -15,5 +15,5 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
-@PROGRAM@: $(@PROGRAM@_OBJECTS)
+@PROGRAM@: $(@PROGRAM@_OBJECTS) $(@PROGRAM@_DEPENDENCIES)
        $(LINK) $(@PROGRAM@_OBJECTS) $(@PROGRAM@_LDADD) $(LIBS)
index 205487c8840c91effc5466985c5c3e092cb234cb..455a9b0a9893fee79b55d60c4f229f8ca7e9ffaf 100644 (file)
@@ -1,3 +1,9 @@
+Tue Mar  5 16:22:46 1996  Tom Tromey  <tromey@creche.cygnus.com>
+
+       * badprog.test: Rewrote.
+
+       * canon.test: New file.
+
 Mon Mar  4 21:08:37 1996  Tom Tromey  <tromey@creche.cygnus.com>
 
        * exdir.test: New file.
index f36f32218c351fd666d9f0706e511c1dfca294dd..264c24020be7c05449e7630f0c44b28c4cd4f3a9 100644 (file)
@@ -4,6 +4,7 @@ AUTOMAKE_OPTIONS = gnits
 
 TESTS = mdate.test vtexi.test acoutput.test instexec.test checkall.test \
 acoutnoq.test acouttbs.test libobj.test proginst.test acoutqnl.test \
-confincl.test spelling.test prefix.test badprog.test depend.test exdir.test
+confincl.test spelling.test prefix.test badprog.test depend.test exdir.test \
+canon.test
 
 EXTRA_DIST = defs
index 9f0d76b87821cfb74620bba4766b1967b649d5fa..055191bad496dc415ae44007218d8061736257e7 100644 (file)
@@ -42,7 +42,8 @@ AUTOMAKE_OPTIONS = gnits
 
 TESTS = mdate.test vtexi.test acoutput.test instexec.test checkall.test \
 acoutnoq.test acouttbs.test libobj.test proginst.test acoutqnl.test \
-confincl.test spelling.test prefix.test badprog.test depend.test exdir.test
+confincl.test spelling.test prefix.test badprog.test depend.test exdir.test \
+canon.test
 
 EXTRA_DIST = defs
 DIST_COMMON = ChangeLog Makefile.am Makefile.in
index 69670c9ee0abddc853936d07c22d8f36ed3cf873..5e35b8e8f939c8cca4f0d66bd8b726915375b975 100755 (executable)
@@ -1,12 +1,13 @@
 #! /bin/sh
 
-# Test to make sure that programs with bad names are diagnosed.
+# Test to make sure that programs with bad names are properly
+# transformed.
 
 . $srcdir/defs || exit 1
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = a,b
+a_b_SOURCES = ab.c
 END
 
-$AUTOMAKE && exit 1
-exit 0
+$AUTOMAKE
diff --git a/tests/canon.test b/tests/canon.test
new file mode 100755 (executable)
index 0000000..9910c43
--- /dev/null
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+# Test to make sure that name canonicalization error works.
+
+. $srcdir/defs || exit 1
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = sniff-glue
+sniff-glue_SOURCES = sg.c
+END
+
+$AUTOMAKE && exit 1
+exit 0
index c1545599b2fae0ed2aa2f78d5a62559dc3dce9cb..a3cf0de77d307256785f55d5102d1f9f1708055d 100644 (file)
@@ -1,3 +1,3 @@
-@set UPDATED 4 March 1996
+@set UPDATED 5 March 1996
 @set EDITION 0.31
 @set VERSION 0.31