File tree Expand file tree Collapse file tree 2 files changed +88
-19
lines changed Expand file tree Collapse file tree 2 files changed +88
-19
lines changed Original file line number Diff line number Diff line change 9090
9191TOPDIR ?= $(CURDIR )
9292
93- CC := $(CROSS_COMPILE ) gcc $(SYSROOT )
94- CXX := $(CROSS_COMPILE ) g++ $(SYSROOT )
95- CPP := $(CROSS_COMPILE ) cpp $(SYSROOT )
96- LD := $(CROSS_COMPILE ) ld
97- AR := $(CROSS_COMPILE ) ar
98- RANLIB := $(CROSS_COMPILE ) ranlib
99- STRIP := $(CROSS_COMPILE ) strip -sx
100- OBJCOPY := $(CROSS_COMPILE ) objcopy
101-
102- HOSTCC := $(HOST_COMPILE ) gcc
103- HOSTCXX := $(HOST_COMPILE ) g++
104- HOSTCPP := $(HOST_COMPILE ) cpp
105- HOSTLD := $(HOST_COMPILE ) ld
106- HOSTAR := $(HOST_COMPILE ) ar
107- HOSTRANLIB := $(HOST_COMPILE ) ranlib
108- HOSTSTRIP := $(HOST_COMPILE ) strip
109- HOSTOBJCOPY: = $(HOST_COMPILE ) objcpy
93+ include mk/toolchain.mk
11094
11195SED := sed
11296
@@ -116,8 +100,8 @@ MV := mv
116100RM := rm -rf
117101MKDIR := mkdir -p
118102
119- __CFLAGS := -Wall -Wextra -pipe
120- __CFLAGS += -O2 -pipe
103+ __CFLAGS := -Wall -Wextra
104+ __CFLAGS += -O2
121105__CFLAGS += $(CFLAGS )
122106
123107uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
Original file line number Diff line number Diff line change 1+ CC_IS_CLANG :=
2+ CC_IS_GCC :=
3+
4+ # FIXME: Cross-compilation using Clang is not supported.
5+ ifdef CROSS_COMPILE
6+ CC := $(CROSS_COMPILE ) gcc
7+ endif
8+
9+ override CC := $(shell which $(CC ) )
10+ ifndef CC
11+ $(error "Valid C compiler not found.")
12+ endif
13+
14+ ifneq ($(shell $(CC ) --version | head -n 1 | grep clang) ,)
15+ CC_IS_CLANG := 1
16+ else ifneq ($(shell $(CC) --version | grep "Free Software Foundation"),)
17+ CC_IS_GCC := 1
18+ endif
19+
20+ ifeq ("$(CC_IS_CLANG )$(CC_IS_GCC ) ", "")
21+ $(warning Unsupported C compiler)
22+ endif
23+
24+ ifndef CXX
25+ CXX := $(CROSS_COMPILE ) g++
26+ endif
27+ ifeq ("$(CC_IS_CLANG ) ", "1")
28+ override CXX := $(dir $(CC ) )$(subst clang,clang++,$(notdir $(CC ) ) )
29+ endif
30+
31+ ifndef CPP
32+ CPP := $(CC ) -E
33+ endif
34+
35+ ifndef LD
36+ LD := $(CROSS_COMPILE ) ld
37+ endif
38+
39+ ifndef AR
40+ AR := $(CROSS_COMPILE ) ar
41+ endif
42+
43+ ifndef RANLIB
44+ RANLIB := $(CROSS_COMPILE ) ranlib
45+ endif
46+
47+ ifndef STRIP
48+ STRIP := $(CROSS_COMPILE ) strip -sx
49+ endif
50+
51+ ifndef OBJCOPY
52+ OBJCOPY := $(CROSS_COMPILE ) objcopy
53+ endif
54+
55+ ifndef HOSTCC
56+ HOSTCC := $(HOST_COMPILE ) gcc
57+ endif
58+
59+ ifndef HOSTCXX
60+ HOSTCXX := $(HOST_COMPILE ) g++
61+ endif
62+
63+ ifndef HOSTCPP
64+ HOSTCPP := $(HOSTCC ) -E
65+ endif
66+
67+ ifndef HOSTLD
68+ HOSTLD := $(HOST_COMPILE ) ld
69+ endif
70+
71+ ifndef HOSTAR
72+ HOSTAR := $(HOST_COMPILE ) ar
73+ endif
74+
75+ ifndef HOSTRANLIB
76+ HOSTRANLIB := $(HOST_COMPILE ) ranlib
77+ endif
78+
79+ ifndef HOSTSTRIP
80+ HOSTSTRIP := $(HOST_COMPILE ) strip
81+ endif
82+
83+ ifndef HOSTOBJCOPY
84+ HOSTOBJCOPY: = $(HOST_COMPILE ) objcpy
85+ endif
You can’t perform that action at this time.
0 commit comments