mirror of
https://github.com/rust-lang/rust
synced 2024-09-05 16:57:03 +00:00
Have 'make install' do something close to useful
We'll copy the files to the right location. Still need to rpath. Issue #529
This commit is contained in:
parent
42287d0fd3
commit
9563c17d78
15
Makefile.in
15
Makefile.in
|
@ -163,16 +163,16 @@ LLC := $(CFG_LLVM_BINDIR)/llc$(X)
|
||||||
|
|
||||||
define SREQ
|
define SREQ
|
||||||
|
|
||||||
# Destinations of artifacts for target architectures
|
|
||||||
TARGET_ROOT$(1)$(2) = stage$(1)/lib/rustc/$(2)
|
|
||||||
TARGET_BIN$(1)$(2) = $$(TARGET_ROOT$(1)$(2))/bin
|
|
||||||
TARGET_LIB$(1)$(2) = $$(TARGET_ROOT$(1)$(2))/lib
|
|
||||||
|
|
||||||
# Destinations of artifacts for the host compiler
|
# Destinations of artifacts for the host compiler
|
||||||
HOST_ROOT$(1) = stage$(1)
|
HOST_ROOT$(1) = stage$(1)
|
||||||
HOST_BIN$(1) = $$(HOST_ROOT$(1))/bin
|
HOST_BIN$(1) = $$(HOST_ROOT$(1))/bin
|
||||||
HOST_LIB$(1) = $$(HOST_ROOT$(1))/lib
|
HOST_LIB$(1) = $$(HOST_ROOT$(1))/lib
|
||||||
|
|
||||||
|
# Destinations of artifacts for target architectures
|
||||||
|
TARGET_ROOT$(1)$(2) = $$(HOST_LIB$(1))/rustc/$(2)
|
||||||
|
TARGET_BIN$(1)$(2) = $$(TARGET_ROOT$(1)$(2))/bin
|
||||||
|
TARGET_LIB$(1)$(2) = $$(TARGET_ROOT$(1)$(2))/lib
|
||||||
|
|
||||||
# The target locations of artifacts for the host architecture (used for
|
# The target locations of artifacts for the host architecture (used for
|
||||||
# promoting target binaries to host binaries)
|
# promoting target binaries to host binaries)
|
||||||
TARGET_HOST_ROOT$(1) = $$(TARGET_ROOT$(1)$$(CFG_HOST_TRIPLE))
|
TARGET_HOST_ROOT$(1) = $$(TARGET_ROOT$(1)$$(CFG_HOST_TRIPLE))
|
||||||
|
@ -318,3 +318,8 @@ ifneq ($(findstring clean,$(MAKECMDGOALS)),)
|
||||||
CFG_INFO := $(info cfg: including clean rules)
|
CFG_INFO := $(info cfg: including clean rules)
|
||||||
include $(CFG_SRC_DIR)/mk/clean.mk
|
include $(CFG_SRC_DIR)/mk/clean.mk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(findstring install,$(MAKECMDGOALS)),)
|
||||||
|
CFG_INFO := $(info cfg: including install rules)
|
||||||
|
include $(CFG_SRC_DIR)/mk/install.mk
|
||||||
|
endif
|
7
configure
vendored
7
configure
vendored
|
@ -339,6 +339,11 @@ else
|
||||||
CFG_C_COMPILER="gcc"
|
CFG_C_COMPILER="gcc"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CFG_PREFIX" ]
|
||||||
|
then
|
||||||
|
CFG_PREFIX=/usr/local
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -z "$CFG_LLVM_TRIPLE" ]
|
if [ ! -z "$CFG_LLVM_TRIPLE" ]
|
||||||
then
|
then
|
||||||
if [ $CFG_HOST_TRIPLE != $CFG_LLVM_TRIPLE ]
|
if [ $CFG_HOST_TRIPLE != $CFG_LLVM_TRIPLE ]
|
||||||
|
@ -357,8 +362,8 @@ CFG_TARGET_TRIPLES="${CFG_HOST_TRIPLE}"
|
||||||
putvar CFG_HOST_TRIPLE
|
putvar CFG_HOST_TRIPLE
|
||||||
putvar CFG_TARGET_TRIPLES
|
putvar CFG_TARGET_TRIPLES
|
||||||
|
|
||||||
|
|
||||||
putvar CFG_C_COMPILER
|
putvar CFG_C_COMPILER
|
||||||
|
putvar CFG_PREFIX
|
||||||
|
|
||||||
putvar CFG_LLVM_ROOT
|
putvar CFG_LLVM_ROOT
|
||||||
putvar CFG_LLVM_INCDIR
|
putvar CFG_LLVM_INCDIR
|
||||||
|
|
53
mk/install.mk
Normal file
53
mk/install.mk
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
ifdef VERBOSE
|
||||||
|
INSTALL = cp $(1)/$(3) $(2)/$(3)
|
||||||
|
else
|
||||||
|
INSTALL = @$(call E, install $(2)/$(3)) && cp $(1)/$(3) $(2)/$(3)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ISTAGE = 1
|
||||||
|
|
||||||
|
PREFIX_ROOT = $(CFG_PREFIX)
|
||||||
|
PREFIX_BIN = $(PREFIX_ROOT)/bin
|
||||||
|
PREFIX_LIB = $(PREFIX_ROOT)/lib
|
||||||
|
|
||||||
|
HB = $(HOST_BIN$(ISTAGE))
|
||||||
|
HL = $(HOST_LIB$(ISTAGE))
|
||||||
|
PHB = $(PREFIX_BIN)
|
||||||
|
PHL = $(PREFIX_LIB)
|
||||||
|
|
||||||
|
define INSTALL_TARGET_N
|
||||||
|
|
||||||
|
PREFIX_TARGET_ROOT$(1) = $$(PREFIX_LIB)/rustc/$(1)
|
||||||
|
PREFIX_TARGET_BIN$(1) = $$(PREFIX_TARGET_ROOT$(1))/bin
|
||||||
|
PREFIX_TARGET_LIB$(1) = $$(PREFIX_TARGET_ROOT$(1))/lib
|
||||||
|
|
||||||
|
TB$(1) = $$(TARGET_BIN$$(ISTAGE)$(1))
|
||||||
|
TL$(1) = $$(TARGET_LIB$$(ISTAGE)$(1))
|
||||||
|
PTB$(1) = $$(PREFIX_TARGET_BIN$(1))
|
||||||
|
PTL$(1) = $$(PREFIX_TARGET_LIB$(1))
|
||||||
|
|
||||||
|
install-target$(1): $$(SREQ$$(ISTAGE)$(1))
|
||||||
|
$(Q)mkdir -p $$(PREFIX_TARGET_LIB$(1))
|
||||||
|
$(Q)$(call INSTALL,$$(TL$(1)),$$(PTL$(1)),$$(CFG_RUNTIME))
|
||||||
|
$(Q)$(call INSTALL,$$(TL$(1)),$$(PTL$(1)),$$(CFG_STDLIB))
|
||||||
|
$(Q)$(call INSTALL,$$(TL$(1)),$$(PTL$(1)),intrinsics.bc)
|
||||||
|
$(Q)$(call INSTALL,$$(TL$(1)),$$(PTL$(1)),main.o)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
||||||
|
$(eval $(call INSTALL_TARGET_N,$(target))))
|
||||||
|
|
||||||
|
INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \
|
||||||
|
install-target$(target))
|
||||||
|
|
||||||
|
install: install-host install-targets
|
||||||
|
|
||||||
|
install-host: $(SREQ$(ISTAGE)$(CFG_HOST_TRIPLE))
|
||||||
|
$(Q)mkdir -p $(PREFIX_BIN)
|
||||||
|
$(Q)mkdir -p $(PREFIX_LIB)
|
||||||
|
$(Q)$(call INSTALL,$(HB),$(PHB),rustc$(X))
|
||||||
|
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME))
|
||||||
|
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_STDLIB))
|
||||||
|
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM))
|
||||||
|
|
||||||
|
install-targets: $(INSTALL_TARGET_RULES)
|
Loading…
Reference in a new issue