/Makefile.in

http://github.com/jruderman/rust · Autoconf · 543 lines · 316 code · 104 blank · 123 comment · 1 complexity · 27092dbf5cb021f792036184371e3aae MD5 · raw file

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