/mk/stage0.mk

http://github.com/jruderman/rust · Makefile · 82 lines · 53 code · 19 blank · 10 comment · 1 complexity · f054d24379e1a6469fde6f8699689442 MD5 · raw file

  1. # Extract the snapshot host compiler
  2. $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X): \
  3. $(S)src/snapshots.txt \
  4. $(S)src/etc/get-snapshot.py $(MKFILE_DEPS)
  5. @$(call E, fetch: $@)
  6. # Note: the variable "SNAPSHOT_FILE" is generally not set, and so
  7. # we generally only pass one argument to this script.
  8. ifdef CFG_ENABLE_LOCAL_RUST
  9. $(Q)$(S)src/etc/local_stage0.sh $(CFG_HOST_TRIPLE) $(CFG_LOCAL_RUST_ROOT)
  10. else
  11. $(Q)$(S)src/etc/get-snapshot.py $(CFG_HOST_TRIPLE) $(SNAPSHOT_FILE)
  12. endif
  13. $(Q)touch $@
  14. # Host libs will be extracted by the above rule
  15. $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUNTIME): \
  16. $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
  17. $(Q)touch $@
  18. $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_CORELIB): \
  19. $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
  20. $(Q)touch $@
  21. $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_STDLIB): \
  22. $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
  23. $(Q)touch $@
  24. $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_LIBRUSTC): \
  25. $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
  26. $(Q)touch $@
  27. $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUSTLLVM): \
  28. $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
  29. $(Q)touch $@
  30. # For other targets, let the host build the target:
  31. define BOOTSTRAP_STAGE0
  32. # $(1) target to bootstrap
  33. # $(2) stage to bootstrap from
  34. # $(3) target to bootstrap from
  35. $$(HBIN0_H_$(1))/rustc$$(X): \
  36. $$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X)
  37. @$$(call E, cp: $$@)
  38. $$(Q)cp $$< $$@
  39. $$(HLIB0_H_$(1))/$$(CFG_RUNTIME): \
  40. $$(TLIB$(2)_T_$(1)_H_$(3))/$$(CFG_RUNTIME)
  41. @$$(call E, cp: $$@)
  42. $$(Q)cp $$< $$@
  43. $$(HLIB0_H_$(1))/$(CFG_CORELIB): \
  44. $$(TLIB$(2)_T_$(1)_H_$(3))/$$(CFG_CORELIB)
  45. @$$(call E, cp: $$@)
  46. $$(Q)cp $$(TLIB$(2)_T_$(1)_H_$(3))/$$(CORELIB_GLOB) $$@
  47. $$(HLIB0_H_$(1))/$(CFG_STDLIB): \
  48. $$(TLIB$(2)_T_$(1)_H_$(3))/$$(CFG_STDLIB)
  49. @$$(call E, cp: $$@)
  50. $$(Q)cp $$(TLIB$(2)_T_$(1)_H_$(3))/$$(STDLIB_GLOB) $$@
  51. $$(HLIB0_H_$(1))/$(CFG_LIBRUSTC): \
  52. $$(TLIB$(2)_T_$(1)_H_$(3))/$$(CFG_LIBRUSTC)
  53. @$$(call E, cp: $$@)
  54. $$(Q)cp $$(TLIB$(2)_T_$(1)_H_$(3))/$$(LIBRUSTC_GLOB) $$@
  55. $$(HLIB0_H_$(1))/$(CFG_RUSTLLVM): \
  56. $$(TLIB$(2)_T_$(1)_H_$(3))/$$(CFG_RUSTLLVM)
  57. @$$(call E, cp: $$@)
  58. $$(Q)cp $$< $$@
  59. endef
  60. # Use stage1 to build other architectures: then you don't have to wait
  61. # for stage2, but you get the latest updates to the compiler source.
  62. $(foreach t,$(NON_HOST_TRIPLES), \
  63. $(eval $(call BOOTSTRAP_STAGE0,$(t),1,$(CFG_HOST_TRIPLE))))