Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 1 | # An explanation of how the build is structured: |
| 2 | # |
| 3 | # There are multiple build stages (0-3) needed to verify that the |
| 4 | # compiler is properly self-hosting. Each stage is divided between |
| 5 | # 'host' artifacts and 'target' artifacts, where the stageN host |
| 6 | # compiler builds artifacts for 1 or more stageN target architectures. |
| 7 | # Once the stageN target compiler has been built for the host |
| 8 | # architecture it is promoted (copied) to a stageN+1 host artifact. |
| 9 | # |
| 10 | # The stage3 host compiler is a compiler that successfully builds |
| 11 | # itself and should (in theory) be bitwise identical to the stage2 |
| 12 | # host compiler. The process is bootstrapped using a stage0 host |
| 13 | # compiler downloaded from a previous snapshot. |
| 14 | # |
| 15 | # At no time should stageN artifacts be interacting with artifacts |
| 16 | # from other stages. For consistency, we use the 'promotion' logic |
| 17 | # for all artifacts, even those that don't make sense on non-host |
| 18 | # architectures. |
| 19 | # |
| 20 | # The directory layout for a stage is intended to match the layout |
| 21 | # of the installed compiler, and looks like the following: |
| 22 | # |
| 23 | # stageN - this is the system root, corresponding to, e.g. /usr |
| 24 | # bin - binaries compiled for the host |
| 25 | # lib - libraries used by the host compiler |
| 26 | # rustc - rustc's own place to organize libraries |
| 27 | # $(target) - target-specific artifacts |
| 28 | # bin - binaries for target architectures |
| 29 | # lib - libraries for target architectures |
| 30 | # |
| 31 | # A note about host libraries: |
| 32 | # |
| 33 | # The only libraries that get promoted to stageN/lib are those needed |
| 34 | # by rustc. In general, rustc programs, even those compiled for the |
| 35 | # host architecture will use libraries from the target |
| 36 | # directories. This gives rust some freedom to experiment with how |
| 37 | # libraries are managed and versioned without polluting the common |
| 38 | # areas of the filesystem. |
| 39 | # |
| 40 | # General rust binaries may stil live in the host bin directory; they |
| 41 | # will just link against the libraries in the target lib directory. |
| 42 | # |
| 43 | # Admittedly this is a little convoluted. |
| 44 | |
Graydon Hoare | 9c6e7e6 | 2011-03-16 16:17:32 | [diff] [blame] | 45 | ###################################################################### |
| 46 | # Residual auto-configuration |
| 47 | ###################################################################### |
| 48 | |
| 49 | include config.mk |
Brian Anderson | 4709038 | 2011-10-06 00:41:01 | [diff] [blame] | 50 | OUR_MKFILES := Makefile config.mk $(wildcard $(CFG_SRC_DIR)/mk/*.mk) |
| 51 | 3RDPARTY_MKFILES := $(CFG_SRC_DIR)/src/rt/libuv/Makefile \ |
| 52 | $(wildcard $(CFG_SRC_DIR)/src/rt/libuv/*.mk) |
Niko Matsakis | 20946e6 | 2011-10-14 00:11:28 | [diff] [blame] | 53 | GEN_MKFILES := $(wildcard $(CFG_SRC_DIR)/mk/libuv/*/*/*) \ |
Brian Anderson | 4709038 | 2011-10-06 00:41:01 | [diff] [blame] | 54 | $(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*) \ |
| 55 | $(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*) \ |
| 56 | $(wildcard $(CFG_SRC_DIR)/mk/libuv/mac/src/rt/libuv/*) |
| 57 | |
| 58 | MKFILES := $(OUR_MKFILES) $(3RDPARTY_MKFILES) $(GEN_MKFILES) |
Graydon Hoare | 9c6e7e6 | 2011-03-16 16:17:32 | [diff] [blame] | 59 | |
| 60 | ifneq ($(MAKE_RESTARTS),) |
| 61 | CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS)) |
| 62 | endif |
| 63 | |
Graydon Hoare | 1321580 | 2011-09-21 18:24:59 | [diff] [blame] | 64 | CFG_INFO := $(info cfg: shell host triple $(CFG_HOST_TRIPLE)) |
| 65 | CFG_INFO := $(info cfg: llvm host triple $(CFG_LLVM_TRIPLE)) |
Niko Matsakis | d088799 | 2011-10-14 21:08:04 | [diff] [blame^] | 66 | CFG_INFO := $(info cfg: llvm target triples $(CFG_TARGET_TRIPLES)) |
Graydon Hoare | 9c6e7e6 | 2011-03-16 16:17:32 | [diff] [blame] | 67 | |
Graydon Hoare | cae703c | 2011-04-08 22:44:41 | [diff] [blame] | 68 | ifdef CFG_DISABLE_OPTIMIZE |
Graydon Hoare | 19ebc0f | 2011-04-08 23:29:19 | [diff] [blame] | 69 | $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE)) |
Patrick Walton | c52fb52 | 2011-04-29 17:23:07 | [diff] [blame] | 70 | CFG_RUSTC_FLAGS := |
Graydon Hoare | cae703c | 2011-04-08 22:44:41 | [diff] [blame] | 71 | else |
Patrick Walton | c52fb52 | 2011-04-29 17:23:07 | [diff] [blame] | 72 | CFG_RUSTC_FLAGS := -O |
Graydon Hoare | cae703c | 2011-04-08 22:44:41 | [diff] [blame] | 73 | endif |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 74 | |
Patrick Walton | 3f77e7d | 2011-04-25 21:20:28 | [diff] [blame] | 75 | ifdef SAVE_TEMPS |
Marijn Haverbeke | 6b11f6c | 2011-04-26 18:32:08 | [diff] [blame] | 76 | CFG_RUSTC_FLAGS += --save-temps |
Patrick Walton | 3f77e7d | 2011-04-25 21:20:28 | [diff] [blame] | 77 | endif |
Patrick Walton | 648c4ae | 2011-04-29 18:55:32 | [diff] [blame] | 78 | ifdef TIME_PASSES |
| 79 | CFG_RUSTC_FLAGS += --time-passes |
| 80 | endif |
Brian Anderson | 2752284 | 2011-06-19 00:26:41 | [diff] [blame] | 81 | ifdef TIME_LLVM_PASSES |
| 82 | CFG_RUSTC_FLAGS += --time-llvm-passes |
| 83 | endif |
Patrick Walton | 9aeb679 | 2011-04-29 19:16:14 | [diff] [blame] | 84 | ifdef NO_TYPESTATE |
| 85 | CFG_RUSTC_FLAGS += --no-typestate |
| 86 | endif |
Patrick Walton | 404db4d | 2011-05-11 00:48:49 | [diff] [blame] | 87 | ifdef DEBUG |
| 88 | CFG_RUSTC_FLAGS += -g |
| 89 | endif |
Patrick Walton | 3f77e7d | 2011-04-25 21:20:28 | [diff] [blame] | 90 | |
Graydon Hoare | 40624e3 | 2011-05-01 20:18:52 | [diff] [blame] | 91 | # platform-specific auto-configuration |
| 92 | include $(CFG_SRC_DIR)/mk/platform.mk |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 93 | |
Brian Anderson | cad8c73 | 2011-05-14 03:20:34 | [diff] [blame] | 94 | # Run the stage1/2 compilers under valgrind |
| 95 | ifdef VALGRIND_COMPILE |
| 96 | CFG_VALGRIND_COMPILE :=$(CFG_VALGRIND) |
| 97 | else |
| 98 | CFG_VALGRIND_COMPILE := |
| 99 | endif |
| 100 | |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 101 | CFG_RUNTIME :=$(call CFG_LIB_NAME,rustrt) |
Graydon Hoare | 7ac885e | 2011-03-22 06:06:42 | [diff] [blame] | 102 | CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm) |
Haitao Li | d1cc00f | 2011-10-30 14:04:32 | [diff] [blame] | 103 | CFG_STDLIB :=$(call CFG_LIB_NAME,ruststd) |
Brian Anderson | 5fb9cad | 2011-07-01 06:16:01 | [diff] [blame] | 104 | CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc) |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 105 | |
Graydon Hoare | 1e03f00 | 2011-05-06 18:21:51 | [diff] [blame] | 106 | # version-string calculation |
| 107 | CFG_GIT_DIR := $(CFG_SRC_DIR).git |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 108 | CFG_VERSION = prerelease |
Graydon Hoare | 0a8f9a3 | 2011-06-13 21:45:26 | [diff] [blame] | 109 | ifneq ($(wildcard $(CFG_GIT)),) |
Graydon Hoare | 1e03f00 | 2011-05-06 18:21:51 | [diff] [blame] | 110 | ifneq ($(wildcard $(CFG_GIT_DIR)),) |
| 111 | CFG_VERSION += $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \ |
| 112 | --pretty=format:'(%h %ci)') |
| 113 | endif |
Graydon Hoare | 0a8f9a3 | 2011-06-13 21:45:26 | [diff] [blame] | 114 | endif |
Graydon Hoare | 1e03f00 | 2011-05-06 18:21:51 | [diff] [blame] | 115 | |
Graydon Hoare | 94731fa | 2011-03-30 04:45:09 | [diff] [blame] | 116 | ifdef CFG_DISABLE_VALGRIND |
| 117 | $(info cfg: disabling valgrind (CFG_DISABLE_VALGRIND)) |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 118 | CFG_VALGRIND := |
Graydon Hoare | 9c6e7e6 | 2011-03-16 16:17:32 | [diff] [blame] | 119 | endif |
Patrick Walton | 518e2d2 | 2011-05-06 01:11:40 | [diff] [blame] | 120 | ifdef CFG_BAD_VALGRIND |
| 121 | $(info cfg: disabling valgrind due to its unreliability on this platform) |
| 122 | CFG_VALGRIND := |
| 123 | endif |
Graydon Hoare | 9c6e7e6 | 2011-03-16 16:17:32 | [diff] [blame] | 124 | |
Graydon Hoare | 28a4e77 | 2011-03-23 17:37:35 | [diff] [blame] | 125 | DOCS := |
| 126 | ifeq ($(CFG_MAKEINFO),) |
| 127 | $(info cfg: no makeinfo found, omitting doc/rust.html) |
| 128 | else |
| 129 | DOCS += doc/rust.html |
| 130 | endif |
| 131 | |
| 132 | ifeq ($(CFG_TEXI2PDF),) |
| 133 | $(info cfg: no texi2pdf found, omitting doc/rust.pdf) |
| 134 | else |
Graydon Hoare | f740747 | 2011-03-23 20:31:51 | [diff] [blame] | 135 | ifeq ($(CFG_TEX),) |
| 136 | $(info cfg: no tex found, omitting doc/rust.pdf) |
| 137 | else |
| 138 | DOCS += doc/rust.pdf |
| 139 | endif |
Graydon Hoare | 28a4e77 | 2011-03-23 17:37:35 | [diff] [blame] | 140 | endif |
| 141 | |
Brian Anderson | 0c62007 | 2011-10-27 21:59:22 | [diff] [blame] | 142 | ifeq ($(CFG_NATURALDOCS),) |
Brian Anderson | 33f2f22 | 2011-10-27 22:04:29 | [diff] [blame] | 143 | $(info cfg: no naturaldocs found, omitting doc/std/index.html) |
Brian Anderson | 0c62007 | 2011-10-27 21:59:22 | [diff] [blame] | 144 | else |
| 145 | DOCS += doc/std/index.html |
| 146 | endif |
| 147 | |
Graydon Hoare | 94731fa | 2011-03-30 04:45:09 | [diff] [blame] | 148 | ifdef CFG_DISABLE_DOCS |
| 149 | $(info cfg: disabling doc build (CFG_DISABLE_DOCS)) |
| 150 | DOCS := |
| 151 | endif |
Graydon Hoare | 28a4e77 | 2011-03-23 17:37:35 | [diff] [blame] | 152 | |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 153 | ###################################################################### |
| 154 | # Target-and-rule "utility variables" |
| 155 | ###################################################################### |
| 156 | |
| 157 | ifdef VERBOSE |
| 158 | Q := |
| 159 | E = |
| 160 | else |
| 161 | Q := @ |
| 162 | E = echo $(1) |
| 163 | endif |
| 164 | |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 165 | S := $(CFG_SRC_DIR) |
| 166 | X := $(CFG_EXE_SUFFIX) |
| 167 | |
| 168 | # Look in doc and src dirs. |
| 169 | VPATH := $(S)doc $(S)src |
| 170 | |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 171 | # "Source" files we generate in builddir along the way. |
Graydon Hoare | 40624e3 | 2011-05-01 20:18:52 | [diff] [blame] | 172 | GENERATED := |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 173 | |
| 174 | # Delete the built-in rules. |
| 175 | .SUFFIXES: |
| 176 | %:: %,v |
| 177 | %:: RCS/%,v |
| 178 | %:: RCS/% |
| 179 | %:: s.% |
| 180 | %:: SCCS/s.% |
Graydon Hoare | 9c6e7e6 | 2011-03-16 16:17:32 | [diff] [blame] | 181 | |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 182 | ###################################################################### |
| 183 | # Standard library variables |
| 184 | ###################################################################### |
| 185 | |
Graydon Hoare | 6597439 | 2011-03-21 20:42:29 | [diff] [blame] | 186 | STDLIB_CRATE := $(S)src/lib/std.rc |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 187 | STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/lib/,*.rc *.rs */*.rs)) |
| 188 | |
| 189 | ###################################################################### |
| 190 | # rustc crate variables |
| 191 | ###################################################################### |
| 192 | |
Graydon Hoare | 6597439 | 2011-03-21 20:42:29 | [diff] [blame] | 193 | COMPILER_CRATE := $(S)src/comp/rustc.rc |
Graydon Hoare | 874a7bf | 2011-03-19 00:30:06 | [diff] [blame] | 194 | COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/comp/, \ |
Tim Chevalier | 60399ed | 2011-05-18 22:34:52 | [diff] [blame] | 195 | rustc.rc *.rs */*.rs */*/*.rs)) |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 196 | |
| 197 | ###################################################################### |
Graydon Hoare | d987b49 | 2011-05-03 06:37:52 | [diff] [blame] | 198 | # Exports for sub-utilities |
| 199 | ###################################################################### |
| 200 | |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 201 | # Note that any variable that re-configure should pick up needs to be |
| 202 | # exported |
| 203 | |
Graydon Hoare | d987b49 | 2011-05-03 06:37:52 | [diff] [blame] | 204 | export CFG_SRC_DIR |
Graydon Hoare | ad954fc | 2011-07-23 19:26:47 | [diff] [blame] | 205 | export CFG_BUILD_DIR |
Graydon Hoare | 1e03f00 | 2011-05-06 18:21:51 | [diff] [blame] | 206 | export CFG_VERSION |
Brian Anderson | 6306c81 | 2011-09-29 19:21:58 | [diff] [blame] | 207 | export CFG_HOST_TRIPLE |
Graydon Hoare | 6a4a85f | 2011-05-18 19:00:26 | [diff] [blame] | 208 | export CFG_LLVM_ROOT |
Graydon Hoare | 0dc2aa3 | 2011-06-28 18:18:25 | [diff] [blame] | 209 | export CFG_ENABLE_MINGW_CROSS |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 210 | export CFG_PREFIX |
Graydon Hoare | d987b49 | 2011-05-03 06:37:52 | [diff] [blame] | 211 | |
Patrick Walton | 04f966f | 2011-05-05 01:28:30 | [diff] [blame] | 212 | ###################################################################### |
| 213 | # Subprograms |
| 214 | ###################################################################### |
| 215 | |
Graydon Hoare | 8fc51df | 2011-06-27 18:53:04 | [diff] [blame] | 216 | LLVM_AS := $(CFG_LLVM_BINDIR)/llvm-as$(X) |
Patrick Walton | 04f966f | 2011-05-05 01:28:30 | [diff] [blame] | 217 | |
Graydon Hoare | 8fc51df | 2011-06-27 18:53:04 | [diff] [blame] | 218 | LLC := $(CFG_LLVM_BINDIR)/llc$(X) |
Graydon Hoare | d987b49 | 2011-05-03 06:37:52 | [diff] [blame] | 219 | |
| 220 | ###################################################################### |
Graydon Hoare | fafb42e | 2011-07-15 23:12:41 | [diff] [blame] | 221 | # Per-stage targets and runner |
| 222 | ###################################################################### |
| 223 | |
| 224 | define SREQ |
Brian Anderson | ed106dd | 2011-09-30 19:08:51 | [diff] [blame] | 225 | |
Brian Anderson | 38c67a4 | 2011-09-30 19:24:28 | [diff] [blame] | 226 | # Destinations of artifacts for the host compiler |
| 227 | HOST_ROOT$(1) = stage$(1) |
| 228 | HOST_BIN$(1) = $$(HOST_ROOT$(1))/bin |
| 229 | HOST_LIB$(1) = $$(HOST_ROOT$(1))/lib |
| 230 | |
Brian Anderson | 9563c17 | 2011-10-01 02:00:19 | [diff] [blame] | 231 | # Destinations of artifacts for target architectures |
| 232 | TARGET_ROOT$(1)$(2) = $$(HOST_LIB$(1))/rustc/$(2) |
| 233 | TARGET_BIN$(1)$(2) = $$(TARGET_ROOT$(1)$(2))/bin |
| 234 | TARGET_LIB$(1)$(2) = $$(TARGET_ROOT$(1)$(2))/lib |
| 235 | |
Brian Anderson | 38c67a4 | 2011-09-30 19:24:28 | [diff] [blame] | 236 | # The target locations of artifacts for the host architecture (used for |
| 237 | # promoting target binaries to host binaries) |
| 238 | TARGET_HOST_ROOT$(1) = $$(TARGET_ROOT$(1)$$(CFG_HOST_TRIPLE)) |
| 239 | TARGET_HOST_BIN$(1) = $$(TARGET_BIN$(1)$$(CFG_HOST_TRIPLE)) |
| 240 | TARGET_HOST_LIB$(1) = $$(TARGET_LIB$(1)$$(CFG_HOST_TRIPLE)) |
Brian Anderson | ed106dd | 2011-09-30 19:08:51 | [diff] [blame] | 241 | |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 242 | # The name of the standard library used by rustc |
Rafael Ávila de Espíndola | 88894b6 | 2011-07-20 20:02:36 | [diff] [blame] | 243 | ifdef CFG_DISABLE_SHAREDSTD |
Brian Anderson | f634eb2 | 2011-09-30 23:11:47 | [diff] [blame] | 244 | HOST_STDLIB_DEFAULT$(1) = $$(HOST_LIB$(1))/libstd.rlib |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 245 | TARGET_STDLIB_DEFAULT$(1)$(2) = $$(TARGET_LIB$(1)$(2))/libstd.rlib |
Brian Anderson | f634eb2 | 2011-09-30 23:11:47 | [diff] [blame] | 246 | else |
| 247 | HOST_STDLIB_DEFAULT$(1) = $$(HOST_LIB$(1))/$(CFG_STDLIB) |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 248 | TARGET_STDLIB_DEFAULT$(1)$(2) = $$(TARGET_LIB$(1)$(2))/$(CFG_STDLIB) |
Brian Anderson | f634eb2 | 2011-09-30 23:11:47 | [diff] [blame] | 249 | endif |
| 250 | |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 251 | # Preqrequisites for using the stageN compiler |
| 252 | HOST_SREQ$(1) = \ |
| 253 | $$(HOST_BIN$(1))/rustc$$(X) \ |
| 254 | $$(HOST_LIB$(1))/$$(CFG_RUNTIME) \ |
| 255 | $$(HOST_LIB$(1))/$$(CFG_RUSTLLVM) \ |
| 256 | $$(HOST_STDLIB_DEFAULT$(1)) \ |
| 257 | $$(MKFILES) |
| 258 | |
| 259 | # Prerequisites for using the stageN compiler to build target artifacts |
| 260 | TARGET_SREQ$(1)$(2) = \ |
| 261 | $$(HOST_SREQ$(1)) \ |
| 262 | $$(TARGET_LIB$(1)$(2))/$$(CFG_RUNTIME) \ |
Marijn Haverbeke | ba1c6fc | 2011-10-20 15:32:10 | [diff] [blame] | 263 | $$(TARGET_LIB$(1)$(2))/intrinsics.bc |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 264 | |
| 265 | # Prerequisites for complete stageN targets |
| 266 | SREQ$(1)$(2) = \ |
| 267 | $$(TARGET_SREQ$(1)$(2)) \ |
| 268 | $$(TARGET_LIB$(1)$(2))/$$(CFG_STDLIB) |
Graydon Hoare | fafb42e | 2011-07-15 23:12:41 | [diff] [blame] | 269 | |
Brian Anderson | e3d3aaa | 2011-08-26 18:11:49 | [diff] [blame] | 270 | ifeq ($(1),0) |
| 271 | # Don't run the the stage0 compiler under valgrind - that ship has sailed |
| 272 | CFG_VALGRIND_COMPILE$(1) = |
| 273 | else |
| 274 | CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE) |
| 275 | endif |
| 276 | |
Niko Matsakis | d088799 | 2011-10-14 21:08:04 | [diff] [blame^] | 277 | STAGE$(1)_$(2) := $$(Q)$$(call CFG_RUN_TARG,$(1), \ |
| 278 | $$(CFG_VALGRIND_COMPILE$(1)) $$(HOST_BIN$(1))/rustc$$(X) \ |
| 279 | $$(CFG_RUSTC_FLAGS) --target=$(2)) |
Brian Anderson | 7dbce10 | 2011-09-29 19:06:37 | [diff] [blame] | 280 | |
Niko Matsakis | d088799 | 2011-10-14 21:08:04 | [diff] [blame^] | 281 | PERF_STAGE$(1)_$(2) := $$(Q)$$(call CFG_RUN_TARG,$(1), \ |
| 282 | $$(CFG_PERF_TOOL) $$(HOST_BIN$(1))/rustc$$(X) \ |
| 283 | $$(CFG_RUSTC_FLAGS) --target=$(2)) |
Brian Anderson | 7dbce10 | 2011-09-29 19:06:37 | [diff] [blame] | 284 | |
Graydon Hoare | fafb42e | 2011-07-15 23:12:41 | [diff] [blame] | 285 | endef |
| 286 | |
Brian Anderson | 0148daa | 2011-09-29 00:06:57 | [diff] [blame] | 287 | $(foreach target,$(CFG_TARGET_TRIPLES), \ |
| 288 | $(eval $(call SREQ,0,$(target))) \ |
| 289 | $(eval $(call SREQ,1,$(target))) \ |
| 290 | $(eval $(call SREQ,2,$(target))) \ |
| 291 | $(eval $(call SREQ,3,$(target)))) |
Graydon Hoare | fafb42e | 2011-07-15 23:12:41 | [diff] [blame] | 292 | |
| 293 | ###################################################################### |
| 294 | # Entrypoint rule |
Graydon Hoare | 4c2245d | 2011-03-18 06:51:45 | [diff] [blame] | 295 | ###################################################################### |
| 296 | |
Graydon Hoare | ae784df | 2011-05-14 00:00:43 | [diff] [blame] | 297 | ifneq ($(CFG_IN_TRANSITION),) |
| 298 | |
Graydon Hoare | 9ac2948 | 2011-05-16 22:14:58 | [diff] [blame] | 299 | CFG_INFO := $(info cfg:) |
Graydon Hoare | ae784df | 2011-05-14 00:00:43 | [diff] [blame] | 300 | CFG_INFO := $(info cfg: *** compiler is in snapshot transition ***) |
| 301 | CFG_INFO := $(info cfg: *** stage2 and later will not be built ***) |
Graydon Hoare | 9ac2948 | 2011-05-16 22:14:58 | [diff] [blame] | 302 | CFG_INFO := $(info cfg:) |
Graydon Hoare | ae784df | 2011-05-14 00:00:43 | [diff] [blame] | 303 | |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 304 | all: $(SREQ1$(CFG_HOST_TRIPLE)) $(GENERATED) $(DOCS) |
Brian Anderson | b056096 | 2011-09-30 23:15:02 | [diff] [blame] | 305 | |
Graydon Hoare | ae784df | 2011-05-14 00:00:43 | [diff] [blame] | 306 | else |
Brian Anderson | 86ed905 | 2011-09-30 03:27:28 | [diff] [blame] | 307 | |
Niko Matsakis | d088799 | 2011-10-14 21:08:04 | [diff] [blame^] | 308 | TARGET_SREQS := $(foreach target,$(CFG_TARGET_TRIPLES),$(SREQ3$(target))) |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 309 | FUZZ := $(HOST_BIN3)/fuzzer$(X) |
Brian Anderson | 86ed905 | 2011-09-30 03:27:28 | [diff] [blame] | 310 | |
Niko Matsakis | d088799 | 2011-10-14 21:08:04 | [diff] [blame^] | 311 | #all: $(SREQ3$(CFG_HOST_TRIPLE)) $(GENERATED) $(DOCS) $(FUZZ) |
| 312 | all: $(TARGET_SREQS) $(GENERATED) $(DOCS) $(FUZZ) |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 313 | |
Graydon Hoare | ae784df | 2011-05-14 00:00:43 | [diff] [blame] | 314 | endif |
| 315 | |
Graydon Hoare | 10f3360 | 2011-03-25 17:29:45 | [diff] [blame] | 316 | |
| 317 | ###################################################################### |
| 318 | # Re-configuration |
| 319 | ###################################################################### |
| 320 | |
Graydon Hoare | ae784df | 2011-05-14 00:00:43 | [diff] [blame] | 321 | config.mk: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt |
Graydon Hoare | 10f3360 | 2011-03-25 17:29:45 | [diff] [blame] | 322 | @$(call E, cfg: reconfiguring) |
Graydon Hoare | df8161d | 2011-06-30 20:41:20 | [diff] [blame] | 323 | $(Q)$(S)configure $(CFG_CONFIGURE_ARGS) |
Graydon Hoare | 10f3360 | 2011-03-25 17:29:45 | [diff] [blame] | 324 | |
| 325 | |
Graydon Hoare | e961f53 | 2011-03-21 18:23:19 | [diff] [blame] | 326 | ###################################################################### |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 327 | # Primary-target makefiles |
Graydon Hoare | e961f53 | 2011-03-21 18:23:19 | [diff] [blame] | 328 | ###################################################################### |
| 329 | |
Brian Anderson | 6e65456 | 2011-10-02 03:12:08 | [diff] [blame] | 330 | include $(CFG_SRC_DIR)/mk/target.mk |
| 331 | include $(CFG_SRC_DIR)/mk/host.mk |
Michael Sullivan | b01ecb1 | 2011-07-21 18:58:01 | [diff] [blame] | 332 | include $(CFG_SRC_DIR)/mk/stage0.mk |
Graydon Hoare | 40624e3 | 2011-05-01 20:18:52 | [diff] [blame] | 333 | include $(CFG_SRC_DIR)/mk/rt.mk |
| 334 | include $(CFG_SRC_DIR)/mk/rustllvm.mk |
Graydon Hoare | 40624e3 | 2011-05-01 20:18:52 | [diff] [blame] | 335 | include $(CFG_SRC_DIR)/mk/autodep.mk |
Brian Anderson | 3a6f3cf | 2011-10-03 00:28:59 | [diff] [blame] | 336 | include $(CFG_SRC_DIR)/mk/tools.mk |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 337 | include $(CFG_SRC_DIR)/mk/docs.mk |
| 338 | |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 339 | ###################################################################### |
| 340 | # Secondary makefiles, conditionalized for speed |
| 341 | ###################################################################### |
| 342 | |
Graydon Hoare | df8161d | 2011-06-30 20:41:20 | [diff] [blame] | 343 | ifneq ($(strip $(findstring dist,$(MAKECMDGOALS)) \ |
| 344 | $(findstring check,$(MAKECMDGOALS)) \ |
| 345 | $(findstring test,$(MAKECMDGOALS)) \ |
Graydon Hoare | 39151f2 | 2011-07-13 22:44:09 | [diff] [blame] | 346 | $(findstring tidy,$(MAKECMDGOALS)) \ |
Graydon Hoare | df8161d | 2011-06-30 20:41:20 | [diff] [blame] | 347 | $(findstring clean,$(MAKECMDGOALS))),) |
| 348 | CFG_INFO := $(info cfg: including dist rules) |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 349 | include $(CFG_SRC_DIR)/mk/dist.mk |
| 350 | endif |
| 351 | |
Graydon Hoare | df8161d | 2011-06-30 20:41:20 | [diff] [blame] | 352 | ifneq ($(strip $(findstring snap,$(MAKECMDGOALS)) \ |
| 353 | $(findstring clean,$(MAKECMDGOALS))),) |
| 354 | CFG_INFO := $(info cfg: including snap rules) |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 355 | include $(CFG_SRC_DIR)/mk/snap.mk |
| 356 | endif |
| 357 | |
| 358 | ifneq ($(findstring reformat,$(MAKECMDGOALS)),) |
Graydon Hoare | df8161d | 2011-06-30 20:41:20 | [diff] [blame] | 359 | CFG_INFO := $(info cfg: including reformat rules) |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 360 | include $(CFG_SRC_DIR)/mk/pp.mk |
| 361 | endif |
| 362 | |
Graydon Hoare | df8161d | 2011-06-30 20:41:20 | [diff] [blame] | 363 | ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \ |
| 364 | $(findstring test,$(MAKECMDGOALS)) \ |
Graydon Hoare | d5b2d62 | 2011-09-13 22:06:21 | [diff] [blame] | 365 | $(findstring perf,$(MAKECMDGOALS)) \ |
Graydon Hoare | df8161d | 2011-06-30 20:41:20 | [diff] [blame] | 366 | $(findstring tidy,$(MAKECMDGOALS))),) |
| 367 | CFG_INFO := $(info cfg: including test rules) |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 368 | include $(CFG_SRC_DIR)/mk/tests.mk |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 369 | endif |
| 370 | |
Graydon Hoare | d5b2d62 | 2011-09-13 22:06:21 | [diff] [blame] | 371 | ifneq ($(findstring perf,$(MAKECMDGOALS)),) |
| 372 | CFG_INFO := $(info cfg: including perf rules) |
| 373 | include $(CFG_SRC_DIR)/mk/perf.mk |
| 374 | endif |
| 375 | |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 376 | ifneq ($(findstring clean,$(MAKECMDGOALS)),) |
Graydon Hoare | df8161d | 2011-06-30 20:41:20 | [diff] [blame] | 377 | CFG_INFO := $(info cfg: including clean rules) |
Graydon Hoare | 79ba315 | 2011-06-25 19:23:27 | [diff] [blame] | 378 | include $(CFG_SRC_DIR)/mk/clean.mk |
Michael Sullivan | b01ecb1 | 2011-07-21 18:58:01 | [diff] [blame] | 379 | endif |
Brian Anderson | 9563c17 | 2011-10-01 02:00:19 | [diff] [blame] | 380 | |
| 381 | ifneq ($(findstring install,$(MAKECMDGOALS)),) |
| 382 | CFG_INFO := $(info cfg: including install rules) |
| 383 | include $(CFG_SRC_DIR)/mk/install.mk |
Niko Matsakis | e1c470c | 2011-10-12 19:10:21 | [diff] [blame] | 384 | endif |
| 385 | |
| 386 | ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \ |
| 387 | $(findstring TAGS.vi,$(MAKECMDGOALS))),) |
| 388 | CFG_INFO := $(info cfg: including ctags rules) |
| 389 | include $(CFG_SRC_DIR)/mk/ctags.mk |
| 390 | endif |