At Sunday 08 August 2010, Ralf Wildenhues wrote: > * Stefano Lattarini wrote on Sun, Aug 08, 2010 at 05:09:03PM CEST: > > At Sunday 08 August 2010, Ralf Wildenhues wrote: > > > tgt1 tgt2 \ > > > > > > tgt3 : dep1 dep2 \ > > > dep3 \ > > > > > > dep4 > > > > > > Posix is perfectly clear about the list of targets > > > > Should be "tgt1 tgt2 tgt3 tgt4", right? > > Yes; well, there is non tgt4 in my example. ;-) > > > > and the list of dependencies. > > > > Should be "dep1 dep2 dep3 dep4", right? > > Yep. And except for the initial one of the two spaces before tgt1, > all whitespace can contain either spaces or tabs. > > > > extract_makefile_deps can extract that. > > > > I still don't understand how this qualifies as an objection to my > > proposal. > You proposed to introduce a complex perl script. I objected that, > if we're going to introduce something complex, might as well > introduce something that more correctly parses make syntax then. > And sed, of course, since perl is hard to read. ;-) Your perl > script won't parse the above example right. automake is free to > create constructs such as the above, because every 'make' > implementation *will* parse it correctly, so it would not be a bug > in automake if it created such code. (Could be a QoI issue, but > that's a different matter.) > Have I managed to completely confuse you now? ;-) I have to say that I agree (apart from the use of sed obviously ;-), because it turns out that we are speaking about two rather different issues.
Here, I'm *not* defending my perl script -- please, let's just forget about it from now on, it's irrelevant. I'm just saying that when we'll write the `extract_makefile_deps' function, it shouldn't bother with preserving tabs and backslashes; on the other hand, it should actively normalize them to space in order to simplify grepping and matching of the extracted info. So that, with your example below, something like: foo=`extract_makefile_deps tgt2 Makefile`; echo x"$foo"x should print: x dep1 dep2 dep3 dep4 x Have I managed to make my point now? If yes, what do you think of my proposal? Thanks, Stefano