]> git.lizzy.rs Git - rust.git/blob - Makefile.in
Add uint::min
[rust.git] / Makefile.in
1 ######################################################################
2 # Residual auto-configuration
3 ######################################################################
4
5 include config.mk
6 MKFILES := Makefile config.mk $(wildcard $(CFG_SRC_DIR)/mk/*.mk)
7
8 ifneq ($(MAKE_RESTARTS),)
9 CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
10 endif
11
12 CFG_INFO := $(info cfg: building on $(CFG_OSTYPE) $(CFG_CPUTYPE))
13
14 ifdef CFG_DISABLE_OPTIMIZE
15   $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
16   CFG_RUSTC_FLAGS :=
17 else
18   CFG_RUSTC_FLAGS := -O
19 endif
20
21 ifdef SAVE_TEMPS
22   CFG_RUSTC_FLAGS += --save-temps
23 endif
24 ifdef TIME_PASSES
25   CFG_RUSTC_FLAGS += --time-passes
26 endif
27 ifdef TIME_LLVM_PASSES
28   CFG_RUSTC_FLAGS += --time-llvm-passes
29 endif
30 ifdef NO_TYPESTATE
31   CFG_RUSTC_FLAGS += --no-typestate
32 endif
33 ifdef DEBUG
34   CFG_RUSTC_FLAGS += -g
35 endif
36
37 # platform-specific auto-configuration
38 include $(CFG_SRC_DIR)/mk/platform.mk
39
40 # Run the stage1/2 compilers under valgrind
41 ifdef VALGRIND_COMPILE
42   CFG_VALGRIND_COMPILE :=$(CFG_VALGRIND)
43 else
44   CFG_VALGRIND_COMPILE :=
45 endif
46
47 CFG_RUNTIME :=$(call CFG_LIB_NAME,rustrt)
48 CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm)
49 CFG_STDLIB :=$(call CFG_LIB_NAME,std)
50 CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc)
51
52 # version-string calculation
53 CFG_GIT_DIR := $(CFG_SRC_DIR).git
54 CFG_VERSION = prerelease
55 ifneq ($(wildcard $(CFG_GIT)),)
56 ifneq ($(wildcard $(CFG_GIT_DIR)),)
57     CFG_VERSION += $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
58                      --pretty=format:'(%h %ci)')
59 endif
60 endif
61
62 ifdef CFG_DISABLE_VALGRIND
63   $(info cfg: disabling valgrind (CFG_DISABLE_VALGRIND))
64   CFG_VALGRIND :=
65 endif
66 ifdef CFG_BAD_VALGRIND
67   $(info cfg: disabling valgrind due to its unreliability on this platform)
68   CFG_VALGRIND :=
69 endif
70
71 DOCS :=
72 ifeq ($(CFG_MAKEINFO),)
73   $(info cfg: no makeinfo found, omitting doc/rust.html)
74 else
75   DOCS += doc/rust.html
76 endif
77
78 ifeq ($(CFG_TEXI2PDF),)
79   $(info cfg: no texi2pdf found, omitting doc/rust.pdf)
80 else
81   ifeq ($(CFG_TEX),)
82     $(info cfg: no tex found, omitting doc/rust.pdf)
83   else
84     DOCS += doc/rust.pdf
85   endif
86 endif
87
88 ifdef CFG_DISABLE_DOCS
89   $(info cfg: disabling doc build (CFG_DISABLE_DOCS))
90   DOCS :=
91 endif
92
93 ######################################################################
94 # Target-and-rule "utility variables"
95 ######################################################################
96
97 ifdef VERBOSE
98   Q :=
99   E =
100 else
101   Q := @
102   E = echo $(1)
103 endif
104
105 S := $(CFG_SRC_DIR)
106 X := $(CFG_EXE_SUFFIX)
107
108 # Look in doc and src dirs.
109 VPATH := $(S)doc $(S)src
110
111 # Compilers we build, we now know how to run.
112 STAGE0 := $(Q)$(call CFG_RUN_TARG,stage0,\
113                 stage0/rustc$(X) $(CFG_RUSTC_FLAGS))
114 STAGE1 := $(Q)$(call CFG_RUN_TARG,stage0, \
115                 $(CFG_VALGRIND_COMPILE) stage1/rustc$(X) \
116                 $(CFG_RUSTC_FLAGS))
117 STAGE2 := $(Q)$(call CFG_RUN_TARG,stage1, \
118                 $(CFG_VALGRIND_COMPILE) stage2/rustc$(X) \
119                 $(CFG_RUSTC_FLAGS))
120 STAGE3 := $(Q)$(call CFG_RUN_TARG,stage2, \
121                 $(CFG_VALGRIND_COMPILE) stage3/rustc$(X) \
122                 $(CFG_RUSTC_FLAGS))
123
124 # "Source" files we generate in builddir along the way.
125 GENERATED :=
126
127 # Delete the built-in rules.
128 .SUFFIXES:
129 %:: %,v
130 %:: RCS/%,v
131 %:: RCS/%
132 %:: s.%
133 %:: SCCS/s.%
134
135 ######################################################################
136 # Standard library variables
137 ######################################################################
138
139 STDLIB_CRATE := $(S)src/lib/std.rc
140 STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/lib/,*.rc *.rs */*.rs))
141
142 ######################################################################
143 # rustc crate variables
144 ######################################################################
145
146 COMPILER_CRATE := $(S)src/comp/rustc.rc
147 COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/comp/, \
148                                 rustc.rc *.rs */*.rs */*/*.rs))
149
150 ######################################################################
151 # Main target dependency variables
152 ######################################################################
153
154 LREQ := rt/$(CFG_RUNTIME) rustllvm/$(CFG_RUSTLLVM)
155 SREQ0 := stage0/rustc$(X) $(LREQ) rt/main.o stage0/lib/glue.o \
156          stage0/lib/$(CFG_STDLIB)
157 SREQ1 := stage1/rustc$(X) $(LREQ) rt/main.o stage1/lib/glue.o \
158          stage1/lib/$(CFG_STDLIB)
159 SREQ2 := stage2/rustc$(X) $(LREQ) rt/main.o stage2/lib/glue.o \
160          stage2/lib/$(CFG_STDLIB)
161
162
163 ######################################################################
164 # Exports for sub-utilities
165 ######################################################################
166
167 export CFG_SRC_DIR
168 export CFG_VERSION
169 export CFG_LLVM_ROOT
170 export CFG_ENABLE_MINGW_CROSS
171
172 ######################################################################
173 # Subprograms
174 ######################################################################
175
176 LLVM_AS := $(CFG_LLVM_BINDIR)/llvm-as$(X)
177
178 LLC := $(CFG_LLVM_BINDIR)/llc$(X)
179
180 ######################################################################
181 # Single-target rules
182 ######################################################################
183
184 ifneq ($(CFG_IN_TRANSITION),)
185
186 CFG_INFO := $(info cfg:)
187 CFG_INFO := $(info cfg: *** compiler is in snapshot transition ***)
188 CFG_INFO := $(info cfg: *** stage2 and later will not be built ***)
189 CFG_INFO := $(info cfg:)
190
191 all: rt/$(CFG_RUNTIME)          \
192      rustllvm/$(CFG_RUSTLLVM)   \
193      stage0/lib/$(CFG_STDLIB)   \
194      stage0/intrinsics.bc       \
195      stage0/rustc$(X)           \
196      $(GENERATED)               \
197      $(DOCS)                    \
198      stage1/lib/$(CFG_STDLIB)   \
199      stage1/intrinsics.bc       \
200      stage1/lib/glue.o          \
201      stage1/rustc$(X)           \
202
203 else
204
205 all: rt/$(CFG_RUNTIME)          \
206      rustllvm/$(CFG_RUSTLLVM)   \
207      stage0/lib/$(CFG_STDLIB)   \
208      stage0/intrinsics.bc       \
209      stage0/rustc$(X)           \
210      $(GENERATED)               \
211      $(DOCS)                    \
212      stage1/lib/$(CFG_STDLIB)   \
213      stage1/intrinsics.bc       \
214      stage1/lib/glue.o          \
215      stage1/rustc$(X)           \
216      stage2/lib/$(CFG_STDLIB)   \
217      stage2/intrinsics.bc       \
218      stage2/lib/glue.o          \
219      stage2/rustc$(X)           \
220      stage3/lib/$(CFG_STDLIB)   \
221      stage3/lib/glue.o          \
222      stage3/intrinsics.bc       \
223      stage3/rustc$(X)
224
225 endif
226
227
228 ######################################################################
229 # Re-configuration
230 ######################################################################
231
232 config.mk: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
233         @$(call E, cfg: reconfiguring)
234         $(Q)$(S)configure $(CFG_CONFIGURE_ARGS)
235
236
237 ######################################################################
238 # Primary-target makefiles
239 ######################################################################
240
241 include $(CFG_SRC_DIR)/mk/intrinsics.mk
242 include $(CFG_SRC_DIR)/mk/stage0.mk
243 include $(CFG_SRC_DIR)/mk/stage1.mk
244 include $(CFG_SRC_DIR)/mk/stage2.mk
245 include $(CFG_SRC_DIR)/mk/stage3.mk
246 include $(CFG_SRC_DIR)/mk/rt.mk
247 include $(CFG_SRC_DIR)/mk/rustllvm.mk
248 include $(CFG_SRC_DIR)/mk/autodep.mk
249 include $(CFG_SRC_DIR)/mk/fuzzer.mk
250 include $(CFG_SRC_DIR)/mk/docs.mk
251
252
253 ######################################################################
254 # Secondary makefiles, conditionalized for speed
255 ######################################################################
256
257 ifneq ($(strip $(findstring dist,$(MAKECMDGOALS))   \
258                $(findstring check,$(MAKECMDGOALS))  \
259                $(findstring test,$(MAKECMDGOALS))   \
260                $(findstring clean,$(MAKECMDGOALS))),)
261   CFG_INFO := $(info cfg: including dist rules)
262   include $(CFG_SRC_DIR)/mk/dist.mk
263 endif
264
265 ifneq ($(strip $(findstring snap,$(MAKECMDGOALS))   \
266                $(findstring clean,$(MAKECMDGOALS))),)
267   CFG_INFO := $(info cfg: including snap rules)
268   include $(CFG_SRC_DIR)/mk/snap.mk
269 endif
270
271 ifneq ($(findstring reformat,$(MAKECMDGOALS)),)
272   CFG_INFO := $(info cfg: including reformat rules)
273   include $(CFG_SRC_DIR)/mk/pp.mk
274 endif
275
276 ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
277                $(findstring test,$(MAKECMDGOALS))  \
278                $(findstring tidy,$(MAKECMDGOALS))),)
279   CFG_INFO := $(info cfg: including test rules)
280   include $(CFG_SRC_DIR)/mk/tests.mk
281 endif
282
283 ifneq ($(findstring clean,$(MAKECMDGOALS)),)
284   CFG_INFO := $(info cfg: including clean rules)
285   include $(CFG_SRC_DIR)/mk/clean.mk
286 endif