-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
…stalling. When building Rust libraries (e.g. librustc, libstd, etc), checks for and verbosely removes previous build products before invoking rustc. (Also, when Make variable VERBOSE is defined, it will list all of the libraries matching the object library's glob after the rustc invocation has completed.) When installing Rust libraries, checks for previous libraries in target install directory, but does not remove them. The thinking behind these two different modes of operation is that the installation target, unlike the build tree, is not under the control of this infrastructure and it is not up to this Makefile to decide if the previous libraries should be removed.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,6 +235,33 @@ LIBRUST_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rust) | |
|
||
endef | ||
|
||
# $(1) is the path for directory to match against | ||
# $(2) is the glob to use in the match | ||
# $(3) is filename (usually the target being created) to filter out from match | ||
# (i.e. filename is not out-of-date artifact from prior Rust version/build) | ||
# The glob denoted by $(2) often is constructed with a space character prefix, | ||
# which is why we cannot just do `ls` on $(1)/$(2). | ||
define CHECK_FOR_OLD_GLOB_MATCHES_EXCEPT | ||
$(Q)( cd $(1) && ( ls $(2) 2>/dev/null || true ) | grep -v $(3) > /dev/null && echo "Warning: there are previous" '$(2)' "libraries:" || true ) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
$(Q)( cd $(1) && ( ls $(2) 2>/dev/null || true ) | grep -v $(3) || true ) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pnkfelix
Author
Owner
|
||
endef | ||
|
||
# Same interface as above, but deletes rather than just listing the files. | ||
define REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT | ||
$(Q)( cd $(1) && ( ls $(2) 2>/dev/null || true ) | grep -v $(3) > /dev/null && echo "Warning: removing previous" '$(2)' "libraries:" || true ) | ||
$(Q)( cd $(1) && ( ls $(2) 2>/dev/null || true ) | grep -v $(3) | xargs rm -v ) | ||
endef | ||
|
||
ifdef VERBOSE | ||
define LIST_ALL_OLD_GLOB_MATCHES_EXCEPT | ||
@echo "Info: now are following matches for" '$(2)' "libraries:" | ||
@( cd $(1) && ( ls $(2) 2>/dev/null || true ) | grep -v $(3) || true ) | ||
endef | ||
else | ||
define LIST_ALL_OLD_GLOB_MATCHES_EXCEPT | ||
endef | ||
endif | ||
|
||
$(foreach target,$(CFG_TARGET_TRIPLES),\ | ||
$(eval $(call DEF_LIBS,$(target)))) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,10 +45,12 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \ | |
| $$(HLIB$(2)_H_$(4))/ | ||
|
||
@$$(call E, cp: $$@) | ||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT, `dirname $$@`, $(LIBRUSTC_GLOB_$(4)), `basename $$@`) | ||
This comment has been minimized.
Sorry, something went wrong.
graydon
|
||
$$(Q)cp $$< $$@ | ||
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTC_GLOB_$(4)) \ | ||
$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBRUSTC_DSYM_GLOB_$(4))) \ | ||
$$(HLIB$(2)_H_$(4)) | ||
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT, `dirname $$@`, $(LIBRUSTC_GLOB_$(4)), `basename $$@`) | ||
|
||
$$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \ | ||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBSYNTAX_$(4)) \ | ||
|
@@ -58,10 +60,12 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBSYNTAX_$(4)): \ | |
$$(HEXTRALIB_DEFAULT$(2)_H_$(4)) \ | ||
| $$(HLIB$(2)_H_$(4))/ | ||
@$$(call E, cp: $$@) | ||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT, `dirname $$@`, $(LIBSYNTAX_GLOB_$(4)), `basename $$@`) | ||
$$(Q)cp $$< $$@ | ||
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_GLOB_$(4)) \ | ||
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_DSYM_GLOB_$(4))) \ | ||
$$(HLIB$(2)_H_$(4)) | ||
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT, `dirname $$@`, $(LIBSYNTAX_GLOB_$(4)), `basename $$@`) | ||
|
||
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)): \ | ||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUNTIME_$(4)) \ | ||
|
@@ -74,6 +78,7 @@ $$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)): \ | |
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \ | ||
| $$(HLIB$(2)_H_$(4))/ | ||
@$$(call E, cp: $$@) | ||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT, `dirname $$@`, $(STDLIB_GLOB_$(4)), `basename $$@`) | ||
$$(Q)cp $$< $$@ | ||
# Subtle: We do not let the shell expand $(STDLIB_DSYM_GLOB) directly rather | ||
# we use Make's $$(wildcard) facility. The reason is that, on mac, when using | ||
|
@@ -85,17 +90,20 @@ $$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)): \ | |
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_GLOB_$(4)) \ | ||
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_DSYM_GLOB_$(4))) \ | ||
$$(HLIB$(2)_H_$(4)) | ||
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT, `dirname $$@`, $(STDLIB_GLOB_$(4)), `basename $$@`) | ||
|
||
$$(HLIB$(2)_H_$(4))/$(CFG_EXTRALIB_$(4)): \ | ||
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_EXTRALIB_$(4)) \ | ||
$$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)) \ | ||
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \ | ||
| $$(HLIB$(2)_H_$(4))/ | ||
@$$(call E, cp: $$@) | ||
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT, `dirname $$@`, $(EXTRALIB_GLOB_$(4)), `basename $$@`) | ||
$$(Q)cp $$< $$@ | ||
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(EXTRALIB_GLOB_$(4)) \ | ||
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(EXTRALIB_DSYM_GLOB_$(4))) \ | ||
$$(HLIB$(2)_H_$(4)) | ||
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT, `dirname $$@`, $(EXTRALIB_GLOB_$(4)), `basename $$@`) | ||
|
||
$$(HLIB$(2)_H_$(4))/libstd.rlib: \ | ||
$$(TLIB$(1)_T_$(4)_H_$(3))/libstd.rlib \ | ||
|
Process spawning is very very slow on windows. If you can get by using$(wildcard), $ (filter-out) and such, it will affect build time less.