Skip to content

Commit c8a950d

Browse files
jpbruckeranakryiko
authored andcommitted
tools: Factor HOSTCC, HOSTLD, HOSTAR definitions
Several Makefiles in tools/ need to define the host toolchain variables. Move their definition to tools/scripts/Makefile.include Signed-off-by: Jean-Philippe Brucker <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Jiri Olsa <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 7112d12 commit c8a950d

File tree

6 files changed

+10
-27
lines changed

6 files changed

+10
-27
lines changed

tools/bpf/resolve_btfids/Makefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,6 @@ else
1818
endif
1919

2020
# always use the host compiler
21-
ifneq ($(LLVM),)
22-
HOSTAR ?= llvm-ar
23-
HOSTCC ?= clang
24-
HOSTLD ?= ld.lld
25-
else
26-
HOSTAR ?= ar
27-
HOSTCC ?= gcc
28-
HOSTLD ?= ld
29-
endif
3021
AR = $(HOSTAR)
3122
CC = $(HOSTCC)
3223
LD = $(HOSTLD)

tools/build/Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ endef
1515
$(call allow-override,CC,$(CROSS_COMPILE)gcc)
1616
$(call allow-override,LD,$(CROSS_COMPILE)ld)
1717

18-
HOSTCC ?= gcc
19-
HOSTLD ?= ld
20-
HOSTAR ?= ar
21-
2218
export HOSTCC HOSTLD HOSTAR
2319

2420
ifeq ($(V),1)

tools/objtool/Makefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ include ../scripts/Makefile.include
33
include ../scripts/Makefile.arch
44

55
# always use the host compiler
6-
ifneq ($(LLVM),)
7-
HOSTAR ?= llvm-ar
8-
HOSTCC ?= clang
9-
HOSTLD ?= ld.lld
10-
else
11-
HOSTAR ?= ar
12-
HOSTCC ?= gcc
13-
HOSTLD ?= ld
14-
endif
156
AR = $(HOSTAR)
167
CC = $(HOSTCC)
178
LD = $(HOSTLD)

tools/perf/Makefile.perf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,6 @@ endef
175175

176176
LD += $(EXTRA_LDFLAGS)
177177

178-
HOSTCC ?= gcc
179-
HOSTLD ?= ld
180-
HOSTAR ?= ar
181-
182178
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
183179
LLVM_CONFIG ?= llvm-config
184180

tools/power/acpi/Makefile.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM}
5454
CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc-
5555
CROSS_COMPILE ?= $(CROSS)
5656
LD = $(CC)
57-
HOSTCC = gcc
5857

5958
# check if compiler option is supported
6059
cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;}

tools/scripts/Makefile.include

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ $(call allow-override,LD,$(CROSS_COMPILE)ld)
5959
$(call allow-override,CXX,$(CROSS_COMPILE)g++)
6060
$(call allow-override,STRIP,$(CROSS_COMPILE)strip)
6161

62+
ifneq ($(LLVM),)
63+
HOSTAR ?= llvm-ar
64+
HOSTCC ?= clang
65+
HOSTLD ?= ld.lld
66+
else
67+
HOSTAR ?= ar
68+
HOSTCC ?= gcc
69+
HOSTLD ?= ld
70+
endif
71+
6272
ifeq ($(CC_NO_CLANG), 1)
6373
EXTRA_WARNINGS += -Wstrict-aliasing=3
6474
endif

0 commit comments

Comments
 (0)