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
This commit is contained in:
Alex Crichton 2016-06-27 18:59:55 -07:00
parent ea1818f1ca
commit 3fd411e017

View File

@ -27,12 +27,18 @@ endif
define DEF_LLVM_RULES
ifeq ($(1),$$(CFG_BUILD))
LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS)
else
LLVM_DEPS_TARGET_$(1) := $$(LLVM_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD))
endif
# If CFG_LLVM_ROOT is defined then we don't build LLVM ourselves
ifeq ($(CFG_LLVM_ROOT),)
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS) $$(LLVM_STAMP_$(1))
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
@$$(call E, cmake: llvm)
ifeq ($$(findstring msvc,$(1)),msvc)
$$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
@ -42,7 +48,13 @@ else
endif
$$(Q)touch $$(LLVM_CONFIG_$(1))
ifeq ($$(findstring msvc,$(1)),msvc)
clean-llvm$(1):
else
clean-llvm$(1):
@$$(call E, clean: llvm)
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean
endif
else
clean-llvm$(1):