> From: Paul Smith <psm...@gnu.org> > Cc: bug-make@gnu.org > Date: Sun, 28 Apr 2013 15:15:09 -0400 > > The goal of this code in the if-statement is to implement a special case > allowing ONESHELL to be easier to add in the case where you DO have a > standard shell. In that case, and ONLY in that case, we remove the > internal @-+ characters. This allows you to have something like: > > foo: > @echo hi > @echo there > @echo how are you > > And have it continue to work if you add ONESHELL (for performance > reasons) without rewriting all the recipes.
I understand that much. > However, if you do NOT have a POSIX shell, then we do NOT remove these > internal characters: we simply provide the script as-is and only the > first line is checked for special characters. This lets you use > something like Perl, where @ is a special character, for example: > > SHELL = /usr/bin/perl > foo: > @print "hi"; > @array = qw(there how are you); > print "@array\n"; This is not yet supported on MS-Windows. We currently only support either a Bourne-compatible shell or the stock Windows shells, command.com and cmd.exe. And the Windows shells don't need these characters, so it is OK to remove them as in the case of a Posix shell. > I think the implementation you have is not quite right. I think the > parsing of the @-+ stuff is common across all platforms if we have a > shell, so you don't need the "else /* non-posix shell */". I do need a separate code, because it doesn't just remove the @-+ stuff, it also removes escaped newlines, so that this: foo && \ bar && \ baz is transformed into a single line foo && bar && baz That's because stock Windows shells don't know about escaped newlines. I also remove leading whitespace from each logical line, while at that, because I don't want to rely on Windows shells too much (some of their internal commands are quite weird). > I think it pseudo-code it would look something like this: > > if (posix-shell) > { > ...strip out @-+ from LINE... > } > #ifdef WINDOWS32 > if (need a batch file) > { > ...write LINE to the batch file & setup new_argv for batch... > } > else > #endif > { > ...chop LINE up into new_argv... > } > return new_argv; > > Or something. I will take a look. > Also, I'm not sure about adding things like @echo off to the batch > file. That assumes that we'll always be using command.com to run > the batch file, but what if the user specified C:/perl/bin/perl.exe > or something as their SHELL? This is not supported yet; if the user tries that, @echo off will be the least of their problems ;-) _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make