From e87c030d838a0c649239c9d2a632c1b2415852a0 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sat, 2 Apr 2011 11:09:10 +0200 Subject: [PATCH] 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. Signed-off-by: Ralf Wildenhues --- ChangeLog | 10 +++++++ THANKS | 1 + automake.in | 9 ++++++ tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/lex-subobj-nodep.test | 73 +++++++++++++++++++++++++++++++++++++++++++++ tests/yacc5.test | 11 ++++--- 7 files changed, 102 insertions(+), 4 deletions(-) create mode 100755 tests/lex-subobj-nodep.test diff --git a/ChangeLog b/ChangeLog index 7391900..c3ce897 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2011-04-02 Ralf Wildenhues + 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 --- 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 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 bfa8edf..35cbbd0 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/Makefile.in b/tests/Makefile.in index ed89d07..c0bbfff 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 0000000..4449715 --- /dev/null +++ b/tests/lex-subobj-nodep.test @@ -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 . + +# 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 + +: diff --git a/tests/yacc5.test b/tests/yacc5.test index 8b00ed8..f428396 100755 --- a/tests/yacc5.test +++ b/tests/yacc5.test @@ -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 + +: -- 2.7.4