From 9b7751761b55c154aff3f47e5300ffaa66dc52ff Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Wed, 19 Mar 2014 22:47:37 -0700 Subject: [PATCH] mk: Simplify how prepare.mk, install.mk, and dist.mk deal with stages The only stage that can be installed from is 2 everywhere but windows, 3 on windows. Closes #12799 --- mk/dist.mk | 4 ---- mk/install.mk | 3 +-- mk/prepare.mk | 39 ++++++++++++++++----------------------- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/mk/dist.mk b/mk/dist.mk index 01ee7a7947b..7ac3582f821 100644 --- a/mk/dist.mk +++ b/mk/dist.mk @@ -65,8 +65,6 @@ $(PKG_EXE): rust.iss modpath.iss LICENSE.txt rust-logo.ico \ dist-prepare-win: PREPARE_HOST=$(CFG_BUILD) dist-prepare-win: PREPARE_TARGETS=$(CFG_BUILD) dist-prepare-win: PREPARE_DEST_DIR=tmp/dist/win -# On windows we're using stage3, unlike Unix... -dist-prepare-win: PREPARE_STAGE=3 dist-prepare-win: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD) dist-prepare-win: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD) dist-prepare-win: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD) @@ -135,7 +133,6 @@ ifeq ($(CFG_OSTYPE), apple-darwin) dist-prepare-osx: PREPARE_HOST=$(CFG_BUILD) dist-prepare-osx: PREPARE_TARGETS=$(CFG_BUILD) dist-prepare-osx: PREPARE_DEST_DIR=tmp/dist/pkgroot -dist-prepare-osx: PREPARE_STAGE=2 dist-prepare-osx: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD) dist-prepare-osx: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD) dist-prepare-osx: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD) @@ -165,7 +162,6 @@ dist-tar-bins: $(foreach host,$(CFG_HOST),dist/$(PKG_DIR)-$(host).tar.gz) define DEF_INSTALLER dist-install-dir-$(1): PREPARE_HOST=$(1) dist-install-dir-$(1): PREPARE_TARGETS=$(1) -dist-install-dir-$(1): PREPARE_STAGE=2 dist-install-dir-$(1): PREPARE_DEST_DIR=tmp/dist/$$(PKG_DIR)-$(1) dist-install-dir-$(1): PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD) dist-install-dir-$(1): PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD) diff --git a/mk/install.mk b/mk/install.mk index dbb349fcf3a..6e56767a9d7 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -13,11 +13,10 @@ # mirror of the installation directory structure. # The stage we install from -ISTAGE = 2 +ISTAGE = $(PREPARE_STAGE) install: PREPARE_HOST=$(CFG_BUILD) install: PREPARE_TARGETS=$(CFG_TARGET) -install: PREPARE_STAGE=$(ISTAGE) install: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD) install: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD) install: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD) diff --git a/mk/prepare.mk b/mk/prepare.mk index 304806f12ad..bfc5c8785d0 100644 --- a/mk/prepare.mk +++ b/mk/prepare.mk @@ -20,7 +20,14 @@ # PREPARE_TARGETS - the target triples, space separated # PREPARE_DEST_DIR - the directory to put the image -prepare: PREPARE_STAGE=2 + +# On windows we install from stage3, but on unix only stage2 +ifdef CFG_WINDOWSY_$(CFG_BUILD) +PREPARE_STAGE=3 +else +PREPARE_STAGE=2 +endif + prepare: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD) prepare: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD) prepare: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD) @@ -43,15 +50,6 @@ DEFAULT_PREPARE_BIN_CMD = install -m755 DEFAULT_PREPARE_LIB_CMD = install -m644 DEFAULT_PREPARE_MAN_CMD = install -m644 -# On windows we install from stage3, but on unix only stage2 -# Because of the way these rules are organized, preparing from any -# stage requires all these stages to be built -ifdef CFG_WINDOWSY_$(CFG_BUILD) -PREPARE_STAGES=3 -else -PREPARE_STAGES=2 -endif - # Create a directory # $(1) is the directory define PREPARE_DIR @@ -102,9 +100,8 @@ prepare-host: prepare-host-tools prepare-host-tools: \ $(foreach tool, $(PREPARE_TOOLS),\ - $(foreach stage,$(PREPARE_STAGES),\ - $(foreach host,$(CFG_HOST),\ - prepare-host-tool-$(tool)-$(stage)-$(host)))) + $(foreach host,$(CFG_HOST),\ + prepare-host-tool-$(tool)-$(PREPARE_STAGE)-$(host))) prepare-host-dirs: prepare-maybe-clean $(call PREPARE_DIR,$(PREPARE_DEST_BIN_DIR)) @@ -128,9 +125,8 @@ prepare-host-tool-$(1)-$(2)-$(3): prepare-maybe-clean \ endef $(foreach tool,$(PREPARE_TOOLS),\ - $(foreach stage,$(PREPARE_STAGES),\ - $(foreach host,$(CFG_HOST),\ - $(eval $(call DEF_PREPARE_HOST_TOOL,$(tool),$(stage),$(host)))))) + $(foreach host,$(CFG_HOST),\ + $(eval $(call DEF_PREPARE_HOST_TOOL,$(tool),$(PREPARE_STAGE),$(host))))) # For host libraries only install dylibs, not rlibs since the host libs are only # used to support rustc and rustc uses dynamic linking @@ -151,15 +147,13 @@ prepare-host-lib-$(1)-$(2)-$(3): prepare-maybe-clean \ endef $(foreach lib,$(CRATES),\ - $(foreach stage,$(PREPARE_STAGES),\ - $(foreach host,$(CFG_HOST),\ - $(eval $(call DEF_PREPARE_HOST_LIB,$(lib),$(stage),$(host)))))) + $(foreach host,$(CFG_HOST),\ + $(eval $(call DEF_PREPARE_HOST_LIB,$(lib),$(PREPARE_STAGE),$(host))))) prepare-targets:\ $(foreach host,$(CFG_HOST),\ $(foreach target,$(CFG_TARGET),\ - $(foreach stage,$(PREPARE_STAGES),\ - prepare-target-$(target)-host-$(host)-$(stage)))) + prepare-target-$(target)-host-$(host)-$(PREPARE_STAGE))) # $(1) is stage # $(2) is target @@ -194,8 +188,7 @@ endef $(foreach host,$(CFG_HOST),\ $(foreach target,$(CFG_TARGET), \ - $(foreach stage,$(PREPARE_STAGES),\ - $(eval $(call DEF_PREPARE_TARGET_N,$(stage),$(target),$(host)))))) + $(eval $(call DEF_PREPARE_TARGET_N,$(PREPARE_STAGE),$(target),$(host))))) prepare-maybe-clean: $(if $(findstring true,$(PREPARE_CLEAN)),\