automake-patches
[Top][All Lists]
Advanced

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

Re: subdir-objects, dirstamps and --disable-dependency-tracking (bug!)


From: Ralf Wildenhues
Subject: Re: subdir-objects, dirstamps and --disable-dependency-tracking (bug!)
Date: Fri, 1 Apr 2011 13:22:26 +0200
User-agent: Mutt/1.5.20 (2010-08-04)

* Ignacy Gawedzki wrote on Wed, Mar 30, 2011 at 10:13:32AM CEST:
> On Wed, Mar 30, 2011 at 07:51:40AM +0200, thus spake Ralf Wildenhues:
> > * Ignacy Gawedzki wrote on Wed, Mar 30, 2011 at 12:03:09AM CEST:
> > > I suspect I found a bug in automake 1.11.1 .
> > 
> > Yes, you have.  Thanks for reporting it!
> 
> Shall I post that to address@hidden then?

That'd be prudent if we'd otherwise forget the bug.  Shouldn't be the
case here.

> > > Does anybody know of a clean fix/workaround?
> > 
> > Well, a workaround is to add the above line to your Makefile.am.
> 
> Can I reasonably assume that it won't break again when the bug is fixed at
> some point in the future?

You can assume that the workaround remains working.  It is very unlikely
that the dirstamp mechanism is changed.

Below is a proposed patch for maint.  It's not completely pretty, as it
adds some more code duplication in handle_single_transform, and it also
doesn't cause the most compact Makefile.in I can think of in all cases:
if the derived-sources rule happens to not be an inference rule, then
the dependency could be tacked right onto the rule.  That seems very
minor though.

The issue happens both with and without per-target compile flags, it's
just a lot less likely to be visible without them unless you explicitly
run 'make sub/foo.cc'.

Review appreciated.  Ignacy, OK to add your name to THANKS?
(make check is still running.)

Thanks,
Ralf

    Create subdirs for generated sources even when not dep tracking.
    
    * automake.in (handle_single_transform): If $object is derived
    and lands in subdir, be sure to output a dirstamp dependency.
    * tests/lex-subobj-nodep.test: New test.
    * tests/Makefile.am (TESTS): Update.
    * THANKS: Update.
    Report and initial test case by Ignacy Gawedzki.

diff --git a/automake.in b/automake.in
index d56fbf7..d74730d 100755
--- a/automake.in
+++ b/automake.in
@@ -2053,6 +2053,15 @@ sub handle_single_transform ($$$$$%)
            # derived from is not.
            &push_dist_common ($object)
              unless ($topparent =~ /^(?:nobase_)?nodist_/);
+
+           # If resulting derived source is in a subdir, we need to make
+           # sure the subdir exists at build time.
+           if ($object =~ /\//)
+             {
+               my $dirstamp = require_build_directory_maybe ($object);
+               depend ($object, $dirstamp)
+                 if ($dirstamp);
+             }
            next;
          }
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4becdbb..f095dd8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -428,6 +428,7 @@ lex2.test \
 lex3.test \
 lex4.test \
 lex5.test \
+lex-subobj-nodep.test \
 lflags.test \
 lflags2.test \
 libexec.test \
diff --git a/tests/lex-subobj-nodep.test b/tests/lex-subobj-nodep.test
new file mode 100755
index 0000000..c4c49ea
--- /dev/null
+++ b/tests/lex-subobj-nodep.test
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Ensure subdirs for subdir scanners are generated when subdir-objects
+# are used, even when dependency tracking is disabled.
+
+required=flex
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<\END
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+cat >Makefile.am <<\END
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = p1 p2
+p1_SOURCES = sub1/s1.l
+p2_SOURCES = sub2/s2.l
+p2_CPPFLAGS = -DWHATEVER
+END
+
+mkdir sub1 sub2
+
+cat >sub1/s1.l <<\END
+%%
+"END"   return EOF;
+.
+%%
+int
+main ()
+{
+  while (yylex () != EOF)
+    ;
+
+  return 0;
+}
+
+int yywrap() { return 0; }
+END
+
+cp sub1/s1.l sub2/s2.l
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+mkdir build
+cd build
+../configure --disable-dependency-tracking
+$MAKE sub1/s1.c
+$MAKE sub2/s2.c
+rm -rf sub1 sub2
+$MAKE
+
+:



reply via email to

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