Re: patch for .SHELLFLAGS and .POSIX
Paul Smith <[email protected]>
| Newsgroups | gmane.comp.gnu.make.devel |
|---|---|
| Organization | GNU's Not Unix! |
| Message-ID | <[email protected]> |
On Fri, 2009-10-02 at 22:16 -0400, David Boyce wrote: > The attached little patch appears to add the .SHELLFLAGS feature with > .POSIX interaction as previously discussed: > > % cat MF > .PHONY: all > .POSIX: > all: > @echo SHELLFLAGS=$(.SHELLFLAGS) > @false; echo NOT POSIX BEHAVIOR > > % ./make -f MF > SHELLFLAGS=-ec > make: *** [all] Error 255 > > Please let me know if and where it falls short. Looks about right. One open question is, what do we do about the $(shell ...) function? Do we use the value of $(SHELL) $(.SHELLFLAGS) for this? Or just always use /bin/sh -c? I can see arguments both ways. If we go with the former than probably we need to move the setting of .SHELLFLAGS so that the default value is set before we start parsing makefiles (for $(shell ...) functions expanded during makefile read-in), and reset it when posix_pedantic is set. One concern is whether we should support expanding of .SHELLFLAGS; this version just takes the value verbatim (doesn't it?) What if someone wanted to do something like: .SHELLFLAGS = -$(if $(DEBUG),x)c or something like that? The other thing is replacing "-" with "/" on OS/2. I wonder if we should not bother to do that, at least not for values that the user sets. That is, for the default value setting we can use /c if __EMX__ is defined, but after that we just use whatever is in .SHELLFLAGS verbatim; if the user sets that value then they can figure out what it should be. Automatically modifying values like this makes me very uncomfortable in general. I don't think you need to set the "special" flag on .SHELLFLAGS. This is a marker to GNU make that there is something about this variable that needs to be addressed as soon as the variable is set: for example, .POSIX needs to set the posix_pedantic flag etc. -- ------------------------------------------------------------------------------- Paul D. Smith <[email protected]> Find some GNU make tips at: http://www.gnu.org http://make.mad-scientist.net "Please remain calm...I may be mad, but I am a professional." --Mad Scientist