@@ -222,72 +222,27 @@ GENERATED :=
222222
223223
224224# #####################################################################
225- # Crates
225+ # Cleaning out old crates
226226# #####################################################################
227227
228- define DEF_LIBS
229-
230- CFG_RUNTIME_$(1 ) :=$(call CFG_STATIC_LIB_NAME_$(1 ) ,rustrt)
231- CFG_RUSTLLVM_$(1 ) :=$(call CFG_STATIC_LIB_NAME_$(1 ) ,rustllvm)
232- CFG_STDLIB_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,std)
233- CFG_EXTRALIB_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,extra)
234- CFG_LIBRUSTC_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,rustc)
235- CFG_LIBSYNTAX_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,syntax)
236- CFG_LIBRUSTPKG_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,rustpkg)
237- CFG_LIBRUSTDOC_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,rustdoc)
238- CFG_LIBRUSTUV_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,rustuv)
239- CFG_LIBGREEN_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,green)
240- CFG_LIBNATIVE_$(1 ) :=$(call CFG_LIB_NAME_$(1 ) ,native)
241-
242- EXTRALIB_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,extra)
243- STDLIB_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,std)
244- LIBRUSTC_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,rustc)
245- LIBSYNTAX_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,syntax)
246- LIBRUSTPKG_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,rustpkg)
247- LIBRUSTDOC_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,rustdoc)
248- LIBRUSTUV_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,rustuv)
249- LIBGREEN_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,green)
250- LIBNATIVE_GLOB_$(1 ) :=$(call CFG_LIB_GLOB_$(1 ) ,native)
251- EXTRALIB_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,extra)
252- STDLIB_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,std)
253- LIBRUSTC_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,rustc)
254- LIBSYNTAX_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,syntax)
255- LIBRUSTPKG_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,rustpkg)
256- LIBRUSTDOC_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,rustdoc)
257- LIBRUSTUV_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,rustuv)
258- LIBGREEN_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,green)
259- LIBNATIVE_DSYM_GLOB_$(1 ) :=$(call CFG_LIB_DSYM_GLOB_$(1 ) ,native)
260-
261- EXTRALIB_RGLOB_$(1 ) :=$(call CFG_RLIB_GLOB,extra)
262- STDLIB_RGLOB_$(1 ) :=$(call CFG_RLIB_GLOB,std)
263- LIBRUSTUV_RGLOB_$(1 ) :=$(call CFG_RLIB_GLOB,rustuv)
264- LIBSYNTAX_RGLOB_$(1 ) :=$(call CFG_RLIB_GLOB,syntax)
265- LIBRUSTC_RGLOB_$(1 ) :=$(call CFG_RLIB_GLOB,rustc)
266- LIBNATIVE_RGLOB_$(1 ) :=$(call CFG_RLIB_GLOB,native)
267- LIBGREEN_RGLOB_$(1 ) :=$(call CFG_RLIB_GLOB,green)
268-
269- endef
270-
271228# $(1) is the path for directory to match against
272229# $(2) is the glob to use in the match
273- # $(3) is filename (usually the target being created) to filter out from match
274- # (i.e. filename is not out-of-date artifact from prior Rust version/build)
275230#
276231# Note that a common bug is to accidentally construct the glob denoted
277232# by $(2) with a space character prefix, which invalidates the
278233# construction $(1)$(2).
279- define CHECK_FOR_OLD_GLOB_MATCHES_EXCEPT
280- $(Q ) MATCHES="$(filter-out % $( 3 ) , $( wildcard $(1 ) / $( 2 ) ) ) "; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(2 ) \' "libraries:" $$MATCHES; fi
234+ define CHECK_FOR_OLD_GLOB_MATCHES
235+ $(Q ) MATCHES="$(wildcard $(1 ) ) "; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $( 2 ) ) \' "libraries:" $$MATCHES; fi
281236endef
282237
283238# Same interface as above, but deletes rather than just listing the files.
284239ifdef VERBOSE
285- define REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT
286- $(Q ) MATCHES="$(filter-out % $( 3 ) , $( wildcard $(1 ) / $( 2 ) ) ) "; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(2 ) \' "libraries:" $$MATCHES; rm $$MATCHES ; fi
240+ define REMOVE_ALL_OLD_GLOB_MATCHES
241+ $(Q ) MATCHES="$(wildcard $(1 ) ) "; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $( 1 ) ) \' "libraries:" $$MATCHES; rm $$MATCHES ; fi
287242endef
288243else
289- define REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT
290- $(Q ) MATCHES="$(filter-out % $( 3 ) , $( wildcard $(1 ) / $( 2 ) ) ) "; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
244+ define REMOVE_ALL_OLD_GLOB_MATCHES
245+ $(Q ) MATCHES="$(wildcard $(1 ) ) "; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
291246endef
292247endif
293248
@@ -298,72 +253,15 @@ endif
298253# soon. (This is in contrast to the macros above, which are meant to
299254# be run at the outset of a command list in a rule.)
300255ifdef VERBOSE
301- define LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
302- @echo "info: now are following matches for" '$(2 ) ' "libraries:"
303- @( cd $(1 ) && ( ls $( 2 ) 2 >/dev/null || true ) | grep -v $( 3 ) || true )
256+ define LIST_ALL_OLD_GLOB_MATCHES
257+ @echo "info: now are following matches for" '$(notdir $( 1 ) ) ' "libraries:"
258+ @( ls $(1 ) 2 >/dev/null || true )
304259endef
305260else
306- define LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
261+ define LIST_ALL_OLD_GLOB_MATCHES
307262endef
308263endif
309264
310- $(foreach target,$(CFG_TARGET),\
311- $(eval $(call DEF_LIBS,$(target))))
312-
313- # #####################################################################
314- # Standard library variables
315- # #####################################################################
316-
317- STDLIB_CRATE := $(S ) src/libstd/lib.rs
318- STDLIB_INPUTS := $(wildcard $(addprefix $(S ) src/libstd/, \
319- * .rs * /* .rs * /* /* rs * /* /* /* rs) )
320-
321- # #####################################################################
322- # Extra library variables
323- # #####################################################################
324-
325- EXTRALIB_CRATE := $(S ) src/libextra/lib.rs
326- EXTRALIB_INPUTS := $(wildcard $(addprefix $(S ) src/libextra/, \
327- * .rs * /* .rs) )
328-
329- # #####################################################################
330- # Rust UV library variables
331- # #####################################################################
332-
333- LIBRUSTUV_CRATE := $(S ) src/librustuv/lib.rs
334- LIBRUSTUV_INPUTS := $(wildcard $(addprefix $(S ) src/librustuv/, \
335- * .rs * /* .rs) )
336-
337- # #####################################################################
338- # Green threading library variables
339- # #####################################################################
340-
341- LIBGREEN_CRATE := $(S ) src/libgreen/lib.rs
342- LIBGREEN_INPUTS := $(wildcard $(addprefix $(S ) src/libgreen/, \
343- * .rs * /* .rs) )
344-
345- # #####################################################################
346- # Native threading library variables
347- # #####################################################################
348-
349- LIBNATIVE_CRATE := $(S ) src/libnative/lib.rs
350- LIBNATIVE_INPUTS := $(wildcard $(addprefix $(S ) src/libnative/, \
351- * .rs * /* .rs) )
352-
353- # #####################################################################
354- # rustc crate variables
355- # #####################################################################
356-
357- COMPILER_CRATE := $(S ) src/librustc/lib.rs
358- COMPILER_INPUTS := $(wildcard $(addprefix $(S ) src/librustc/, \
359- * .rs * /* .rs * /* /* .rs * /* /* /* .rs) )
360-
361- LIBSYNTAX_CRATE := $(S ) src/libsyntax/lib.rs
362- LIBSYNTAX_INPUTS := $(wildcard $(addprefix $(S ) src/libsyntax/, \
363- * .rs * /* .rs * /* /* .rs * /* /* /* .rs) )
364-
365- DRIVER_CRATE := $(S ) src/driver/driver.rs
366-
367265# #####################################################################
368266# LLVM macros
369267# #####################################################################
@@ -424,14 +322,12 @@ export CFG_RUSTLIBDIR
424322export CFG_LIBDIR_RELATIVE
425323export CFG_DISABLE_INJECT_STD_VERSION
426324
427- # #####################################################################
428- # Subprograms
429- # #####################################################################
430-
431325# #####################################################################
432326# Per-stage targets and runner
433327# #####################################################################
434328
329+ include $(CFG_SRC_DIR ) mk/crates.mk
330+
435331define SREQ
436332# $(1) is the stage number
437333# $(2) is the target triple
@@ -447,84 +343,37 @@ TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLIBDIR)/$(2)
447343TBIN$(1 ) _T_$(2 ) _H_$(3 ) = $$(TROOT$(1 ) _T_$(2 ) _H_$(3 ) ) /bin
448344TLIB$(1 ) _T_$(2 ) _H_$(3 ) = $$(TROOT$(1 ) _T_$(2 ) _H_$(3 ) ) /lib
449345
450- # The name of the standard and extra libraries used by rustc
451- HSTDLIB_DEFAULT$(1 ) _H_$(3 ) = \
452- $$(HLIB$(1 ) _H_$(3 ) ) /$(CFG_STDLIB_$(3 ) )
453- TSTDLIB_DEFAULT$(1 ) _T_$(2 ) _H_$(3 ) = \
454- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_STDLIB_$(2 ) )
455-
456- HEXTRALIB_DEFAULT$(1 ) _H_$(3 ) = \
457- $$(HLIB$(1 ) _H_$(3 ) ) /$(CFG_EXTRALIB_$(3 ) )
458- TEXTRALIB_DEFAULT$(1 ) _T_$(2 ) _H_$(3 ) = \
459- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_EXTRALIB_$(2 ) )
460-
461- HLIBRUSTC_DEFAULT$(1 ) _H_$(3 ) = \
462- $$(HLIB$(1 ) _H_$(3 ) ) /$(CFG_LIBRUSTC_$(3 ) )
463- TLIBRUSTC_DEFAULT$(1 ) _T_$(2 ) _H_$(3 ) = \
464- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBRUSTC_$(2 ) )
465-
466- HLIBRUSTUV_DEFAULT$(1 ) _H_$(3 ) = \
467- $$(HLIB$(1 ) _H_$(3 ) ) /$(CFG_LIBRUSTUV_$(3 ) )
468- TLIBRUSTUV_DEFAULT$(1 ) _T_$(2 ) _H_$(3 ) = \
469- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBRUSTUV_$(2 ) )
470-
471- HLIBGREEN_DEFAULT$(1 ) _H_$(3 ) = \
472- $$(HLIB$(1 ) _H_$(3 ) ) /$(CFG_LIBGREEN_$(3 ) )
473- TLIBGREEN_DEFAULT$(1 ) _T_$(2 ) _H_$(3 ) = \
474- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBGREEN_$(2 ) )
475-
476- HLIBNATIVE_DEFAULT$(1 ) _H_$(3 ) = \
477- $$(HLIB$(1 ) _H_$(3 ) ) /$(CFG_LIBNATIVE_$(3 ) )
478- TLIBNATIVE_DEFAULT$(1 ) _T_$(2 ) _H_$(3 ) = \
479- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBNATIVE_$(2 ) )
480-
481346# Preqrequisites for using the stageN compiler
482347ifeq ($(1 ) ,0)
483348HSREQ$(1)_H_$(3) = $$(HBIN$(1 ) _H_$(3 ) ) /rustc$$(X_$(3 ) )
484349else
485350HSREQ$(1)_H_$(3) = \
486351 $$(HBIN$(1 ) _H_$(3 ) ) /rustc$$(X_$(3 ) ) \
487- $$(HSTDLIB_DEFAULT$(1 ) _H_$(3 ) ) \
488- $$(HEXTRALIB_DEFAULT$(1 ) _H_$(3 ) ) \
489- $$(HLIBSYNTAX_DEFAULT$(1 ) _H_$(3 ) ) \
490- $$(HLIBRUSTC_DEFAULT$(1 ) _H_$(3 ) ) \
491- $$(HLIBRUSTUV_DEFAULT$(1 ) _H_$(3 ) ) \
492- $$(HLIBGREEN_DEFAULT$(1 ) _H_$(3 ) ) \
493- $$(HLIBNATIVE_DEFAULT$(1 ) _H_$(3 ) ) \
352+ $$(HLIB$(1 ) _H_$(3 ) ) /stamp.rustc \
353+ $$(foreach dep,$$(RUST_DEPS_rustc ) ,$$(HLIB$(1 ) _H_$(3 ) ) /stamp.$$(dep ) ) \
494354 $$(MKFILE_DEPS )
495355endif
496356
497357# Prerequisites for using the stageN compiler to build target artifacts
498358TSREQ$(1 ) _T_$(2 ) _H_$(3 ) = \
499359 $$(HSREQ$(1 ) _H_$(3 ) ) \
500- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_RUNTIME_$(2 ) ) \
501360 $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /libmorestack.a
502361
503- # Prerequisites for a working stageN compiler and libraries, for a specific target
362+ # Prerequisites for a working stageN compiler and libraries, for a specific
363+ # target
504364SREQ$(1 ) _T_$(2 ) _H_$(3 ) = \
505365 $$(TSREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
506- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_STDLIB_$(2 ) ) \
507- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_EXTRALIB_$(2 ) ) \
508- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBRUSTUV_$(2 ) ) \
509- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBGREEN_$(2 ) ) \
510- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBNATIVE_$(2 ) )
366+ $$(foreach dep,$$(TARGET_CRATES ) ,\
367+ $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /stamp.$$(dep ) )
511368
512- # Prerequisites for a working stageN compiler and libraries, for a specific target
369+ # Prerequisites for a working stageN compiler and complete set of target
370+ # libraries
513371CSREQ$(1 ) _T_$(2 ) _H_$(3 ) = \
514372 $$(TSREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
515373 $$(HBIN$(1 ) _H_$(3 ) ) /rustpkg$$(X_$(3 ) ) \
516374 $$(HBIN$(1 ) _H_$(3 ) ) /rustdoc$$(X_$(3 ) ) \
517- $$(HLIB$(1 ) _H_$(3 ) ) /$(CFG_LIBRUSTPKG_$(3 ) ) \
518- $$(HLIB$(1 ) _H_$(3 ) ) /$(CFG_LIBRUSTDOC_$(3 ) ) \
519- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_STDLIB_$(2 ) ) \
520- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_EXTRALIB_$(2 ) ) \
521- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBSYNTAX_$(2 ) ) \
522- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBRUSTC_$(2 ) ) \
523- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBRUSTPKG_$(2 ) ) \
524- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBRUSTDOC_$(2 ) ) \
525- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBRUSTUV_$(2 ) ) \
526- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBGREEN_$(2 ) ) \
527- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$(CFG_LIBNATIVE_$(2 ) )
375+ $$(foreach dep,$$(CRATES ) ,$$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /stamp.$$(dep ) ) \
376+ $$(foreach dep,$$(HOST_CRATES ) ,$$(HLIB$(1 ) _H_$(3 ) ) /stamp.$$(dep ) )
528377
529378ifeq ($(1 ) ,0)
530379# Don't run the the stage0 compiler under valgrind - that ship has sailed
@@ -562,15 +411,15 @@ endif
562411STAGE$(1 ) _T_$(2 ) _H_$(3 ) := \
563412 $$(Q )$$(RPATH_VAR$(1 ) _T_$(2 ) _H_$(3 ) ) \
564413 $$(call CFG_RUN_TARG_$(3 ) ,$(1 ) , \
565- $$(CFG_VALGRIND_COMPILE$(1 ) ) \
414+ $$(CFG_VALGRIND_COMPILE$(1 ) ) \
566415 $$(HBIN$(1 ) _H_$(3 ) ) /rustc$$(X_$(3 ) ) \
567416 --cfg $$(CFGFLAG$(1 ) _T_$(2 ) _H_$(3 ) ) \
568417 $$(CFG_RUSTC_FLAGS ) $$(EXTRAFLAGS_STAGE$(1 ) ) --target=$(2 ) ) \
569418 $$(RUSTC_FLAGS_$(2 ) )
570419
571- PERF_STAGE$(1 ) _T_$(2 ) _H_$(3 ) := \
420+ PERF_STAGE$(1 ) _T_$(2 ) _H_$(3 ) := \
572421 $$(Q )$$(call CFG_RUN_TARG_$(3 ) ,$(1 ) , \
573- $$(CFG_PERF_TOOL ) \
422+ $$(CFG_PERF_TOOL ) \
574423 $$(HBIN$(1 ) _H_$(3 ) ) /rustc$$(X_$(3 ) ) \
575424 --cfg $$(CFGFLAG$(1 ) _T_$(2 ) _H_$(3 ) ) \
576425 $$(CFG_RUSTC_FLAGS ) $$(EXTRAFLAGS_STAGE$(1 ) ) --target=$(2 ) ) \
@@ -594,13 +443,12 @@ define DEF_RUSTC_STAGE_TARGET
594443# $(2) == stage
595444
596445rustc-stage$(2 ) -H-$(1 ) : \
597- $$(foreach target,$$(CFG_TARGET ) , \
598- $$(SREQ$(2 ) _T_$$(target ) _H_$(1 ) ) )
446+ $$(foreach target,$$(CFG_TARGET ) ,$$(SREQ$(2 ) _T_$$(target ) _H_$(1 ) ) )
599447
600448endef
601449
602- $(foreach host,$(CFG_HOST), \
603- $(eval $(foreach stage,1 2 3, \
450+ $(foreach host,$(CFG_HOST), \
451+ $(eval $(foreach stage,1 2 3, \
604452 $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
605453
606454rustc-stage1 : rustc-stage1-H-$(CFG_BUILD )
@@ -701,7 +549,6 @@ include $(CFG_SRC_DIR)mk/target.mk
701549include $(CFG_SRC_DIR ) mk/host.mk
702550include $(CFG_SRC_DIR ) mk/stage0.mk
703551include $(CFG_SRC_DIR ) mk/rustllvm.mk
704- include $(CFG_SRC_DIR ) mk/tools.mk
705552include $(CFG_SRC_DIR ) mk/docs.mk
706553include $(CFG_SRC_DIR ) mk/llvm.mk
707554
0 commit comments