Prarit Bhargava <prarit(a)redhat.com> writes:
> So this papers over the real problem. I looked at the Makefile
and wonder why
> CFLAGS wasn't being passed over even with "override" being used to
append the
> flags. Seems the real problem is that the updated CFLAGS aren't being passed
> to the submake used to build the tool. I did this here and it seems to have
> fixed the problem:
There's a HUGE difference between "CFLAGS=x make" and "make
CFLAGS=x",
or setting CFLAGS inside a Makefile. That make treats environment
variables as makefile variables doesn't mean they're equal.
Make variables are NOT passed to child processes if they originate in
the Makefile, but environment variables are, and sometimes make
variables start off as environment variables, which can make it seem
otherwise:
When 'make' runs a recipe, variables defined in the makefile are
placed into the environment of each shell. This allows you to pass
values to sub-'make' invocations (*note Recursive Use of 'make':
Recursion.). By default, only variables that came from the
environment or the command line are passed to recursive invocations.
You can use the 'export' directive to pass other variables. *Note
Communicating Variables to a Sub-'make': Variables/Recursion, for full
details.
I will add that, noted during testing, using the "FLAG+=something" form
on the command line does NOT trigger the "from the command line" rule if
the FLAG otherwise didn't trigger it itself. This might be the specific
case here.
So I don't think this is papering over the real problem, I think this is
the right solution (or use export), for when you don't collect such
variables in a .included file.
> ```
> $ git diff
> diff --git a/tools/power/x86/intel-speed-select/Makefile
> b/tools/power/x86/intel-speed-select/Makefile
> index d2fba1297d96..0858aba12d21 100644
> --- a/tools/power/x86/intel-speed-select/Makefile
> +++ b/tools/power/x86/intel-speed-select/Makefile
> @@ -40,7 +40,7 @@ prepare: $(OUTPUT)include/linux/isst_if.h
> $(OUTPUT)include/linux/thermal.h
> ISST_IN := $(OUTPUT)intel-speed-select-in.o
>
> $(ISST_IN): prepare FORCE
> - $(Q)$(MAKE) $(build)=intel-speed-select
> + $(Q)$(MAKE) CFLAGS="$(CFLAGS)" $(build)=intel-speed-select
You could throw an "env" in there somewhere to see what ended up in the
environment (and thus passed down by default) and what didn't.