2012-12-10 19:32:48 -06: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 01:05:31 -05: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
|
2013-10-21 04:18:21 -05:00
|
|
|
export CFG_COMPILER
|
2013-05-25 01:05:31 -05:00
|
|
|
|
2013-06-25 19:02:03 -05:00
|
|
|
# The standard libraries should be held up to a higher standard than any old
|
|
|
|
# code, make sure that these common warnings are denied by default. These can
|
2013-10-16 13:27:24 -05:00
|
|
|
# be overridden during development temporarily. For stage0, we allow warnings
|
|
|
|
# which may be bugs in stage0 (should be fixed in stage1+)
|
|
|
|
WFLAGS_ST0 = -W warnings
|
2013-06-25 19:02:03 -05:00
|
|
|
WFLAGS_ST1 = -D warnings
|
|
|
|
WFLAGS_ST2 = -D warnings
|
|
|
|
|
2011-10-01 22:12:08 -05:00
|
|
|
# TARGET_STAGE_N template: This defines how target artifacts are built
|
2011-11-21 15:11:40 -06: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-01 22:12:08 -05:00
|
|
|
|
2013-08-31 17:53:56 -05:00
|
|
|
# Every recipe in TARGET_STAGE_N outputs to $$(TLIB$(1)_T_$(2)_H_$(3),
|
|
|
|
# a directory that can be cleaned out during the middle of a run of
|
|
|
|
# the get-snapshot.py script. Therefore, every recipe needs to have
|
|
|
|
# an order-only dependency either on $(SNAPSHOT_RUSTC_POST_CLEANUP) or
|
|
|
|
# on $$(TSREQ$(1)_T_$(2)_H_$(3)), to ensure that no products will be
|
|
|
|
# put into the target area until after the get-snapshot.py script has
|
|
|
|
# had its chance to clean it out; otherwise the other products will be
|
|
|
|
# inadvertantly included in the clean out.
|
2012-01-09 16:08:08 -06:00
|
|
|
|
2013-10-21 04:18:21 -05:00
|
|
|
SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
|
2013-09-26 16:56:53 -05:00
|
|
|
|
2011-10-01 22:12:08 -05:00
|
|
|
define TARGET_STAGE_N
|
|
|
|
|
2011-11-21 15:11:40 -06:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
|
2013-09-04 02:45:01 -05:00
|
|
|
$(2)/rt/stage$(1)/arch/$$(HOST_$(2))/libmorestack.a \
|
2013-08-31 14:44:50 -05:00
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
|
2013-08-31 17:53:56 -05:00
|
|
|
$(SNAPSHOT_RUSTC_POST_CLEANUP)
|
2011-11-28 19:23:13 -06:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2013-02-26 23:53:35 -06:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
|
2013-09-04 02:45:01 -05:00
|
|
|
$(2)/rt/stage$(1)/$(CFG_RUNTIME_$(2)) \
|
2013-08-31 14:44:50 -05:00
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
|
2013-08-31 17:53:56 -05:00
|
|
|
$(SNAPSHOT_RUSTC_POST_CLEANUP)
|
2011-10-01 22:12:08 -05:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2013-05-17 12:45:09 -05:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
|
|
|
|
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
|
2013-05-03 11:53:47 -05:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2012-03-22 17:27:35 -05:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2014-01-04 19:55:20 -06:00
|
|
|
ifeq ($(1),0)
|
|
|
|
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
|
|
|
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
|
|
|
endif
|
2013-07-08 11:35:47 -05:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
|
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 16:03:29 -06:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_RGLOB_$(2)),$$(notdir $$@))
|
2013-07-30 17:40:19 -05:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
|
2013-07-08 11:35:47 -05:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_GLOB_$(2)),$$(notdir $$@))
|
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 16:03:29 -06:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(STDLIB_RGLOB_$(2)),$$(notdir $$@))
|
2012-03-22 17:27:35 -05:00
|
|
|
|
2013-05-17 12:45:09 -05: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 11:53:47 -05:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2012-11-06 21:44:58 -06:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2014-01-04 19:55:20 -06:00
|
|
|
ifeq ($(1),0)
|
|
|
|
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
|
|
|
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
|
|
|
endif
|
2013-07-08 11:35:47 -05:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
|
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 16:03:29 -06:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_RGLOB_$(2)),$$(notdir $$@))
|
2013-07-30 17:40:19 -05:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) --out-dir $$(@D) $$< && touch $$@
|
2013-07-08 11:35:47 -05:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_GLOB_$(2)),$$(notdir $$@))
|
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 16:03:29 -06:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(EXTRALIB_RGLOB_$(2)),$$(notdir $$@))
|
2012-11-06 21:44:58 -06:00
|
|
|
|
2013-10-22 17:13:18 -05:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTUV_$(2)): \
|
|
|
|
$$(LIBRUSTUV_CRATE) $$(LIBRUSTUV_INPUTS) \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) \
|
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
2013-10-31 01:57:27 -05:00
|
|
|
$$(LIBUV_LIB_$(2)) \
|
|
|
|
$$(UV_SUPPORT_LIB_$(2)) \
|
2013-10-22 17:13:18 -05:00
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
|
|
|
@$$(call E, compile_and_link: $$@)
|
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(2)),$$(notdir $$@))
|
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 16:03:29 -06:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_RGLOB_$(2)),$$(notdir $$@))
|
2013-10-31 01:57:27 -05:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
|
|
|
|
-L $$(UV_SUPPORT_DIR_$(2)) \
|
|
|
|
-L $$(dir $$(LIBUV_LIB_$(2))) \
|
|
|
|
--out-dir $$(@D) $$< && touch $$@
|
2013-10-22 17:13:18 -05:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_GLOB_$(2)),$$(notdir $$@))
|
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 16:03:29 -06:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTUV_RGLOB_$(2)),$$(notdir $$@))
|
2013-10-22 17:13:18 -05:00
|
|
|
|
2013-12-12 20:07:23 -06:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBGREEN_$(2)): \
|
|
|
|
$$(LIBGREEN_CRATE) $$(LIBGREEN_INPUTS) \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) \
|
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
|
|
|
@$$(call E, compile_and_link: $$@)
|
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBGREEN_GLOB_$(2)),$$(notdir $$@))
|
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBGREEN_RGLOB_$(2)),$$(notdir $$@))
|
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
|
|
|
|
--out-dir $$(@D) $$< && touch $$@
|
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBGREEN_GLOB_$(2)),$$(notdir $$@))
|
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBGREEN_RGLOB_$(2)),$$(notdir $$@))
|
|
|
|
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBNATIVE_$(2)): \
|
|
|
|
$$(LIBNATIVE_CRATE) $$(LIBNATIVE_INPUTS) \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) \
|
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
|
|
|
@$$(call E, compile_and_link: $$@)
|
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBNATIVE_GLOB_$(2)),$$(notdir $$@))
|
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBNATIVE_RGLOB_$(2)),$$(notdir $$@))
|
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
|
|
|
|
--out-dir $$(@D) $$< && touch $$@
|
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBNATIVE_GLOB_$(2)),$$(notdir $$@))
|
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBNATIVE_RGLOB_$(2)),$$(notdir $$@))
|
|
|
|
|
2013-02-26 23:53:35 -06:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
|
2012-05-29 23:35:12 -05:00
|
|
|
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
|
2011-12-20 04:17:13 -06:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
2013-05-17 12:45:09 -05:00
|
|
|
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
|
|
|
|
$$(TEXTRALIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
|
2013-05-03 11:53:47 -05:00
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2011-10-01 22:12:08 -05:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2014-01-04 19:55:20 -06:00
|
|
|
ifeq ($(1),0)
|
|
|
|
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
|
|
|
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
|
|
|
endif
|
2013-07-08 11:35:47 -05:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
|
2013-11-30 22:52:21 -06:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
|
2013-08-17 10:37:12 -05:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) $(BORROWCK) --out-dir $$(@D) $$< && touch $$@
|
2013-07-08 11:35:47 -05:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_GLOB_$(2)),$$(notdir $$@))
|
2013-11-30 22:52:21 -06:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBSYNTAX_RGLOB_$(2)),$$(notdir $$@))
|
2011-10-01 22:12:08 -05:00
|
|
|
|
2013-02-21 18:15:01 -06:00
|
|
|
# Only build the compiler for host triples
|
2013-10-21 04:18:21 -05:00
|
|
|
ifneq ($$(findstring $(2),$$(CFG_HOST)),)
|
2013-02-21 18:15:01 -06:00
|
|
|
|
2013-02-26 23:53:35 -06:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
|
2013-09-04 01:48:45 -05:00
|
|
|
$(2)/rustllvm/$(CFG_RUSTLLVM_$(3)) \
|
2013-08-31 14:44:50 -05:00
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/ \
|
2013-08-31 17:53:56 -05:00
|
|
|
$(SNAPSHOT_RUSTC_POST_CLEANUP)
|
2012-01-06 14:06:35 -06:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2013-10-21 04:18:21 -05:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): CFG_COMPILER = $(2)
|
2013-02-26 23:53:35 -06:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
|
2013-02-21 18:15:01 -06:00
|
|
|
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
|
2013-11-30 22:52:21 -06:00
|
|
|
$(S)src/librustc/lib/llvmdeps.rs \
|
Add dependence arc from running rustc to its libraries.
This commit fixes some oversights in the Makefile where rustc could be
invoked without some of its dependencies yet in place. (I encountered
the problem in practice; its not just theoretical.)
As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one
writes an invocation of rustc where $(1) is the stage number $(2) is
the target triple $(3) is the host triple. (Other uses of the macro
may plug in actual values or different parameters in for those three
formal parameters.)
When you have invocations of $(STAGE...), you need to make sure that
its dependences are satisfied; otherwise, if someone is using `make
-jN` for certain (large-ish) `N`, one can encounter situations where
GNU make attempts to invoke `rustc` before it has actually copied some
of its libraries into place, such as libmorestack.a, which causes a
link failure when the rustc invocation attempts to link in those
libraries.
In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3),
which is described in Makefile.in as "Prerequisites for using the
stageN compiler to build target artifacts"
----
In addition to adding the extra dependences on TSREQ..., I also
replaced occurrences of the pattern:
TSREQ$(1)_T_$(2)_H_$(3)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2))
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2))
with:
SREQ$(1)_T_$(2)_H_$(3)
which is equivalent to the above, as defined in Makefile.in
----
Finally, for the cases where TSREQ was missing in tests.mk, I went
ahead and put in a dependence on SREQ rather than just TSREQ, since it
was not clear to me how one could expect to compile those cases
without stdlib and extralib.
(It could well be that I should have gone ahead and done the same in
other cases where I saw TSREQ was missing, and put SREQ in those
cases as well. But this seemed like a good measure for now, without
needing to tax my understanding of the overall makefile
infrastructure much further.)
2013-07-16 01:05:18 -05:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
2013-02-26 23:53:35 -06:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
|
2013-05-03 11:53:47 -05:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
|
|
|
|
| $$(TLIB$(1)_T_$(2)_H_$(3))/
|
2012-03-16 09:14:33 -05:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2014-01-04 19:55:20 -06:00
|
|
|
ifeq ($(1),0)
|
|
|
|
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
|
|
|
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
|
|
|
endif
|
2013-07-08 11:35:47 -05:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
|
2013-11-30 22:52:21 -06:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
|
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $$(WFLAGS_ST$(1)) \
|
2013-12-07 12:38:32 -06:00
|
|
|
-L "$$(LLVM_LIBDIR_$(2))" \
|
2013-11-30 22:52:21 -06:00
|
|
|
--out-dir $$(@D) $$< && touch $$@
|
2013-07-08 11:35:47 -05:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_GLOB_$(2)),$$(notdir $$@))
|
2013-11-30 22:52:21 -06:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES_EXCEPT,$$(dir $$@),$(LIBRUSTC_RGLOB_$(2)),$$(notdir $$@))
|
2012-03-16 09:14:33 -05:00
|
|
|
|
2013-03-02 06:25:12 -06:00
|
|
|
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
|
2013-05-03 11:53:47 -05:00
|
|
|
$$(DRIVER_CRATE) \
|
2013-12-13 23:14:08 -06:00
|
|
|
$$(SREQ$(1)_T_$(2)_H_$(3)) \
|
2013-05-03 11:53:47 -05:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)) \
|
2013-05-04 05:46:11 -05:00
|
|
|
| $$(TBIN$(1)_T_$(2)_H_$(3))/
|
2012-05-22 13:40:46 -05:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2014-01-04 19:55:20 -06:00
|
|
|
ifeq ($(1),0)
|
|
|
|
$$(Q)cp $(3)/stage0/$(CFG_LIBDIR)/rustlib/$(2)/$(CFG_LIBDIR)/* \
|
|
|
|
$(3)/stage0/$(CFG_LIBDIR)/rustc/$(2)/$(CFG_LIBDIR)/
|
|
|
|
endif
|
2013-12-13 23:14:08 -06:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
|
2013-02-21 18:15:01 -06:00
|
|
|
ifdef CFG_ENABLE_PAX_FLAGS
|
|
|
|
@$$(call E, apply PaX flags: $$@)
|
|
|
|
@"$(CFG_PAXCTL)" -cm "$$@"
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
2012-05-22 13:40:46 -05:00
|
|
|
|
2013-05-04 05:46:11 -05:00
|
|
|
$$(TBIN$(1)_T_$(2)_H_$(3))/:
|
|
|
|
mkdir -p $$@
|
|
|
|
|
2013-05-07 01:29:05 -05:00
|
|
|
ifneq ($(CFG_LIBDIR),bin)
|
2013-05-03 11:53:47 -05:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/:
|
2013-05-04 03:57:56 -05:00
|
|
|
mkdir -p $$@
|
2013-05-07 01:29:05 -05:00
|
|
|
endif
|
2013-05-03 11:53:47 -05:00
|
|
|
|
2012-05-22 13:40:46 -05:00
|
|
|
endef
|
|
|
|
|
2011-11-22 15:04:52 -06:00
|
|
|
# In principle, each host can build each target:
|
2013-10-21 04:18:21 -05:00
|
|
|
$(foreach source,$(CFG_HOST), \
|
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2012-01-06 14:06:35 -06: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)))))
|