On Thu, Feb 10, 2011 at 3:13 AM, Jonathan Wakely <jwakely....@gmail.com> wrote:
> On 10 February 2011 05:18, Quentin Neill wrote:
>> On Wed, Feb 9, 2011 at 2:42 AM, Jonathan Wakely <jwakely....@gmail.com> 
>> wrote:
>>> On 9 February 2011 08:34, Sebastian Pop wrote:
>>>>
>>>> For example x264 defines CFLAGS="-O4 -ffast-math $CFLAGS", and so
>>>> building this benchmark with CFLAGS="-O2" would have no effect.
>>>
>>> Why not?
>>>
>>> Ignoring the fact -O3 is the highest level for GCC, the manual says:
>>> "If you use multiple -O options, with or without level numbers, the
>>> last such option is the one that is effective."
>>> http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
>>>
>>> And CFLAGS="-fno-fast-math -O2" would cancel the effects of -ffast-math too.
>>>
>> Because the makefile can override CFLAGS in the environment (or in a
>> make variable) at any time, and GCC wouldn't even see it.
>
> Yes, I know how make works, but the example Sebastian gave is a case
> where CFLAGS from the command-line or environment will be appended to
> the make variable, allowing the default compiler flags to be
> overridden.  Obviously not all makefiles are written that way
> (although most aren't written like your example either) but I was
> referring to a specific case.

Sorry for assuming.

I assumed make variables, I looked at
CFLAGS="-O4 -ffast-math $CFLAGS"
and in my mind I saw
CFLAGS="-O4 -ffast-math $(CFLAGS)"

(If it's env var it should be CFLAGS="-O4 -ffast-math $$CFLAGS")
-- 
Quentin

Reply via email to