From: Tom Tromey Date: Wed, 6 Mar 1996 00:29:35 +0000 (+0000) Subject: Bug fixes X-Git-Tag: Release-0-31~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af56fbcaa47484051b61432b2524d2f4de508e01;p=thirdparty%2Fautomake.git Bug fixes --- diff --git a/ChangeLog b/ChangeLog index 37294696e..322ef8fa2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Tue Mar 5 16:12:04 1996 Tom Tromey + + * 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 * automake.in (handle_lib_objects): New function. diff --git a/NEWS b/NEWS index fcf1f372d..b023e24c1 100644 --- 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 New in 0.30: * Bug fixes diff --git a/TODO b/TODO index df1ab4761..4a513a334 100644 --- 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. ================================================================ diff --git a/automake.in b/automake.in index 73d635a01..13e346c2e 100755 --- a/automake.in +++ b/automake.in @@ -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"); } } diff --git a/automake.texi b/automake.texi index 310629072..d6fd37a24 100644 --- a/automake.texi +++ b/automake.texi @@ -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 diff --git a/lib/am/program.am b/lib/am/program.am index 089243eeb..025248d80 100644 --- a/lib/am/program.am +++ b/lib/am/program.am @@ -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) diff --git a/program.am b/program.am index 089243eeb..025248d80 100644 --- a/program.am +++ b/program.am @@ -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) diff --git a/tests/ChangeLog b/tests/ChangeLog index 205487c88..455a9b0a9 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +Tue Mar 5 16:22:46 1996 Tom Tromey + + * badprog.test: Rewrote. + + * canon.test: New file. + Mon Mar 4 21:08:37 1996 Tom Tromey * exdir.test: New file. diff --git a/tests/Makefile.am b/tests/Makefile.am index f36f32218..264c24020 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 diff --git a/tests/Makefile.in b/tests/Makefile.in index 9f0d76b87..055191bad 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 diff --git a/tests/badprog.test b/tests/badprog.test index 69670c9ee..5e35b8e8f 100755 --- a/tests/badprog.test +++ b/tests/badprog.test @@ -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 index 000000000..9910c4303 --- /dev/null +++ b/tests/canon.test @@ -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 diff --git a/version.texi b/version.texi index c1545599b..a3cf0de77 100644 --- a/version.texi +++ b/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 4 March 1996 +@set UPDATED 5 March 1996 @set EDITION 0.31 @set VERSION 0.31