From: Alexandre Oliva Date: Sat, 10 Apr 1999 00:48:27 +0000 (+0000) Subject: * automake.in (lang_yacc_finish): Generate and dist a `.h' for a X-Git-Tag: last-merge-into-user-dep-gen-branch~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1272c682e69f9d21f71d14505b07c4bbeef9d9c;p=thirdparty%2Fautomake.git * automake.in (lang_yacc_finish): Generate and dist a `.h' for a `.y' iff YFLAGS or AM_YFLAGS contain `-d'. Reported by Jim Meyering --- diff --git a/ChangeLog b/ChangeLog index b0ab4ea28..4d40113fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 1999-04-10 Alexandre Oliva + * automake.in (lang_yacc_finish): Generate and dist a `.h' for a + `.y' iff YFLAGS or AM_YFLAGS contain `-d'. + Reported by Jim Meyering + * automake.in (lang_yacc_finish): $hname must not contain a `.'. 1999-04-10 Tom Tromey diff --git a/automake.in b/automake.in index eb7796bc4..e311c3352 100755 --- a/automake.in +++ b/automake.in @@ -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 = ();