automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: do not distributed parse.h when nodist_foo_SOURCES = parse.y


From: Alexandre Duret-Lutz
Subject: FYI: do not distributed parse.h when nodist_foo_SOURCES = parse.y
Date: Wed, 14 Jul 2004 16:48:52 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

I'm installing this fix for a longstanding FIXME.

The DIST_SOURCE substitution should also be useful to Derek's scheme
to disable lex/yacc rebuild rules in maintainer-mode (since these should
be disabled only when DIST_SOURCE is true).

2004-07-14  Alexandre Duret-Lutz  <address@hidden>

        * 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.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1564
diff -u -r1.1564 automake.in
--- automake.in 11 Jul 2004 22:07:22 -0000      1.1564
+++ automake.in 14 Jul 2004 14:43:11 -0000
@@ -112,7 +112,7 @@
     }
 }
 
-sub target_hook ($$$$)
+sub target_hook ($$$$%)
 {
     my ($self) = @_;
     if (defined $self->_target_hook)
@@ -1724,7 +1724,7 @@
        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 @@
                                         $xpfx . $one_file . '_OBJECTS',
                                         $prefix =~ /EXTRA_/,
                                         $one_file, $obj, $varname, $where,
+                                        DIST_SOURCE => ($prefix !~ /^nodist_/),
                                         %transform);
     }
     if ($needlinker)
@@ -5239,7 +5240,7 @@
 # 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 @@
        # 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 @@
                              . "$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
Index: tests/pr204.test
===================================================================
RCS file: /cvs/automake/automake/tests/pr204.test,v
retrieving revision 1.6
diff -u -r1.6 pr204.test
--- tests/pr204.test    14 Nov 2003 21:25:59 -0000      1.6
+++ tests/pr204.test    14 Jul 2004 14:43:11 -0000
@@ -39,6 +39,7 @@
 # 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 @@
 $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

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]