]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* automake.in (lang_yacc_finish): Generate and dist a `.h' for a
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Sat, 10 Apr 1999 00:48:27 +0000 (00:48 +0000)
committerAlexandre Oliva <oliva@dcc.unicamp.br>
Sat, 10 Apr 1999 00:48:27 +0000 (00:48 +0000)
`.y' iff YFLAGS or AM_YFLAGS contain `-d'.
Reported by Jim Meyering <meyering@ascend.com>

ChangeLog
automake.in

index b0ab4ea2869e087cf04c747e98e945407dd0f061..4d40113fef3513d606716ba47d37628a8a2a5d11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 1999-04-10  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
+       * automake.in (lang_yacc_finish): Generate and dist a `.h' for a
+       `.y' iff YFLAGS or AM_YFLAGS contain `-d'.
+       Reported by Jim Meyering <meyering@ascend.com>
+
        * automake.in (lang_yacc_finish): $hname must not contain a `.'.
 
 1999-04-10  Tom Tromey  <tromey@cygnus.com>
index eb7796bc42c2027d94d8a70234295b7246fecb8c..e311c33525e1bb6b6c8c900405592565dba5a285 100755 (executable)
@@ -4773,22 +4773,30 @@ sub lang_yacc_finish
            if ! defined $seen_suffix{$1};
        $seen_suffix{$1} = 1;
 
-       # Now generate rule to make the header file.  This should only
-       # be generated if `yacc -d' specified.  But right now there is
-       # no way to determine that.  FIXME: examine AM_YFLAGS?
        $file =~ /^(.*)\.(y|yy|y\+\+|yxx|ypp)$/;
        $base = $1;
        $hname = 'h';           # Always use `.h' for header file.
        ($cname = $2) =~ tr/y/c/;
-       $output_rules .= "${base}.${hname}: ${base}.${cname}\n";
 
-       # If the files are built in the build directory, then we want
-       # to remove them with `make clean'.  If they are in srcdir
-       # they shouldn't be touched.  However, we can't determine this
-       # statically, and the GNU rules say that yacc/lex output files
-       # should be removed by maintainer-clean.  So that's what we
-       # do.
-       push (@maintainer_clean_files, "${base}.${hname}", "${base}.${cname}");
+       if ((&variable_defined ('AM_YFLAGS')
+            && &variable_value ('AM_YFLAGS') =~ /(^|\s)-d(\s|$)/)
+           || (&variable_defined ('YFLAGS')
+               && &variable_value ('YFLAGS') =~ /(^|\s)-d(\s|$)/)) {
+           # Now generate rule to make the header file.  This should only
+           # be generated if `yacc -d' specified.
+           $output_rules .= "${base}.${hname}: ${base}.${cname}\n";
+
+           # If the files are built in the build directory, then we want
+           # to remove them with `make clean'.  If they are in srcdir
+           # they shouldn't be touched.  However, we can't determine this
+           # statically, and the GNU rules say that yacc/lex output files
+           # should be removed by maintainer-clean.  So that's what we
+           # do.
+           push (@maintainer_clean_files, "${base}.${hname}");
+
+           push_dist_common ("${base}.${hname}");
+       }
+       push (@maintainer_clean_files, "${base}.${cname}");
     }
     $output_rules .= "\n";
 
@@ -6555,7 +6563,7 @@ sub initialize_per_input
     # Sources which go in the distribution.
     @dist_sources = ();
 
-    # This hash maps object file names onto their corresopnding source
+    # This hash maps object file names onto their corresponding source
     # file names.  This is used to ensure that each object is created
     # by a single source file.
     %object_map = ();