From 6e43608b8b55b3d64503c9ce386127f7183aece6 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sat, 10 Apr 1999 00:48:25 +0000 Subject: [PATCH] * automake.in (lang_yacc_finish): Generate and dist a `.h' for a `.y' iff YFLAGS or AM_YFLAGS contain `-d'. Reported by Jim Meyering --- ChangeLog | 4 ++++ automake.in | 32 ++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0ab4ea2..4d40113f 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 eb7796bc..e311c335 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 = (); -- 2.43.5