Re: [PATCH] build: assign extra flags to ALL_CFLAGS instead of CFLAGS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 18, 2017 at 6:47 PM, Jeff Layton <jlayton@xxxxxxxxxxxxxxx> wrote:
>
> No, it wasn't intentional. Could we just turn that into a +=
> assignment?

No, turn that into += does not work either. The variable come from
command line has the $(origin varname) set to "command line".
make will ignore normal modification to that variable, including "+="

If you really need to make modification of that variable.
You need to use the "override" directive.

https://www.gnu.org/software/make/manual/make.html

     6.7 The override Directive

override CFLAGS += "...."

For that reason, I would suggest using a different variable
to assign from the command line.

>
> Got it, thanks. Basically I just need a way to pass in a basic set of
> flags to gcc, that are either appended or prepended to whatever you
> need to have in there. If we need to call it something other than
> CFLAGS, then that's fine.

Right. Given any makefile, I can always pick some internal variable,
assign that variable from command line, then the make process does
not work as intended. In our case, CFLAGS is such a variable.

I would suggest have one variable like CFLAGS_CMD to get
overwrite from command line. You can suggest the variable name.

You should also examine your rpmbuild script for other open
source packages. Weather they suffer from the same CFLAGS overwrite
problems.

Again, patch is welcome.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux