Skip to content

Commit 3fd411e

Browse files
committed
mk: Make some LLVM building support more robust
* Implement the clean-llvm target for those cases where makefiles are being used * Have all cross-compiled LLVMs depend on the **host** LLVM as they'll require the llvm-tablegen executable from there
1 parent ea1818f commit 3fd411e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

mk/llvm.mk

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@ endif
2727

2828
define DEF_LLVM_RULES
2929

30+
ifeq ($(1),$$(CFG_BUILD))
31+
LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS)
32+
else
33+
LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD))
34+
endif
35+
3036
# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
3137
ifeq ($(CFG_LLVM_ROOT),)
3238

3339
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
3440

35-
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS) $$(LLVM_STAMP_$(1))
41+
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
3642
@$$(call E, cmake: llvm)
3743
ifeq ($$(findstring msvc,$(1)),msvc)
3844
$$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
@@ -42,7 +48,13 @@ else
4248
endif
4349
$$(Q)touch $$(LLVM_CONFIG_$(1))
4450

51+
ifeq ($$(findstring msvc,$(1)),msvc)
4552
clean-llvm$(1):
53+
else
54+
clean-llvm$(1):
55+
@$$(call E, clean: llvm)
56+
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean
57+
endif
4658

4759
else
4860
clean-llvm$(1):

0 commit comments

Comments
 (0)