-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathtools.mk
More file actions
116 lines (101 loc) · 2.88 KB
/
tools.mk
File metadata and controls
116 lines (101 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# vim: tabstop=2 shiftwidth=2 noexpandtab:
#
# This is a common makefile used to establish the implementation of the basic
# tools used throughout the build system.
#
# The following make variables are set by the including makefile:
# - TARGET, ABIFLAGS: Set by arch.*.mk files.
LLVM_VER := -14
ifeq ($(shell which ccache > /dev/null; echo $$?), 0)
CCACHE := ccache
endif
ifndef ARCH
$(error ARCH variable not defined. Have you included config.mk?)
endif
# Pass "LLVM=1" at command line to switch to llvm toolchain.
ifeq ($(LLVM), 1)
ifneq ($(shell which clang$(LLVM_VER) > /dev/null; echo $$?), 0)
$(error clang compiler not found - please refer to README.md!)
endif
ifneq ($(shell which ld.lld$(LLVM_VER) > /dev/null; echo $$?), 0)
$(error lld linker not found)
endif
ifneq ($(shell which llvm-ar$(LLVM_VER) > /dev/null; echo $$?), 0)
$(error llvm toolchain not found)
endif
CC = $(CCACHE) clang$(LLVM_VER) -target $(TARGET) $(ABIFLAGS) -g
CPP = $(CC) -x c -E
AS = $(CC)
LD = ld.lld$(LLVM_VER)
AR = llvm-ar$(LLVM_VER)
NM = llvm-nm$(LLVM_VER)
RANLIB = llvm-ranlib$(LLVM_VER)
READELF = llvm-readelf$(LLVM_VER)
OBJCOPY = llvm-objcopy$(LLVM_VER)
OBJDUMP = llvm-objdump$(LLVM_VER)
STRIP = llvm-strip$(LLVM_VER)
# The genassym script produces C code with asm statements that have
# garbage instructions, which Clang checks using its built-in assembler
# and refuses to compile. This option disables this check.
ASSYM_CFLAGS += -no-integrated-as
else
ifneq ($(shell which $(TARGET)-gcc > /dev/null; echo $$?), 0)
$(error $(TARGET)-gcc compiler not found - please refer to README.md!)
endif
CC = $(CCACHE) $(TARGET)-gcc $(ABIFLAGS) -g
CPP = $(CCACHE) $(TARGET)-cpp
AS = $(CC)
LD = $(TARGET)-ld
AR = $(TARGET)-ar
NM = $(TARGET)-nm
RANLIB = $(TARGET)-ranlib
READELF = $(TARGET)-readelf
OBJCOPY = $(TARGET)-objcopy
OBJDUMP = $(TARGET)-objdump
STRIP = $(TARGET)-strip
endif
CP = cp
CPIO = cpio --format=crc
CSCOPE = cscope -b
CTAGS = ctags
FORMAT = clang-format$(LLVM_VER) -style=file
INSTALL = install -D
LN = ln
RM = rm -f
TAR = tar
SED = sed
CURL = curl -J -L
GIT = git
PATCH = patch
GENASSYM = $(TOPDIR)/sys/script/genassym.sh
YACC = byacc
GZIP = gzip -9
dump-tools:
echo "CC=\"${CC}\" "
echo "CPP=\"${CPP}\" "
echo "AS=\"${AS}\" "
echo "LD=\"${LD}\" "
echo "AR=\"${AR}\" "
echo "NM=\"${NM}\" "
echo "RANLIB=\"${RANLIB}\" "
echo "READELF=\"${READELF}\" "
echo "OBJCOPY=\"${OBJCOPY}\" "
echo "OBJDUMP=\"${OBJDUMP}\" "
echo "STRIP=\"${STRIP}\" "
echo "CP=\"${CP}\" "
echo "CPIO=\"${CPIO}\" "
echo "CSCOPE=\"${CSCOPE}\" "
echo "CTAGS=\"${CTAGS}\" "
echo "FORMAT=\"${FORMAT}\" "
echo "INSTALL=\"${INSTALL}\" "
echo "LN=\"${LN}\" "
echo "RM=\"${RM}\" "
echo "TAR=\"${TAR}\" "
echo "SED=\"${SED}\" "
echo "CURL=\"${CURL}\" "
echo "GIT=\"${GIT}\" "
echo "PATCH=\"${PATCH}\" "
echo "GENASSYM=\"${GENASSYM}\" "
echo "YACC=\"${YACC}\" "
echo "GZIP=\"${GZIP}\" "
PHONY-TARGETS += dump-tools