Skip to content

Commit 07e48b4

Browse files
committed
feaf(makefile) Add the HAS_<compiler> variables.
1 parent 1054e51 commit 07e48b4

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

Makefile

+21-9
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ IS_WINDOWS := 0
7373
IS_AMD64 := 0
7474
IS_AARCH64 := 0
7575
LIBC ?=
76+
HAS_CRANELIFT := 0
77+
HAS_LLVM := 0
78+
HAS_SINGLEPASS := 0
7679

7780
# Test Windows apart because it doesn't support `uname -s`.
7881
ifeq ($(OS), Windows_NT)
@@ -113,6 +116,7 @@ compilers :=
113116
##
114117

115118
compilers += cranelift
119+
HAS_CRANELIFT := 1
116120

117121
##
118122
# LLVM
@@ -137,6 +141,10 @@ else
137141
endif
138142
endif
139143

144+
ifneq (, $(findstring llvm,$(compilers)))
145+
HAS_LLVM := 1
146+
endif
147+
140148
##
141149
# Singlepass
142150
##
@@ -147,6 +155,10 @@ ifeq ($(IS_WINDOWS), 0)
147155
endif
148156
endif
149157

158+
ifneq (, $(findstring singlepass,$(compilers)))
159+
HAS_SINGLEPASS := 1
160+
endif
161+
150162

151163

152164
#####
@@ -163,12 +175,14 @@ compilers_engines :=
163175
# The Cranelift case.
164176
##
165177

166-
compilers_engines += cranelift-jit
178+
ifeq ($(HAS_CRANELIFT, 1))
179+
compilers_engines += cranelift-jit
167180

168-
ifeq ($(IS_WINDOWS), 0)
169-
ifeq ($(IS_AMD64), 1)
170-
ifneq ($(LIBC, musl))
171-
compilers_engines += cranelift-native
181+
ifeq ($(IS_WINDOWS), 0)
182+
ifeq ($(IS_AMD64), 1)
183+
ifneq ($(LIBC, musl))
184+
compilers_engines += cranelift-native
185+
endif
172186
endif
173187
endif
174188
endif
@@ -177,8 +191,7 @@ endif
177191
# The LLVM case.
178192
##
179193

180-
# If `compilers` contains `llvm`.
181-
ifneq (, $(findstring llvm,$(compilers)))
194+
ifeq ($(HAS_LLVM), 1)
182195
ifeq ($(IS_WINDOWS), 0)
183196
ifeq ($(IS_AMD64), 1)
184197
compilers_engines += llvm-jit
@@ -193,8 +206,7 @@ endif
193206
# The Singlepass case.
194207
##
195208

196-
# If `compilers` contains `singlepass`.
197-
ifneq (, $(findstring singlepass,$(compilers)))
209+
ifeq ($(HAS_SINGLEPASS), 1)
198210
ifeq ($(IS_WINDOWS), 0)
199211
if ($(IS_AMD64), 1)
200212
compilers_engines += singlepass-jit

0 commit comments

Comments
 (0)