> 2)    POSIX defines a way to forward command line macro=name
>       macro definitions to sub-make programs (make programs
>       called by the current make program) since at least 10
>       years.

http://www.opengroup.org/onlinepubs/9699919799/

Interesting.  There doesn't seem to be an option
to enable this behavior in a POSIX-conforming make
utility.  It always passes make variables to nested
makes.  So if we did this in the default make
binary it would be incompatible with some existing
Makefiles.  In the context of OpenSolaris, I'd still
be in favor of this kind of change, I think it's a big
step forwards.

On Solaris 10, there is /usr/xpg4/bin/make, which
presumably has this behavior.  But I don't see
that binary in the OpenSolaris repo.

I'll file an RFE to add this behavior under a flag
to the normal make utility on Solaris.

--chris




Joerg Schilling wrote:
> Chris Quenelle <Chris.Quenelle at sun.com> wrote:
> 
>> Joerg Schilling wrote:
>>> 2)  POSIX defines a way to forward command line macro=name
>>>     macro definitions to sub-make programs (make programs
>>>     called by the current make program) since at least 10 
>>>     years.
>>>
>>>     GNU Make implements this feature since about 15 years and
>>>     smake implements this feature since 10 years.
>>>
>>>     When whill Sun make implement this feature?
>>>
>>>     Most reasons to patch makefiles from OSS packages will go
>>>     away in case that command line macro=name definitions
>>>     are forwarded to sub-makes. You just need to overwrite the
>>>     values from the top level ake command line.
>> I'm not familiar with this feature.  I'm also not familiar with
>> feature of GNU make.  I use a mechanism like this
>> to achieve the same result in Sun make Makefiles.
>>
>>
>> In my Makefiles I do this:
>>
>> ENVPARMS=\
>>      CC=$(CC) \
>>      LINT=$(LINT) \
>>      ...
>>
>> targ:
>>      $(MAKE) $(ENVPARMS) ...
> 
> This is a bad hack as it only works for known macros that always have a
> predefined value != "".
> 
> The POSIX standard describes how to do it, you don't neet to look into the 
> unreadable GNU make source ;-)
> 
> You append " -- " to MAKEFLAGS from within the make C code.
> 
> You append a cleanly correct escaped macro=name list to this
> and you need to parse this list with the right precedence in the sub make.
> You may check the smake source for more help....
> 
> smake -f /dev/null -r -p FOO=123 'BAR=1 2 3 \se' XX=qq |grep MAKEF
> 
> MAKEFLAGS  =    -pr -- FOO=123 BAR=1\ 2\ 3\ \\se XX=qq 
> 
> J?rg
> 

Reply via email to