[dropping automake list] Hello Ralf. I've just a couple of very minor nits/questions ...
On Friday 01 April 2011, Ralf Wildenhues wrote: > > 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. > Shouldn't NEWS be updated too? Or is the bugfix too small to warrant that? > 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 () > Isn't the linebreak after "int" an overkill here? Also, if you really want to follow the GNU standards even in testcase data, shouldn't "main" have a full prototype like "int main (void)"? (in that case, you might want to fix the "yywrap" prototype below too). > +{ > + while (yylex () != EOF) > + ; > + Why this extra blank line? I really have no problem with it, but since you seem to prefer not to waste vertical space uselessly, I decided to point out this minor inconsistency. Feel free to ignore it, though. > + 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 > + > +: > > Thanks, Stefano