From f74dc248222ed5846282db4f14bf37bc0692657c Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Wed, 14 Jul 2004 14:49:09 +0000 Subject: [PATCH] * automake.in (target_hook): Accept %transform as last argument. (define_objects_from_sources): Pass %transform to target_hook. (handle_source_transform): Define DIST_SOURCE to tell whether a the source of a file is distributed or not. (lang_yacc_target_hook): Check DIST_SOURCE, and do not distribute the generated header if the .y source is not distributed. * tests/pr204.test: Use AM_YFLAGS = -d and make sure generated headers are not distributed. --- ChangeLog | 11 +++++++++++ automake.in | 14 +++++++++----- tests/pr204.test | 3 +++ 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45a415728..0c317ba71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-07-14 Alexandre Duret-Lutz + + * automake.in (target_hook): Accept %transform as last argument. + (define_objects_from_sources): Pass %transform to target_hook. + (handle_source_transform): Define DIST_SOURCE to tell whether + a the source of a file is distributed or not. + (lang_yacc_target_hook): Check DIST_SOURCE, and do not distribute + the generated header if the .y source is not distributed. + * tests/pr204.test: Use AM_YFLAGS = -d and make sure generated + headers are not distributed. + 2004-07-12 Simon Josefsson (tiny change) * doc/automake.texi (Options): Improve ustar file name length diff --git a/automake.in b/automake.in index 66f2a0230..186af6e65 100755 --- a/automake.in +++ b/automake.in @@ -112,7 +112,7 @@ sub finish ($) } } -sub target_hook ($$$$) +sub target_hook ($$$$%) { my ($self) = @_; if (defined $self->_target_hook) @@ -1724,7 +1724,7 @@ sub handle_single_transform ($$$$$%) if (defined $lang) { # Let the language do some special magic if required. - $lang->target_hook ($aggregate, $object, $full); + $lang->target_hook ($aggregate, $object, $full, %transform); } if ($derived_source) @@ -1902,6 +1902,7 @@ sub handle_source_transform ($$$$%) $xpfx . $one_file . '_OBJECTS', $prefix =~ /EXTRA_/, $one_file, $obj, $varname, $where, + DIST_SOURCE => ($prefix !~ /^nodist_/), %transform); } if ($needlinker) @@ -5239,7 +5240,7 @@ sub lang_c_finish # compile a yacc file. sub lang_yacc_target_hook { - my ($self, $aggregate, $output, $input) = @_; + my ($self, $aggregate, $output, $input, %transform) = @_; my $flag = $aggregate . "_YFLAGS"; my $flagvar = var $flag; @@ -5253,7 +5254,6 @@ sub lang_yacc_target_hook # Found a `-d' that applies to the compilation of this file. # Add a dependency for the generated header file, and arrange # for that file to be included in the distribution. - # FIXME: this fails for `nodist_*_SOURCES'. foreach my $cond (Automake::Rule::define (${header}, 'internal', RULE_AUTOMAKE, TRUE, INTERNAL)) @@ -5266,7 +5266,11 @@ sub lang_yacc_target_hook . "$condstr\t \$(MAKE) $output; \\\n" . "$condstr\telse :; fi\n"); } - &push_dist_common ($header); + # Distribute the generated file, unless its .y source was + # listed in a nodist_ variable. (&handle_source_transform + # will set DIST_SOURCE.) + &push_dist_common ($header) + if $transform{'DIST_SOURCE'}; # If the files are built in the build directory, then we want # to remove them with `make clean'. If they are in srcdir diff --git a/tests/pr204.test b/tests/pr204.test index a0e6705fa..26c861110 100755 --- a/tests/pr204.test +++ b/tests/pr204.test @@ -39,6 +39,7 @@ EOF # sure Automake match 'nodist_' against the right # variable name... cat > Makefile.am << 'EOF' +AM_YFLAGS = -d EXTRA_PROGRAMS = foo PARSE2 = parse2.y nodist_foo_SOURCES = parse.y $(PARSE2) @@ -62,7 +63,9 @@ $AUTOMAKE -a $MAKE distdir test -f pr204-0.1/parse.c && exit 1 test -f pr204-0.1/parse.y && exit 1 +test -f pr204-0.1/parse.h && exit 1 test -f pr204-0.1/parse2.c && exit 1 test -f pr204-0.1/parse2.y && exit 1 +test -f pr204-0.1/parse2.h && exit 1 # Make sure parse.c and parse2.c are still targets. $MAKE parse.c parse2.c -- 2.47.2