Create subdirs for generated sources even when not dep tracking.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 2 Apr 2011 09:09:10 +0000 (11:09 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 2 Apr 2011 09:09:10 +0000 (11:09 +0200)
* automake.in (handle_single_transform): If $object is derived
and lands in subdir, be sure to output a dirstamp dependency.
* tests/yacc5.test: Avoid falsely matching the dirstamp
dependency when grepping for a rule.
* tests/lex-subobj-nodep.test: New test.
* tests/Makefile.am (TESTS): Update.
* THANKS: Update.
Report by Ignacy Gawedzki.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
THANKS
automake.in
tests/Makefile.am
tests/Makefile.in
tests/lex-subobj-nodep.test [new file with mode: 0755]
tests/yacc5.test

index 7391900..c3ce897 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2011-04-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       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/yacc5.test: Avoid falsely matching the dirstamp
+       dependency when grepping for a rule.
+       * tests/lex-subobj-nodep.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * THANKS: Update.
+       Report by Ignacy Gawedzki.
+
        Fix locale issue in check-exported-srcdir.test.
        * tests/check-exported-srcdir.test: Reformulate glob to not fail
        in a locale that ignores or interleaves character case.
diff --git a/THANKS b/THANKS
index 720cddd..040da98 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -131,6 +131,7 @@ Harlan Stenn                Harlan.Stenn@pfcs.com
 He Li                  tippa000@yahoo.com
 Henrik Frystyk Nielsen frystyk@w3.org
 Ian Lance Taylor       ian@cygnus.com
+Ignacy Gawedzki                i@lri.fr
 Илья Н. Голубев            gin@mo.msk.ru
 Imacat                 imacat@mail.imacat.idv.tw
 Inoue                  inoue@ainet.or.jp
index d56fbf7..d74730d 100755 (executable)
@@ -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;
          }
 
index bfa8edf..35cbbd0 100644 (file)
@@ -428,6 +428,7 @@ lex2.test \
 lex3.test \
 lex4.test \
 lex5.test \
+lex-subobj-nodep.test \
 lflags.test \
 lflags2.test \
 libexec.test \
index ed89d07..c0bbfff 100644 (file)
@@ -698,6 +698,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 (executable)
index 0000000..4449715
--- /dev/null
@@ -0,0 +1,73 @@
+#! /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 (void)
+{
+  while (yylex () != EOF)
+    ;
+  return 0;
+}
+
+int yywrap(void)
+{
+  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
+
+:
index 8b00ed8..f428396 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -42,7 +42,7 @@ mkdir sub
 $ACLOCAL
 $AUTOMAKE -a
 
-grep '^maude\.c:' Makefile.in
+grep '^maude\.c:.*maude\.y' Makefile.in
 
 
 ## Try again with subdir-objects.
@@ -56,8 +56,9 @@ END
 $ACLOCAL
 $AUTOMAKE -a
 
-# No rule needed, the default .y.c: inference rule is enough.
-grep '^sub/maude\.c:' Makefile.in && Exit 1
+# No rule needed, the default .y.c: inference rule is enough
+# (but there may be an additional dependency on a dirstamp file).
+grep '^sub/maude\.c:.*maude\.y' Makefile.in && Exit 1
 
 
 ## Try again with per-exe flags.
@@ -80,3 +81,5 @@ grep 'maudec' Makefile.in && Exit 1
 
 # Make sure the .o file is required.
 grep '^am_maude_OBJECTS.*maude' Makefile.in
+
+: