]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Better de-ansification handling
authorTom Tromey <tromey@redhat.com>
Sat, 16 Nov 1996 05:35:55 +0000 (05:35 +0000)
committerTom Tromey <tromey@redhat.com>
Sat, 16 Nov 1996 05:35:55 +0000 (05:35 +0000)
ChangeLog
TODO
automake.in
tests/ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/ansi2.test [new file with mode: 0755]

index 32ab1cebcce515259bc0b9c8edccead29793fee1..9f34d08f394b7f8404d889d205dc6445bb82c474 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Fri Nov 15 18:58:04 1996  Tom Tromey  <tromey@cygnus.com>
+
+       * automake.in (initialize_per_input): Init de_ansi_objects.
+       (handle_single_transform_list): Error if extension unrecognized.
+       Set elements of de_ansi_objects.
+       (get_object_extension): Don't push ANSI2KNR onto @all.
+       (handle_yacc_lex_cxx): Put ANSI2KNR into dependency of all ._o
+       files.
+       (pretty_print_internal): Initialize $bol depending on the column.
+
 Fri Nov 15 16:22:15 1996  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
 
        * library.am: Fixed references to LIBRARY according to new scheme.
diff --git a/TODO b/TODO
index f5f613f5bd953228d7762a2f1f2466b04bc897ae..4299262ff6c393230b0f0ed7211604b8d015487c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -9,10 +9,6 @@ Priorities for release:
 
 * clean up source directory by moving stuff into subdirs
 
-!! foo_LIBRARIES = @JOE@  ->  _LIBFILES is wrong
-   [ have implemented temporary fix, but something better must be done
-     probably do Gord's idea ]
-
 !! EXTRA_FOO should not be allowed to contain automake interpolations
    the whole point of this variable is so automake can statically know...
    This should probably be true for all EXTRA_ variables
index c43d0d79483abeed6ff1d857cb337da773846e45..d00ae1b9084e0e0aec86ac6a0799cfce2a7bc59d 100755 (executable)
@@ -654,7 +654,6 @@ sub get_object_extension
                # Substitution from AM_C_PROTOTYPES.  This makes it be
                # built only when necessary.
                &define_configure_variable ('ANSI2KNR');
-               push (@all, '$(ANSI2KNR)');
            }
 
            $output_rules .= &file_contents ('compile-kr');
@@ -759,6 +758,17 @@ sub handle_yacc_lex_cxx
        }
     }
 
+    #
+    # Handle some ansi2knr cleanup.
+    #
+    if (defined $options{'ansi2knr'} && keys %de_ansi_objects)
+    {
+       # Make all ._o files depend on ansi2knr.  Use a sneaky little
+       # hack to make it print nicely.
+       &pretty_print_rule ('', '', (keys %de_ansi_objects,
+                                    ':', '$(ANSI2KNR)'));
+    }
+
     #
     # Last, handle some C cleanup.
     #
@@ -865,22 +875,29 @@ sub handle_single_transform_list
            {
                # FORTRAN support.  FIXME: not finished.
            }
-           else
+           elsif (s/\.[clysmM]$/._o/)
            {
-               # C, yacc, and lex need special $obj extension, for
-               # de-ansification.  Hopefully someday this will go
-               # away.
-               s/\.[cly]$/$obj/g;
+               # .c is C.  .l is lex.  .y is yacc.  .s is assembly.
+               # .M is Objective-C++.  .m is Objective-C.
 
-               # .s is assembly.  .M is Objective-C++.  .m is
-               # Objective-C.
-               s/\.[smM]$/$obj/g;
+               # Note: first we rewrite (eg) foo.c to foo._o and push
+               # the file onto the list of objects that require
+               # ansi2knr.  Then we rewrite ._o to $obj; $obj can be
+               # simply `.o' if deansification is not really
+               # required.
+               $de_ansi_objects{$_} = 1;
+               s/\._o$/$obj/;
 
                # FIXME: of course, this should only happen for C
                # source.  The multi-language support must really be
                # cleaned up more globally.
                $seen_c_source = 1;
            }
+           else
+           {
+               # FIXME include line number in error.
+               &am_error ("file \`$_' has unrecognized extension");
+           }
 
            push (@result, $_);
 
@@ -3279,7 +3296,7 @@ sub pretty_print_internal
     local ($fill_length) = length ($fill);
     $fill_length += 7 * ($fill =~ tr/\t/\t/d);
 
-    local ($bol) = 0;
+    local ($bol) = ($head eq '');
     foreach (@values)
     {
        # "71" because we also print a space.
@@ -3846,6 +3863,10 @@ sub initialize_per_input
 
     # This is a list of all targets to run during "make dist".
     @dist_targets = ();
+
+    # Keys in this hash are the names of ._o files which must depend
+    # on ansi2knr.  Ugh.
+    %de_ansi_objects = ();
 }
 
 
index 7b6527a9b50ecf916731a12a4e251fd48e87d2d0..52c746123a099c6717f6ab817d59eceda6f50466 100644 (file)
@@ -1,5 +1,7 @@
 Fri Nov 15 00:09:18 1996  Tom Tromey  <tromey@cygnus.com>
 
+       * ansi2.test: New file.
+
        * libfiles.test: Removed (obsolete).
 
        * libobj.test, canon4.test, libobj2.test, alllib.test,
index 4263d4df4b855c7b5331cccebd9e17465fdc0b5b..be82523e5b0a662e24cfb4fa302af96aa70aa756 100644 (file)
@@ -10,7 +10,7 @@ target.test extra.test noinst.test instman.test mkinstall.test auxdir.test \
 canon3.test mdate2.test subdir.test backsl.test package.test number.test \
 insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \
 yacc.test mkinst2.test texinfo2.test ansi.test depacl.test depacl2.test \
-error.test colon.test vtexi2.test tags.test comment.test \
+error.test colon.test vtexi2.test tags.test comment.test ansi2.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 interp.test alllib.test block.test libobj3.test \
index 05c2ceb3afa2fc45408e190da0a0e7a08774961a..7e5bf2dfd05e8fa7c18fa06201a99afc2d633d71 100644 (file)
@@ -49,7 +49,7 @@ target.test extra.test noinst.test instman.test mkinstall.test auxdir.test \
 canon3.test mdate2.test subdir.test backsl.test package.test number.test \
 insh2.test outdir.test fpinstall.test fpinst2.test texinfo.test dejagnu.test \
 yacc.test mkinst2.test texinfo2.test ansi.test depacl.test depacl2.test \
-error.test colon.test vtexi2.test tags.test comment.test libfiles.test \
+error.test colon.test vtexi2.test tags.test comment.test ansi2.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 interp.test alllib.test block.test libobj3.test \
diff --git a/tests/ansi2.test b/tests/ansi2.test
new file mode 100755 (executable)
index 0000000..c823822
--- /dev/null
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+# Test to make sure ansi2knr built at the right time.
+
+. $srcdir/defs || exit 1
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = ansi2knr
+bin_PROGRAMS = joe
+END
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_C_PROTOTYPES
+END
+
+: > ansi2knr.c
+: > ansi2knr.1
+
+$AUTOMAKE || exit 1
+
+grep '^joe._o.*:.*ANSI2KNR' Makefile.in