]> git.lizzy.rs Git - rust.git/commitdiff
mk: Add the ability to depend on native LLVM tools
authorAlex Crichton <alex@alexcrichton.com>
Mon, 11 May 2015 21:14:11 +0000 (14:14 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 19 May 2015 17:53:04 +0000 (10:53 -0700)
The compiler will require that `llvm-ar.exe` be available for MSVC-targeting
builds (more comments on this soon), so this commit adds support for targets to
depend on LLVM tools. The `core` library for MSVC depends on `llvm-ar.exe` which
will be copied into place for the target before the compiler starts to run.

Note that these targets all depend on `llvm-config.exe` to ensure that they're
built before they're attempted to be copied.

mk/cfg/x86_64-pc-windows-msvc.mk
mk/llvm.mk
mk/main.mk
mk/target.mk

index 4e97ae3abe11cd73ab117429f870308746d3c42c..209c53f045203dd38df9a1e489c8a91632340c8d 100644 (file)
@@ -39,3 +39,9 @@ endif
 ifdef CFG_MSVC_LINK
 export PATH := $(CFG_MSVC_ROOT)/VC/bin/amd64:$(PATH)
 endif
+
+# There are more comments about this available in the target specification for
+# Windows MSVC in the compiler, but the gist of it is that we use `llvm-ar.exe`
+# instead of `lib.exe` for assembling archives, so we need to inject this custom
+# dependency here.
+NATIVE_TOOL_DEPS_core_T_x86_64-pc-windows-msvc += llvm-ar.exe
index 356366bd5c6d7a89ea9b1eb5a0bc8a761de0e6e9..d5b608e88daf85852291ca4ced7c14ec4f45513e 100644 (file)
@@ -58,6 +58,8 @@ else
 clean-llvm$(1):
 endif
 
+$$(LLVM_AR_$(1)): $$(LLVM_CONFIG_$(1))
+
 # This is used to independently force an LLVM clean rebuild
 # when we changed something not otherwise captured by builtin
 # dependencies. In these cases, commit a change that touches
index a70200e4d8a22a0a57a0f25cad086894f3fe6b3a..bf96d8f660f1ce92cb34445b976f4b2ab5286110 100644 (file)
@@ -292,6 +292,7 @@ endif
 # Any rules that depend on LLVM should depend on LLVM_CONFIG
 LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
 LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
+LLVM_AR_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-ar$$(X_$(1))
 LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
 LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
 LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
index 97b08ebb0339c2f6397da911c32e3b7e8da79ac2..4359eec8447b2d3a6d90deccfe8349b1f7753f72 100644 (file)
@@ -37,7 +37,9 @@ CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4) := \
                $$(foreach dep,$$(NATIVE_DEPS_$(4)), \
                  $$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),$$(dep))) \
                $$(foreach dep,$$(NATIVE_DEPS_$(4)_T_$(2)), \
-                 $$(RT_OUTPUT_DIR_$(2))/$$(dep))
+                 $$(RT_OUTPUT_DIR_$(2))/$$(dep)) \
+               $$(foreach dep,$$(NATIVE_TOOL_DEPS_$(4)_T_$(2)), \
+                 $$(TBIN$(1)_T_$(3)_H_$(3))/$$(dep))
 endef
 
 $(foreach host,$(CFG_HOST), \
@@ -149,6 +151,11 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \
            | $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
        @$$(call E, cp: $$@)
        $$(Q)cp $$< $$@
+
+$$(TBIN$(1)_T_$(2)_H_$(3))/%: $$(CFG_LLVM_INST_DIR_$(2))/bin/% \
+           | $$(TBIN$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
+       @$$(call E, cp: $$@)
+       $$(Q)cp $$< $$@
 endef
 
 $(foreach source,$(CFG_HOST), \