2012-12-11 02:32:48 +01:00
|
|
|
# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
2011-10-26 06:18:22 +02:00
|
|
|
# FIXME: Docs are currently not installed from the stageN dirs.
|
|
|
|
# For consistency it might be desirable for stageN to be an exact
|
|
|
|
# mirror of the installation directory structure.
|
|
|
|
|
2013-07-08 18:35:47 +02:00
|
|
|
# Installation macros.
|
|
|
|
# For INSTALL,
|
|
|
|
# $(1) is the source dirctory
|
|
|
|
# $(2) is the destination directory
|
|
|
|
# $(3) is the filename/libname-glob
|
2011-10-01 04:00:19 +02:00
|
|
|
ifdef VERBOSE
|
2013-11-02 04:23:22 +01:00
|
|
|
INSTALL = install -m755 $(1)/$(3) $(DESTDIR)$(2)/$(3)
|
2011-10-01 04:00:19 +02:00
|
|
|
else
|
2013-11-02 04:23:22 +01:00
|
|
|
INSTALL = $(Q)$(call E, install: $(DESTDIR)$(2)/$(3)) && install -m755 $(1)/$(3) $(DESTDIR)$(2)/$(3)
|
2011-10-01 04:00:19 +02:00
|
|
|
endif
|
|
|
|
|
2013-10-24 10:23:12 +02:00
|
|
|
# For MK_INSTALL_DIR
|
|
|
|
# $(1) is the directory to create
|
2013-11-02 04:23:22 +01:00
|
|
|
MK_INSTALL_DIR = (umask 022 && mkdir -p $(DESTDIR)$(1))
|
2013-10-24 10:23:12 +02:00
|
|
|
|
2013-07-08 18:35:47 +02:00
|
|
|
# For INSTALL_LIB,
|
|
|
|
# Target-specific $(LIB_SOURCE_DIR) is the source directory
|
|
|
|
# Target-specific $(LIB_DESTIN_DIR) is the destination directory
|
|
|
|
# $(1) is the filename/libname-glob
|
|
|
|
ifdef VERBOSE
|
2013-11-02 04:23:22 +01:00
|
|
|
DO_INSTALL_LIB = install -m644 `ls -drt1 $(LIB_SOURCE_DIR)/$(1) | tail -1` $(DESTDIR)$(LIB_DESTIN_DIR)/
|
2013-07-08 18:35:47 +02:00
|
|
|
else
|
2013-11-02 04:23:22 +01:00
|
|
|
DO_INSTALL_LIB = $(Q)$(call E, install_lib: $(DESTDIR)$(LIB_DESTIN_DIR)/$(1)) && \
|
|
|
|
install -m644 `ls -drt1 $(LIB_SOURCE_DIR)/$(1) | tail -1` $(DESTDIR)$(LIB_DESTIN_DIR)/
|
2013-07-08 18:35:47 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Target-specific $(LIB_SOURCE_DIR) is the source directory
|
|
|
|
# Target-specific $(LIB_DESTIN_DIR) is the destination directory
|
|
|
|
# $(1) is the filename/libname-glob
|
2013-07-04 16:51:45 +02:00
|
|
|
define INSTALL_LIB
|
2013-07-09 15:31:43 +02:00
|
|
|
$(if $(filter-out 1,$(words $(wildcard $(LIB_SOURCE_DIR)/$(1)))), \
|
|
|
|
$(error Aborting install because more than one library matching \
|
|
|
|
$(1) is present in build tree $(LIB_SOURCE_DIR): \
|
2013-07-08 18:35:47 +02:00
|
|
|
$(wildcard $(LIB_SOURCE_DIR)/$(1))))
|
2013-07-09 15:31:43 +02:00
|
|
|
$(Q)LIB_NAME="$(notdir $(lastword $(wildcard $(LIB_SOURCE_DIR)/$(1))))"; \
|
|
|
|
MATCHES="$(filter-out %$(notdir $(lastword $(wildcard $(LIB_SOURCE_DIR)/$(1)))),\
|
|
|
|
$(wildcard $(LIB_DESTIN_DIR)/$(1)))"; \
|
|
|
|
if [ -n "$$MATCHES" ]; then \
|
2013-11-01 23:28:12 +01:00
|
|
|
echo "warning: one or libraries matching Rust library '$(1)'" && \
|
2013-07-09 15:31:43 +02:00
|
|
|
echo " (other than '$$LIB_NAME' itself) already present" && \
|
|
|
|
echo " at destination $(LIB_DESTIN_DIR):" && \
|
|
|
|
echo $$MATCHES ; \
|
2013-07-08 18:35:47 +02:00
|
|
|
fi
|
|
|
|
$(call DO_INSTALL_LIB,$(1))
|
2013-07-04 16:51:45 +02:00
|
|
|
endef
|
|
|
|
|
2011-10-02 05:12:08 +02:00
|
|
|
# The stage we install from
|
2012-01-16 06:42:03 +01:00
|
|
|
ISTAGE = 2
|
2011-10-01 04:00:19 +02:00
|
|
|
|
|
|
|
PREFIX_ROOT = $(CFG_PREFIX)
|
|
|
|
PREFIX_BIN = $(PREFIX_ROOT)/bin
|
2012-02-25 03:29:44 +01:00
|
|
|
PREFIX_LIB = $(PREFIX_ROOT)/$(CFG_LIBDIR)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2013-03-04 11:14:24 +01:00
|
|
|
define INSTALL_PREPARE_N
|
2011-11-21 22:11:40 +01:00
|
|
|
# $(1) is the target triple
|
|
|
|
# $(2) is the host triple
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
# T{B,L} == Target {Bin, Lib} for stage ${ISTAGE}
|
2011-11-29 21:42:05 +01:00
|
|
|
TB$(1)$(2) = $$(TBIN$$(ISTAGE)_T_$(1)_H_$(2))
|
|
|
|
TL$(1)$(2) = $$(TLIB$$(ISTAGE)_T_$(1)_H_$(2))
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
# PT{R,B,L} == Prefix Target {Root, Bin, Lib}
|
2011-11-29 21:42:05 +01:00
|
|
|
PTR$(1)$(2) = $$(PREFIX_LIB)/rustc/$(1)
|
|
|
|
PTB$(1)$(2) = $$(PTR$(1)$(2))/bin
|
2012-02-25 03:29:44 +01:00
|
|
|
PTL$(1)$(2) = $$(PTR$(1)$(2))/$(CFG_LIBDIR)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2013-03-04 11:14:24 +01:00
|
|
|
endef
|
|
|
|
|
2013-10-21 11:18:21 +02:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(eval $(call INSTALL_PREPARE_N,$(target),$(CFG_BUILD))))
|
2013-03-04 11:14:24 +01:00
|
|
|
|
|
|
|
define INSTALL_TARGET_N
|
2013-07-08 18:35:47 +02:00
|
|
|
install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2))
|
|
|
|
install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2))
|
2013-03-04 11:14:24 +01:00
|
|
|
install-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
2013-10-24 10:23:12 +02:00
|
|
|
$$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2)))
|
2013-07-08 18:35:47 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_GLOB_$(1)))
|
2013-12-01 03:58:09 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_RGLOB_$(1)))
|
2013-07-08 18:35:47 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_GLOB_$(1)))
|
2013-12-01 03:58:09 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_RGLOB_$(1)))
|
2013-10-23 00:13:18 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTUV_GLOB_$(1)))
|
2013-12-01 03:58:09 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTUV_RGLOB_$(1)))
|
2013-07-08 18:35:47 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,libmorestack.a)
|
2013-03-04 11:14:24 +01:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define INSTALL_HOST_N
|
2013-07-08 18:35:47 +02:00
|
|
|
install-target-$(1)-host-$(2): LIB_SOURCE_DIR=$$(TL$(1)$(2))
|
|
|
|
install-target-$(1)-host-$(2): LIB_DESTIN_DIR=$$(PTL$(1)$(2))
|
2012-11-13 22:32:49 +01:00
|
|
|
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
2013-10-24 10:23:12 +02:00
|
|
|
$$(Q)$$(call MK_INSTALL_DIR,$$(PTL$(1)$(2)))
|
2013-07-14 07:50:54 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(CFG_RUSTLLVM_$(1)))
|
2013-07-08 18:35:47 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_GLOB_$(1)))
|
2013-12-01 03:58:09 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(STDLIB_RGLOB_$(1)))
|
2013-07-08 18:35:47 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_GLOB_$(1)))
|
2013-12-01 03:58:09 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(EXTRALIB_RGLOB_$(1)))
|
2013-10-23 00:13:18 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTUV_GLOB_$(1)))
|
2013-12-01 03:58:09 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTUV_RGLOB_$(1)))
|
2013-07-08 18:35:47 +02:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTC_GLOB_$(1)))
|
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(LIBSYNTAX_GLOB_$(1)))
|
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTPKG_GLOB_$(1)))
|
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(LIBRUSTDOC_GLOB_$(1)))
|
|
|
|
$$(Q)$$(call INSTALL_LIB,libmorestack.a)
|
2012-01-31 00:32:04 +01:00
|
|
|
|
2011-10-01 04:00:19 +02:00
|
|
|
endef
|
|
|
|
|
2013-10-21 11:18:21 +02:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(if $(findstring $(target), $(CFG_BUILD)), \
|
|
|
|
$(eval $(call INSTALL_HOST_N,$(target),$(CFG_BUILD))), \
|
|
|
|
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_BUILD)))))
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2013-10-21 11:18:21 +02:00
|
|
|
INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
|
|
|
|
install-target-$(target)-host-$(CFG_BUILD))
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-12-30 21:48:07 +01:00
|
|
|
install: all install-host install-targets
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
# Shorthand for build/stageN/bin
|
2013-10-21 11:18:21 +02:00
|
|
|
HB = $(HBIN$(ISTAGE)_H_$(CFG_BUILD))
|
|
|
|
HB2 = $(HBIN2_H_$(CFG_BUILD))
|
2011-11-21 22:11:40 +01:00
|
|
|
# Shorthand for build/stageN/lib
|
2013-10-21 11:18:21 +02:00
|
|
|
HL = $(HLIB$(ISTAGE)_H_$(CFG_BUILD))
|
2011-11-21 22:11:40 +01:00
|
|
|
# Shorthand for the prefix bin directory
|
|
|
|
PHB = $(PREFIX_BIN)
|
|
|
|
# Shorthand for the prefix bin directory
|
|
|
|
PHL = $(PREFIX_LIB)
|
|
|
|
|
2013-07-08 18:35:47 +02:00
|
|
|
install-host: LIB_SOURCE_DIR=$(HL)
|
|
|
|
install-host: LIB_DESTIN_DIR=$(PHL)
|
2013-10-21 11:18:21 +02:00
|
|
|
install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_)_H_$(CFG_BUILD_))
|
2013-10-24 10:23:12 +02:00
|
|
|
$(Q)$(call MK_INSTALL_DIR,$(PREFIX_BIN))
|
|
|
|
$(Q)$(call MK_INSTALL_DIR,$(PREFIX_LIB))
|
2013-10-31 11:04:39 +01:00
|
|
|
$(Q)$(call MK_INSTALL_DIR,$(CFG_MANDIR)/man1)
|
2013-10-21 11:18:21 +02:00
|
|
|
$(Q)$(call INSTALL,$(HB2),$(PHB),rustc$(X_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL,$(HB2),$(PHB),rustpkg$(X_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(STDLIB_GLOB_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(EXTRALIB_GLOB_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(LIBRUSTUV_GLOB_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(LIBRUSTC_GLOB_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(LIBSYNTAX_GLOB_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD)))
|
|
|
|
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD)))
|
2013-11-02 04:23:22 +01:00
|
|
|
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustc.1)
|
|
|
|
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustdoc.1)
|
|
|
|
$(Q)$(call INSTALL,$(S)/man,$(CFG_MANDIR)/man1,rustpkg.1)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
|
|
|
install-targets: $(INSTALL_TARGET_RULES)
|
2012-01-31 00:32:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
HOST_LIB_FROM_HL_GLOB = \
|
2012-07-12 00:04:32 +02:00
|
|
|
$(patsubst $(HL)/%,$(PHL)/%,$(wildcard $(HL)/$(1)))
|
2012-01-31 00:32:04 +01:00
|
|
|
|
|
|
|
uninstall:
|
2013-10-21 11:18:21 +02:00
|
|
|
$(Q)rm -f $(PHB)/rustc$(X_$(CFG_BUILD))
|
|
|
|
$(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD))
|
|
|
|
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD))
|
|
|
|
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD))
|
2012-01-31 00:32:04 +01:00
|
|
|
$(Q)for i in \
|
2013-10-21 11:18:21 +02:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB_$(CFG_BUILD))) \
|
Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.
When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.
Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.
Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:
* If both a .dylib and .rlib are found for a rust library, the compiler will
prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
overridable by explicitly saying what flavor you'd like (rlib, staticlib,
dylib).
* If no options are passed to the command line, and no crate_type is found in
the destination crate, then an executable is generated
With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.
This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.
Closes #552
2013-11-15 23:03:29 +01:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_RGLOB_$(CFG_BUILD))) \
|
2013-10-21 11:18:21 +02:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(EXTRALIB_GLOB_$(CFG_BUILD))) \
|
Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.
When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.
Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.
Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:
* If both a .dylib and .rlib are found for a rust library, the compiler will
prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
overridable by explicitly saying what flavor you'd like (rlib, staticlib,
dylib).
* If no options are passed to the command line, and no crate_type is found in
the destination crate, then an executable is generated
With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.
This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.
Closes #552
2013-11-15 23:03:29 +01:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(EXTRALIB_RGLOB_$(CFG_BUILD))) \
|
2013-10-21 11:18:21 +02:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTUV_GLOB_$(CFG_BUILD))) \
|
Add generation of static libraries to rustc
This commit implements the support necessary for generating both intermediate
and result static rust libraries. This is an implementation of my thoughts in
https://mail.mozilla.org/pipermail/rust-dev/2013-November/006686.html.
When compiling a library, we still retain the "lib" option, although now there
are "rlib", "staticlib", and "dylib" as options for crate_type (and these are
stackable). The idea of "lib" is to generate the "compiler default" instead of
having too choose (although all are interchangeable). For now I have left the
"complier default" to be a dynamic library for size reasons.
Of the rust libraries, lib{std,extra,rustuv} will bootstrap with an
rlib/dylib pair, but lib{rustc,syntax,rustdoc,rustpkg} will only be built as a
dynamic object. I chose this for size reasons, but also because you're probably
not going to be embedding the rustc compiler anywhere any time soon.
Other than the options outlined above, there are a few defaults/preferences that
are now opinionated in the compiler:
* If both a .dylib and .rlib are found for a rust library, the compiler will
prefer the .rlib variant. This is overridable via the -Z prefer-dynamic option
* If generating a "lib", the compiler will generate a dynamic library. This is
overridable by explicitly saying what flavor you'd like (rlib, staticlib,
dylib).
* If no options are passed to the command line, and no crate_type is found in
the destination crate, then an executable is generated
With this change, you can successfully build a rust program with 0 dynamic
dependencies on rust libraries. There is still a dynamic dependency on
librustrt, but I plan on removing that in a subsequent commit.
This change includes no tests just yet. Our current testing
infrastructure/harnesses aren't very amenable to doing flavorful things with
linking, so I'm planning on adding a new mode of testing which I believe belongs
as a separate commit.
Closes #552
2013-11-15 23:03:29 +01:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTUV_RGLOB_$(CFG_BUILD))) \
|
2013-10-21 11:18:21 +02:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTC_GLOB_$(CFG_BUILD))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBSYNTAX_GLOB_$(CFG_BUILD))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD))) \
|
2012-01-31 00:32:04 +01:00
|
|
|
; \
|
|
|
|
do rm -f $$i ; \
|
|
|
|
done
|
|
|
|
$(Q)rm -Rf $(PHL)/rustc
|
2013-10-22 06:35:45 +02:00
|
|
|
$(Q)rm -f $(CFG_MANDIR)/man1/rustc.1
|
|
|
|
$(Q)rm -f $(CFG_MANDIR)/man1/rustdoc.1
|
|
|
|
$(Q)rm -f $(CFG_MANDIR)/man1/rusti.1
|
|
|
|
$(Q)rm -f $(CFG_MANDIR)/man1/rustpkg.1
|
2013-05-01 11:49:19 +02:00
|
|
|
|
|
|
|
# target platform specific variables
|
|
|
|
# for arm-linux-androidabi
|
2013-05-03 17:47:54 +02:00
|
|
|
define DEF_ADB_DEVICE_STATUS
|
|
|
|
CFG_ADB_DEVICE_STATUS=$(1)
|
2013-05-01 11:49:19 +02:00
|
|
|
endef
|
|
|
|
|
2013-10-21 11:18:21 +02:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-05-01 11:49:19 +02:00
|
|
|
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(if $(findstring adb,$(CFG_ADB)), \
|
2013-08-07 13:42:44 +02:00
|
|
|
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(info install: install-runtime-target for $(target) enabled \
|
2013-05-01 11:49:19 +02:00
|
|
|
$(info install: android device attached) \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
|
|
|
|
$(info install: install-runtime-target for $(target) disabled \
|
2013-05-01 11:49:19 +02:00
|
|
|
$(info install: android device not attached) \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
2013-05-01 11:49:19 +02:00
|
|
|
), \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(info install: install-runtime-target for $(target) disabled \
|
2013-05-01 11:49:19 +02:00
|
|
|
$(info install: adb not found) \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
2013-05-01 11:49:19 +02:00
|
|
|
), \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
|
2013-05-03 17:47:54 +02:00
|
|
|
ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
|
|
|
|
$(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
|
|
|
|
L_TOKEN := $(word 2,$(MAKECMDGOALS))
|
|
|
|
ifeq ($(L_TOKEN),)
|
2013-05-03 04:14:01 +02:00
|
|
|
CFG_RUNTIME_PUSH_DIR=/system/lib
|
2013-05-03 17:47:54 +02:00
|
|
|
else
|
|
|
|
CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
|
|
|
|
endif
|
2013-05-03 04:14:01 +02:00
|
|
|
|
2013-05-03 17:47:54 +02:00
|
|
|
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
|
2013-05-01 11:49:19 +02:00
|
|
|
ifdef VERBOSE
|
|
|
|
ADB = adb $(1)
|
|
|
|
ADB_PUSH = adb push $(1) $(2)
|
2013-05-07 03:09:34 +02:00
|
|
|
ADB_SHELL = adb shell $(1) $(2)
|
2013-05-01 11:49:19 +02:00
|
|
|
else
|
2013-05-07 03:09:34 +02:00
|
|
|
ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
|
2013-05-03 17:47:54 +02:00
|
|
|
ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
|
|
|
|
ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
|
2013-05-01 11:49:19 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
define INSTALL_RUNTIME_TARGET_N
|
|
|
|
install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
2013-05-03 04:14:01 +02:00
|
|
|
$(Q)$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
|
|
|
|
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(STDLIB_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR))
|
2013-05-17 19:45:09 +02:00
|
|
|
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(EXTRALIB_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR))
|
2013-10-23 00:13:18 +02:00
|
|
|
$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(LIBRUSTUV_GLOB_$(1)),$(CFG_RUNTIME_PUSH_DIR))
|
2013-05-01 11:49:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define INSTALL_RUNTIME_TARGET_CLEANUP_N
|
|
|
|
install-runtime-target-$(1)-cleanup:
|
|
|
|
$(Q)$(call ADB,remount)
|
2013-05-03 04:14:01 +02:00
|
|
|
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(STDLIB_GLOB_$(1)))
|
2013-05-17 19:45:09 +02:00
|
|
|
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(EXTRALIB_GLOB_$(1)))
|
2013-10-23 00:13:18 +02:00
|
|
|
$(Q)$(call ADB_SHELL,rm,$(CFG_RUNTIME_PUSH_DIR)/$(LIBRUSTUV_GLOB_$(1)))
|
2013-05-01 11:49:19 +02:00
|
|
|
endef
|
|
|
|
|
2013-10-21 11:18:21 +02:00
|
|
|
$(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD)))
|
2013-05-01 11:49:19 +02:00
|
|
|
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
|
|
|
|
|
|
|
|
install-runtime-target: \
|
|
|
|
install-runtime-target-arm-linux-androideabi-cleanup \
|
2013-10-21 11:18:21 +02:00
|
|
|
install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
|
2013-05-01 11:49:19 +02:00
|
|
|
else
|
2013-05-07 03:09:34 +02:00
|
|
|
install-runtime-target:
|
2013-05-03 17:47:54 +02:00
|
|
|
@echo "No device to install runtime library"
|
2013-05-07 03:09:34 +02:00
|
|
|
@echo
|
2013-05-03 17:47:54 +02:00
|
|
|
endif
|
2013-05-01 11:49:19 +02:00
|
|
|
endif
|