2012-12-11 01:32:48 +00: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.
|
|
|
|
|
2013-05-25 06:05:31 +00:00
|
|
|
# This is the compile-time target-triple for the compiler. For the compiler at
|
|
|
|
# runtime, this should be considered the host-triple. More explanation for why
|
|
|
|
# this exists can be found on issue #2400
|
|
|
|
export CFG_COMPILER_TRIPLE
|
|
|
|
|
2011-10-02 03:12:08 +00:00
|
|
|
# TARGET_STAGE_N template: This defines how target artifacts are built
|
2011-11-21 21:11:40 +00:00
|
|
|
# for all stage/target architecture combinations. The arguments:
|
|
|
|
# $(1) is the stage
|
|
|
|
# $(2) is the target triple
|
|
|
|
# $(3) is the host triple
|
2011-10-02 03:12:08 +00:00
|
|
|
|
2012-01-09 22:08:08 +00:00
|
|
|
|
2011-10-02 03:12:08 +00:00
|
|
|
define TARGET_STAGE_N
|
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
|
2013-05-24 06:49:20 +00:00
|
|
|
rt/$(2)/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \
|
2013-05-03 16:53:47 +00:00
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2011-11-29 01:23:13 +00:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2013-02-27 05:53:35 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
|
2013-05-24 06:49:20 +00:00
|
|
|
rt/$(2)/stage$(1)/$(CFG_RUNTIME_$(2)) \
|
2013-05-03 16:53:47 +00:00
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2011-10-02 03:12:08 +00:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2013-05-17 17:45:09 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
|
|
|
|
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
|
2013-05-03 16:53:47 +00:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2012-03-22 22:27:35 +00:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
|
|
|
|
|
2013-05-17 17:45:09 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)): \
|
|
|
|
$$(EXTRALIB_CRATE) $$(EXTRALIB_INPUTS) \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) \
|
2013-05-03 16:53:47 +00:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2012-11-07 03:44:58 +00:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2013-02-22 00:15:01 +00:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
|
2012-11-07 03:44:58 +00:00
|
|
|
|
2013-02-27 05:53:35 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
|
2012-05-30 04:35:12 +00:00
|
|
|
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
|
2011-12-20 10:17:13 +00:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
2013-05-17 17:45:09 +00:00
|
|
|
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
|
|
|
|
$$(TEXTRALIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
|
2013-05-03 16:53:47 +00:00
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2011-10-02 03:12:08 +00:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2012-04-26 23:02:01 +00:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
|
2011-10-02 03:12:08 +00:00
|
|
|
|
2013-02-22 00:15:01 +00:00
|
|
|
# Only build the compiler for host triples
|
|
|
|
ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),)
|
|
|
|
|
2013-02-27 05:53:35 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
|
2013-05-03 16:53:47 +00:00
|
|
|
rustllvm/$(2)/$(CFG_RUSTLLVM_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2012-01-06 20:06:35 +00:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2013-05-25 06:05:31 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): CFG_COMPILER_TRIPLE = $(2)
|
2013-02-27 05:53:35 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
|
2013-02-22 00:15:01 +00:00
|
|
|
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
|
2013-02-27 05:53:35 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
|
2013-05-03 16:53:47 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2012-03-16 14:14:33 +00:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2012-03-22 15:39:41 +00:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
|
2012-03-16 14:14:33 +00:00
|
|
|
|
2013-03-02 12:25:12 +00:00
|
|
|
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
|
2013-05-03 16:53:47 +00:00
|
|
|
$$(DRIVER_CRATE) \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)) \
|
2013-05-04 10:46:11 +00:00
|
|
|
| $$(TBIN$(1)_T_$(2)_H_$(3))/
|
2012-05-22 18:40:46 +00:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2013-02-22 00:15:01 +00:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
|
|
|
|
ifdef CFG_ENABLE_PAX_FLAGS
|
|
|
|
@$$(call E, apply PaX flags: $$@)
|
|
|
|
@"$(CFG_PAXCTL)" -cm "$$@"
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
2012-05-22 18:40:46 +00:00
|
|
|
|
2013-05-04 10:46:11 +00:00
|
|
|
$$(TBIN$(1)_T_$(2)_H_$(3))/:
|
|
|
|
mkdir -p $$@
|
|
|
|
|
2013-05-07 06:29:05 +00:00
|
|
|
ifneq ($(CFG_LIBDIR),bin)
|
2013-05-03 16:53:47 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/:
|
2013-05-04 08:57:56 +00:00
|
|
|
mkdir -p $$@
|
2013-05-07 06:29:05 +00:00
|
|
|
endif
|
2013-05-03 16:53:47 +00:00
|
|
|
|
2012-05-22 18:40:46 +00:00
|
|
|
endef
|
|
|
|
|
2011-11-22 21:04:52 +00:00
|
|
|
# In principle, each host can build each target:
|
2013-02-22 00:15:01 +00:00
|
|
|
$(foreach source,$(CFG_HOST_TRIPLES), \
|
2012-03-16 14:14:33 +00:00
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
2012-01-06 20:06:35 +00:00
|
|
|
$(eval $(call TARGET_STAGE_N,0,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_STAGE_N,1,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_STAGE_N,2,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_STAGE_N,3,$(target),$(source)))))
|