Skip to content

Commit

Permalink
mk: Make some LLVM building support more robust
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alexcrichton committed Jun 28, 2016
1 parent ea1818f commit 3fd411e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion mk/llvm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)) \
Expand All @@ -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):
Expand Down

0 comments on commit 3fd411e

Please sign in to comment.