+2004-07-14 Alexandre Duret-Lutz <adl@gnu.org>
+
+ * 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 <jas@extundo.com> (tiny change)
* doc/automake.texi (Options): Improve ustar file name length
}
}
-sub target_hook ($$$$)
+sub target_hook ($$$$%)
{
my ($self) = @_;
if (defined $self->_target_hook)
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)
$xpfx . $one_file . '_OBJECTS',
$prefix =~ /EXTRA_/,
$one_file, $obj, $varname, $where,
+ DIST_SOURCE => ($prefix !~ /^nodist_/),
%transform);
}
if ($needlinker)
# 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;
# 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))
. "$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
# 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)
$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