Skip to content

Commit 3075476

Browse files
MrVanshuahkh
authored andcommitted
pm: cpupower: Makefile: Fix cross compilation
After commit f79473e ("pm: cpupower: Makefile: Allow overriding cross-compiling env params") we would fail to cross compile cpupower in buildroot which uses the recipe at [1] where only the CROSS variable is being set. The issue here is the use of the lazy evaluation for all variables: CC, LD, AR, STRIP, RANLIB, rather than just CROSS. [1]: https://git.buildroot.net/buildroot/tree/package/linux-tools/linux-tool-cpupower.mk.in Fixes: f79473e ("pm: cpupower: Makefile: Allow overriding cross-compiling env params") Reported-by: Florian Fainelli <florian.fainelli@broadcom.com> Closes: https://lore.kernel.org/all/2bbabd2c-24ef-493c-a199-594e5dada3da@broadcom.com/ Signed-off-by: Peng Fan <peng.fan@nxp.com> Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 694389c commit 3075476

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tools/power/cpupower/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,19 @@ INSTALL_SCRIPT = ${INSTALL} -m 644
8787
# to something more interesting, like "arm-linux-". If you want
8888
# to compile vs uClibc, that can be done here as well.
8989
CROSS ?= #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
90+
ifneq ($(CROSS), )
91+
CC = $(CROSS)gcc
92+
LD = $(CROSS)gcc
93+
AR = $(CROSS)ar
94+
STRIP = $(CROSS)strip
95+
RANLIB = $(CROSS)ranlib
96+
else
9097
CC ?= $(CROSS)gcc
9198
LD ?= $(CROSS)gcc
9299
AR ?= $(CROSS)ar
93100
STRIP ?= $(CROSS)strip
94101
RANLIB ?= $(CROSS)ranlib
102+
endif
95103
HOSTCC = gcc
96104
MKDIR = mkdir
97105

0 commit comments

Comments
 (0)