Skip to content

Commit 995a019

Browse files
committed
mk: install/uninstall for multiple target
1 parent 23eb105 commit 995a019

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

mk/install.mk

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ PREFIX_ROOT = $(CFG_PREFIX)
3030
PREFIX_BIN = $(PREFIX_ROOT)/bin
3131
PREFIX_LIB = $(PREFIX_ROOT)/$(CFG_LIBDIR)
3232

33-
define INSTALL_TARGET_N
33+
define INSTALL_PREPARE_N
3434
# $(1) is the target triple
3535
# $(2) is the host triple
3636

@@ -43,6 +43,24 @@ PTR$(1)$(2) = $$(PREFIX_LIB)/rustc/$(1)
4343
PTB$(1)$(2) = $$(PTR$(1)$(2))/bin
4444
PTL$(1)$(2) = $$(PTR$(1)$(2))/$(CFG_LIBDIR)
4545

46+
endef
47+
48+
$(foreach target,$(CFG_TARGET_TRIPLES), \
49+
$(eval $(call INSTALL_PREPARE_N,$(target),$(CFG_BUILD_TRIPLE))))
50+
51+
define INSTALL_TARGET_N
52+
install-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
53+
$$(Q)mkdir -p $$(PTL$(1)$(2))
54+
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
55+
$$(Q)$$(call INSTALL_LIB, \
56+
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB_$(1)))
57+
$$(Q)$$(call INSTALL_LIB, \
58+
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(STDLIB_GLOB_$(1)))
59+
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
60+
61+
endef
62+
63+
define INSTALL_HOST_N
4664
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
4765
$$(Q)mkdir -p $$(PTL$(1)$(2))
4866
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
@@ -67,7 +85,9 @@ install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
6785
endef
6886

6987
$(foreach target,$(CFG_TARGET_TRIPLES), \
70-
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_BUILD_TRIPLE))))
88+
$(if $(findstring $(target), $(CFG_BUILD_TRIPLE)), \
89+
$(eval $(call INSTALL_HOST_N,$(target),$(CFG_BUILD_TRIPLE))), \
90+
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_BUILD_TRIPLE)))))
7191

7292
INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \
7393
install-target-$(target)-host-$(CFG_BUILD_TRIPLE))

0 commit comments

Comments
 (0)