lkml.org 
[lkml]   [2020]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] tools: fix incorrect setting of CC_NO_CLANG
Date
CC_NO_CLANG should be set according to the value of CC after overridden.

I have linked /usr/bin/cc to /usr/bin/clang and I built perf with a gcc
cross-compiler:

$ ARCH=arm64 CROSS_COMPILE=aarch64-calvin-linux-gnu- make -C \
../linux/tools/perf/ O=$(pwd)

It worked well. But when I tried to rebuild that with FIXDEP=1:

$ ARCH=arm64 CROSS_COMPILE=aarch64-calvin-linux-gnu- make -C \
../linux/tools/perf/ O=$(pwd) FIXDEP=1

Every .o files were rebuilt since EXTRA_WARNINGS was changed due to
false value of CC_NO_CLANG. Things worked in first build because submake
of Makefile.perf inherited CC from first make and CC_NO_CLANG was
rectified in submake.

Signed-off-by: Calvin Zhang <zhq2014@mail.ustc.edu.cn>
---
tools/scripts/Makefile.include | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index a7974638561c..dc887669828b 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -39,8 +39,6 @@ EXTRA_WARNINGS += -Wundef
EXTRA_WARNINGS += -Wwrite-strings
EXTRA_WARNINGS += -Wformat

-CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
-
# Makefiles suck: This macro sets a default value of $(2) for the
# variable named by $(1), unless the variable has been set by
# environment or command line. This is necessary for CC and AR
@@ -59,6 +57,8 @@ $(call allow-override,LD,$(CROSS_COMPILE)ld)
$(call allow-override,CXX,$(CROSS_COMPILE)g++)
$(call allow-override,STRIP,$(CROSS_COMPILE)strip)

+CC_NO_CLANG := $(shell $(CC) -dM -E -x c /dev/null | grep -Fq "__clang__"; echo $$?)
+
ifeq ($(CC_NO_CLANG), 1)
EXTRA_WARNINGS += -Wstrict-aliasing=3
endif
--
2.18.4

\
 
 \ /
  Last update: 2020-09-05 04:08    [W:0.042 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site