Issue #8762 has been updated by tmm1 (Aman Gupta).


With my patch, provided CFLAGS are appended to the built-in flags. This follows the behavior most projects use with ./configure.

On trunk now, what is the correct way to add a CFLAG for build? (i.e. -Iextra/include/dir)?
----------------------------------------
Bug #8762: CFLAGS and LDFLAGS are not set properly in Makefile when they are already set as environment variables
https://bugs.ruby-lang.org/issues/8762#change-43492

Author: charliesome (Charlie Somerville)
Status: Rejected
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: 
Target version: current: 2.1.0
ruby -v: trunk
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


When the environment variable CFLAGS does not exist, running the ./configure script outputs this to the Makefile:

    # ./configure && grep ^CFLAGS Makefile
    ...configure output...
    CFLAGS = ${cflags} $(ARCH_FLAG)

However, setting the environment variable CFLAGS to anything (even the empty string) causes ${cflags} to not be included in the CFLAGS written to the Makefile:

    # CFLAGS= ./configure && grep ^CFLAGS Makefile
    ...configure output...
    CFLAGS =  $(ARCH_FLAG)

The same happens with LDFLAGS. I believe this is what is breaking trunk compilation for both myself and spastorino in #8759.


-- 
http://bugs.ruby-lang.org/