]> git.lizzy.rs Git - rust.git/blob - Makefile.in
Add spawn_conversation
[rust.git] / Makefile.in
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, rust 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
45 STAGES = 0 1 2 3
46
47 ######################################################################
48 # Residual auto-configuration
49 ######################################################################
50
51 # Recursive wildcard function
52 # http://blog.jgc.org/2011/07/gnu-make-recursive-wildcard-function.html
53 rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) \
54   $(filter $(subst *,%,$2),$d))
55
56 include config.mk
57
58 # We track all of the object files we might build so that we can find
59 # and include all of the .d files in one fell swoop.
60 ALL_OBJ_FILES :=
61
62 MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
63 NON_HOST_TRIPLES = $(filter-out $(CFG_HOST_TRIPLE),$(CFG_TARGET_TRIPLES))
64
65 ifneq ($(MAKE_RESTARTS),)
66 CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
67 endif
68
69 CFG_INFO := $(info cfg: shell host triple $(CFG_HOST_TRIPLE))
70
71 ifneq ($(wildcard $(NON_HOST_TRIPLES)),)
72 CFG_INFO := $(info cfg: non host triples $(NON_HOST_TRIPLES))
73 endif
74
75 CFG_RUSTC_FLAGS := $(RUSTFLAGS)
76 CFG_GCCISH_CFLAGS :=
77 CFG_GCCISH_LINK_FLAGS :=
78
79 ifdef CFG_DISABLE_OPTIMIZE
80   $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
81   CFG_RUSTC_FLAGS +=
82 else
83   CFG_RUSTC_FLAGS += -O
84 endif
85
86 ifdef CFG_ENABLE_DEBUG
87   $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
88   CFG_RUSTC_FLAGS +=
89   CFG_GCCISH_CFLAGS += -DRUST_DEBUG
90 else
91   CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
92 endif
93
94 ifdef SAVE_TEMPS
95   CFG_RUSTC_FLAGS += --save-temps
96 endif
97 ifdef TIME_PASSES
98   CFG_RUSTC_FLAGS += -Z time-passes
99 endif
100 ifdef TIME_LLVM_PASSES
101   CFG_RUSTC_FLAGS += -Z time-llvm-passes
102 endif
103
104 # platform-specific auto-configuration
105 include $(CFG_SRC_DIR)mk/platform.mk
106
107 # Run the stage1/2 compilers under valgrind
108 ifdef VALGRIND_COMPILE
109   CFG_VALGRIND_COMPILE :=$(CFG_VALGRIND)
110 else
111   CFG_VALGRIND_COMPILE :=
112 endif
113
114 CFG_RUNTIME :=$(call CFG_LIB_NAME,rustrt)
115 CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm)
116 CFG_CORELIB :=$(call CFG_LIB_NAME,core)
117 CFG_STDLIB :=$(call CFG_LIB_NAME,std)
118 CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc)
119 CFG_LIBSYNTAX :=$(call CFG_LIB_NAME,syntax)
120
121 STDLIB_GLOB :=$(call CFG_LIB_GLOB,std)
122 CORELIB_GLOB :=$(call CFG_LIB_GLOB,core)
123 LIBRUSTC_GLOB :=$(call CFG_LIB_GLOB,rustc)
124 LIBSYNTAX_GLOB :=$(call CFG_LIB_GLOB,syntax)
125 STDLIB_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,std)
126 CORELIB_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,core)
127 LIBRUSTC_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rustc)
128 LIBSYNTAX_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,syntax)
129
130 # version-string calculation
131 CFG_GIT_DIR := $(CFG_SRC_DIR).git
132 CFG_RELEASE = 0.3.1
133 CFG_VERSION = $(CFG_RELEASE)
134
135 ifneq ($(wildcard $(CFG_GIT)),)
136 ifneq ($(wildcard $(CFG_GIT_DIR)),)
137     CFG_VERSION += $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
138                      --pretty=format:'(%h %ci)')
139     CFG_VER_HASH = $(shell git --git-dir=$(CFG_GIT_DIR) log -1 \
140                      --pretty=format:'%H')
141 endif
142 endif
143
144 ifdef CFG_DISABLE_VALGRIND
145   $(info cfg: disabling valgrind (CFG_DISABLE_VALGRIND))
146   CFG_VALGRIND :=
147 endif
148 ifdef CFG_BAD_VALGRIND
149   $(info cfg: disabling valgrind due to its unreliability on this platform)
150   CFG_VALGRIND :=
151 endif
152
153
154 ######################################################################
155 # Target-and-rule "utility variables"
156 ######################################################################
157
158 ifdef VERBOSE
159   Q :=
160   E =
161 else
162   Q := @
163   E = echo $(1)
164 endif
165
166 S := $(CFG_SRC_DIR)
167 X := $(CFG_EXE_SUFFIX)
168
169 # Look in doc and src dirs.
170 VPATH := $(S)doc $(S)src
171
172 # "Source" files we generate in builddir along the way.
173 GENERATED :=
174
175 # Delete the built-in rules.
176 .SUFFIXES:
177 %:: %,v
178 %:: RCS/%,v
179 %:: RCS/%
180 %:: s.%
181 %:: SCCS/s.%
182
183 ######################################################################
184 # Core library variables
185 ######################################################################
186
187 CORELIB_CRATE := $(S)src/libcore/core.rc
188 CORELIB_INPUTS := $(wildcard $(addprefix $(S)src/libcore/,        \
189                                            core.rc *.rs */*.rs))
190
191 ######################################################################
192 # Standard library variables
193 ######################################################################
194
195 STDLIB_CRATE := $(S)src/libstd/std.rc
196 STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/libstd/,          \
197                                           std.rc *.rs */*.rs))
198
199 ######################################################################
200 # rustc crate variables
201 ######################################################################
202
203 COMPILER_CRATE := $(S)src/rustc/rustc.rc
204 COMPILER_INPUTS := $(filter-out $(S)src/rustc/driver/rustc.rs,     \
205                        $(wildcard $(addprefix $(S)src/rustc/,      \
206                            rustc.rc *.rs */*.rs */*/*.rs */*/*/*.rs)))
207
208 LIBSYNTAX_CRATE := $(S)src/libsyntax/syntax.rc
209 LIBSYNTAX_INPUTS := $(wildcard $(addprefix $(S)src/libsyntax/, \
210                             syntax.rc *.rs */*.rs */*/*.rs))
211
212 RUSTC_INPUTS := $(S)src/rustc/driver/rustc.rs
213
214 ######################################################################
215 # LLVM macros
216 ######################################################################
217
218 # FIXME: x86-ism
219 LLVM_COMPONENTS=x86 ipo bitreader bitwriter linker asmparser
220
221 define DEF_LLVM_VARS
222 # The configure script defines these variables with the target triples
223 # separated by Z. This defines new ones with the expected format.
224 CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1)))
225 CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
226
227 # Any rules that depend on LLVM should depend on LLVM_CONFIG
228 LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X)
229 LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X)
230 LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
231 LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
232 LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
233 LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
234 LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
235 LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
236 # On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
237 # so we replace -I with -iquote to ensure that it searches bundled LLVM first.
238 LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags))
239 LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)
240
241 LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X)
242 LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X)
243
244 endef
245
246 $(foreach target,$(CFG_TARGET_TRIPLES), \
247  $(eval $(call DEF_LLVM_VARS,$(target))))
248
249 ######################################################################
250 # Exports for sub-utilities
251 ######################################################################
252
253 # Note that any variable that re-configure should pick up needs to be
254 # exported
255
256 export CFG_SRC_DIR
257 export CFG_BUILD_DIR
258 export CFG_VERSION
259 export CFG_HOST_TRIPLE
260 export CFG_LLVM_ROOT
261 export CFG_ENABLE_MINGW_CROSS
262 export CFG_PREFIX
263 export CFG_LIBDIR
264
265 ######################################################################
266 # Subprograms
267 ######################################################################
268
269 ######################################################################
270 # Per-stage targets and runner
271 ######################################################################
272
273 define SREQ
274 # $(1) is the stage number
275 # $(2) is the target triple
276 # $(3) is the host triple
277
278 # Destinations of artifacts for the host compiler
279 HROOT$(1)_H_$(3) = $(3)/stage$(1)
280 HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
281 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR)
282
283 # Destinations of artifacts for target architectures
284 TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustc/$(2)
285 TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
286 TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/$$(CFG_LIBDIR)
287
288 # The name of the core and standard libraries used by rustc
289 ifdef CFG_DISABLE_SHAREDSTD
290   HCORELIB_DEFAULT$(1)_H_$(3) = \
291     $$(HLIB$(1)_H_$(3))/libcore.rlib
292   TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
293     $$(TLIB$(1)_T_$(2)_H_$(3))/libcore.rlib
294
295   HSTDLIB_DEFAULT$(1)_H_$(3) = \
296     $$(HLIB$(1)_H_$(3))/libstd.rlib
297   TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
298     $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib
299
300   HLIBRUSTC_DEFAULT$(1)_H_$(3) = \
301     $$(HLIB$(1)_H_$(3))/librustc.rlib
302   TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3) = \
303     $$(TLIB$(1)_T_$(2)_H_$(3))/librustc.rlib
304 else
305   HCORELIB_DEFAULT$(1)_H_$(3) = \
306     $$(HLIB$(1)_H_$(3))/$(CFG_CORELIB)
307   TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
308     $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB)
309
310   HSTDLIB_DEFAULT$(1)_H_$(3) = \
311     $$(HLIB$(1)_H_$(3))/$(CFG_STDLIB)
312   TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
313     $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB)
314
315   HLIBRUSTC_DEFAULT$(1)_H_$(3) = \
316     $$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTC)
317   TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3) = \
318     $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC)
319 endif
320
321 # Preqrequisites for using the stageN compiler
322 HSREQ$(1)_H_$(3) = \
323         $$(HBIN$(1)_H_$(3))/rustc$$(X) \
324         $$(HLIB$(1)_H_$(3))/$$(CFG_RUNTIME) \
325         $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLLVM) \
326         $$(HCORELIB_DEFAULT$(1)_H_$(3)) \
327         $$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
328         $$(HLIBRUSTC_DEFAULT$(1)_H_$(3)) \
329         $$(MKFILE_DEPS)
330
331 # Prerequisites for using the stageN compiler to build target artifacts
332 TSREQ$(1)_T_$(2)_H_$(3) = \
333         $$(HSREQ$(1)_H_$(3)) \
334         $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME) \
335         $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
336
337 # Prerequisites for complete stageN targets
338 SREQ$(1)_T_$(2)_H_$(3) = \
339         $$(TSREQ$(1)_T_$(2)_H_$(3)) \
340         $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
341         $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)  \
342         $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
343
344 ifeq ($(1),0)
345 # Don't run the the stage0 compiler under valgrind - that ship has sailed
346 CFG_VALGRIND_COMPILE$(1) =
347 else
348 CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE)
349 endif
350
351 # Add RUSTFLAGS_STAGEN values to the build command
352 EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1))
353
354 STAGE$(1)_T_$(2)_H_$(3) :=                                              \
355         $$(Q)$$(call CFG_RUN_TARG,$(1),                         \
356                 $$(CFG_VALGRIND_COMPILE$(1))                    \
357                 $$(HBIN$(1)_H_$(3))/rustc$$(X)                  \
358                 --cfg stage$(1)                                 \
359                 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2))
360
361 PERF_STAGE$(1)_T_$(2)_H_$(3) :=                                 \
362         $$(Q)$$(call CFG_RUN_TARG,$(1),                         \
363                 $$(CFG_PERF_TOOL)                                               \
364                 $$(HBIN$(1)_H_$(3))/rustc$$(X)                  \
365                 --cfg stage$(1)                                 \
366                 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2))
367
368 endef
369
370 $(foreach build,$(CFG_TARGET_TRIPLES), \
371  $(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
372   $(eval $(foreach stage,$(STAGES), \
373    $(eval $(call SREQ,$(stage),$(target),$(build))))))))
374
375 ######################################################################
376 # rustc-H-targets
377 #
378 # Builds a functional Rustc for the given host.
379 ######################################################################
380
381 define DEF_RUSTC_STAGE_TARGET
382 # $(1) == architecture
383 # $(2) == stage
384
385 rustc-stage$(2)-H-$(1):                                                 \
386         $$(foreach target,$$(CFG_TARGET_TRIPLES),       \
387                 $$(SREQ$(2)_T_$$(target)_H_$(1)))
388
389 endef
390
391 $(foreach host,$(CFG_TARGET_TRIPLES),                                                   \
392  $(eval $(foreach stage,1 2 3,                                                                  \
393   $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
394
395 rustc-stage1: rustc-stage1-H-$(CFG_HOST_TRIPLE)
396 rustc-stage2: rustc-stage2-H-$(CFG_HOST_TRIPLE)
397 rustc-stage3: rustc-stage3-H-$(CFG_HOST_TRIPLE)
398
399 define DEF_RUSTC_TARGET
400 # $(1) == architecture
401
402 rustc-H-$(1): rustc-stage2-H-$(1)
403 endef
404
405 $(foreach host,$(CFG_TARGET_TRIPLES),                   \
406  $(eval $(call DEF_RUSTC_TARGET,$(host))))
407
408 rustc-stage1: rustc-stage1-H-$(CFG_HOST_TRIPLE)
409 rustc-stage2: rustc-stage2-H-$(CFG_HOST_TRIPLE)
410 rustc-stage3: rustc-stage3-H-$(CFG_HOST_TRIPLE)
411 rustc: rustc-H-$(CFG_HOST_TRIPLE)
412
413 rustc-H-all: $(foreach host,$(CFG_TARGET_TRIPLES),rustc-H-$(host))
414
415 ######################################################################
416 # Entrypoint rule
417 ######################################################################
418
419 .DEFAULT_GOAL := all
420
421 ifneq ($(CFG_IN_TRANSITION),)
422
423 CFG_INFO := $(info cfg:)
424 CFG_INFO := $(info cfg: *** compiler is in snapshot transition ***)
425 CFG_INFO := $(info cfg: *** stage2 and later will not be built ***)
426 CFG_INFO := $(info cfg:)
427
428 all: $(SREQ1$(CFG_HOST_TRIPLE)) $(GENERATED) docs
429
430 else
431
432 TSREQS :=                                                                                       \
433         $(foreach target,$(CFG_TARGET_TRIPLES),                 \
434                 $(SREQ3_T_$(target)_H_$(CFG_HOST_TRIPLE)))
435 FUZZ := $(HBIN2_H_$(CFG_HOST_TRIPLE))/fuzzer$(X)
436 CARGO := $(HBIN2_H_$(CFG_HOST_TRIPLE))/cargo$(X)
437 RUSTDOC := $(HBIN2_H_$(CFG_HOST_TRIPLE))/rustdoc$(X)
438
439 all: rustc $(GENERATED) docs $(FUZZ) $(CARGO) $(RUSTDOC)
440
441 endif
442
443
444 ######################################################################
445 # Re-configuration
446 ######################################################################
447
448 ifndef CFG_DISABLE_MANAGE_SUBMODULES
449 # This is a pretty expensive operation but I don't see any way to avoid it
450 NEED_GIT_RECONFIG=$(shell cd "$(CFG_SRC_DIR)" && "$(CFG_GIT)" submodule status | grep -c '^\(+\|-\)')
451 else
452 NEED_GIT_RECONFIG=0
453 endif
454
455 ifeq ($(NEED_GIT_RECONFIG),0)
456 else
457 # If the submodules have changed then always execute config.mk
458 .PHONY: config.stamp
459 endif
460
461 Makefile config.mk: config.stamp
462
463 config.stamp: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
464         @$(call E, cfg: reconfiguring)
465         $(Q)$(S)configure $(CFG_CONFIGURE_ARGS)
466
467
468 ######################################################################
469 # Primary-target makefiles
470 ######################################################################
471
472 include $(CFG_SRC_DIR)mk/target.mk
473 include $(CFG_SRC_DIR)mk/host.mk
474 include $(CFG_SRC_DIR)mk/stage0.mk
475 include $(CFG_SRC_DIR)mk/rt.mk
476 include $(CFG_SRC_DIR)mk/rustllvm.mk
477 include $(CFG_SRC_DIR)mk/tools.mk
478 include $(CFG_SRC_DIR)mk/docs.mk
479 include $(CFG_SRC_DIR)mk/llvm.mk
480
481 ######################################################################
482 # Secondary makefiles, conditionalized for speed
483 ######################################################################
484
485 ifneq ($(strip $(findstring dist,$(MAKECMDGOALS))   \
486                $(findstring check,$(MAKECMDGOALS))  \
487                $(findstring test,$(MAKECMDGOALS))   \
488                $(findstring tidy,$(MAKECMDGOALS))   \
489                $(findstring clean,$(MAKECMDGOALS))),)
490   CFG_INFO := $(info cfg: including dist rules)
491   include $(CFG_SRC_DIR)mk/dist.mk
492 endif
493
494 ifneq ($(strip $(findstring snap,$(MAKECMDGOALS))   \
495                $(findstring clean,$(MAKECMDGOALS))),)
496   CFG_INFO := $(info cfg: including snap rules)
497   include $(CFG_SRC_DIR)mk/snap.mk
498 endif
499
500 ifneq ($(findstring reformat,$(MAKECMDGOALS)),)
501   CFG_INFO := $(info cfg: including reformat rules)
502   include $(CFG_SRC_DIR)mk/pp.mk
503 endif
504
505 ifneq ($(strip $(findstring check,$(MAKECMDGOALS)) \
506                $(findstring test,$(MAKECMDGOALS))  \
507                $(findstring perf,$(MAKECMDGOALS))  \
508                $(findstring tidy,$(MAKECMDGOALS))),)
509   CFG_INFO := $(info cfg: including test rules)
510   include $(CFG_SRC_DIR)mk/tests.mk
511 endif
512
513 ifneq ($(findstring perf,$(MAKECMDGOALS)),)
514   CFG_INFO := $(info cfg: including perf rules)
515   include $(CFG_SRC_DIR)mk/perf.mk
516 endif
517
518 ifneq ($(findstring clean,$(MAKECMDGOALS)),)
519   CFG_INFO := $(info cfg: including clean rules)
520   include $(CFG_SRC_DIR)mk/clean.mk
521 endif
522
523 ifneq ($(findstring install,$(MAKECMDGOALS)),)
524   ifdef DESTDIR
525     CFG_INFO := $(info cfg: setting CFG_PREFIX via DESTDIR, $(DESTDIR))
526     CFG_PREFIX:=$(DESTDIR)
527     export CFG_PREFIX
528   endif
529
530   CFG_INFO := $(info cfg: including install rules)
531   include $(CFG_SRC_DIR)mk/install.mk
532 endif
533
534 ifneq ($(strip $(findstring TAGS.emacs,$(MAKECMDGOALS)) \
535                $(findstring TAGS.vi,$(MAKECMDGOALS))),)
536   CFG_INFO := $(info cfg: including ctags rules)
537   include $(CFG_SRC_DIR)mk/ctags.mk
538 endif
539
540 # Find all of the .d files and include them to add information about
541 # header file dependencies.
542 ALL_DEP_FILES := $(ALL_OBJ_FILES:%.o=%.d)
543 -include $(ALL_DEP_FILES)