]> git.lizzy.rs Git - rust.git/blob - mk/main.mk
auto merge of #15160 : alexcrichton/rust/remove-f128, r=brson
[rust.git] / mk / main.mk
1 # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
4 #
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
10
11 ######################################################################
12 # Version numbers and strings
13 ######################################################################
14
15 # The version number
16 CFG_RELEASE_NUM=0.11.0
17 CFG_RELEASE_LABEL=-pre
18
19 ifndef CFG_ENABLE_NIGHTLY
20 # This is the normal version string
21 CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)
22 CFG_PACKAGE_VERS=$(CFG_RELEASE)
23 else
24 # Modify the version label for nightly builds
25 CFG_RELEASE=$(CFG_RELEASE_NUM)$(CFG_RELEASE_LABEL)-nightly
26 # When building nightly distributables just reuse the same "rust-nightly" name
27 # so when we upload we'll always override the previous nighly. This doesn't actually
28 # impact the version reported by rustc - it's just for file naming.
29 CFG_PACKAGE_VERS=nightly
30 endif
31 # The name of the package to use for creating tarballs, installers etc.
32 CFG_PACKAGE_NAME=rust-$(CFG_PACKAGE_VERS)
33
34 # The version string plus commit information - this is what rustc reports
35 CFG_VERSION = $(CFG_RELEASE)
36 CFG_GIT_DIR := $(CFG_SRC_DIR).git
37 # since $(CFG_GIT) may contain spaces (especially on Windows),
38 # we need to escape them. (" " to r"\ ")
39 # Note that $(subst ...) ignores space after `subst`,
40 # so we use a hack: define $(SPACE) which contains space character.
41 SPACE :=
42 SPACE +=
43 ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT))),)
44 ifneq ($(wildcard $(subst $(SPACE),\$(SPACE),$(CFG_GIT_DIR))),)
45     CFG_VER_DATE = $(shell git --git-dir='$(CFG_GIT_DIR)' log -1 --pretty=format:'%ci')
46     CFG_VER_HASH = $(shell git --git-dir='$(CFG_GIT_DIR)' rev-parse HEAD)
47     CFG_VERSION += ($(CFG_VER_HASH) $(CFG_VER_DATE))
48 endif
49 endif
50
51 # Windows exe's need numeric versions - don't use anything but
52 # numbers and dots here
53 CFG_VERSION_WIN = $(CFG_RELEASE_NUM)
54
55
56 ######################################################################
57 # More configuration
58 ######################################################################
59
60 # We track all of the object files we might build so that we can find
61 # and include all of the .d files in one fell swoop.
62 ALL_OBJ_FILES :=
63
64 MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
65 MKFILES_FOR_TARBALL:=$(MKFILE_DEPS)
66 ifneq ($(NO_MKFILE_DEPS),)
67 MKFILE_DEPS :=
68 endif
69 NON_BUILD_HOST = $(filter-out $(CFG_BUILD),$(CFG_HOST))
70 NON_BUILD_TARGET = $(filter-out $(CFG_BUILD),$(CFG_TARGET))
71
72 ifneq ($(MAKE_RESTARTS),)
73 CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
74 endif
75
76 CFG_INFO := $(info cfg: build triple $(CFG_BUILD))
77 CFG_INFO := $(info cfg: host triples $(CFG_HOST))
78 CFG_INFO := $(info cfg: target triples $(CFG_TARGET))
79
80 ifneq ($(wildcard $(NON_BUILD_HOST)),)
81 CFG_INFO := $(info cfg: non-build host triples $(NON_BUILD_HOST))
82 endif
83 ifneq ($(wildcard $(NON_BUILD_TARGET)),)
84 CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET))
85 endif
86
87 CFG_RUSTC_FLAGS := $(RUSTFLAGS)
88 CFG_GCCISH_CFLAGS :=
89 CFG_GCCISH_LINK_FLAGS :=
90
91 ifdef CFG_DISABLE_OPTIMIZE
92   $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
93   CFG_RUSTC_FLAGS +=
94 else
95   # The rtopt cfg turns off runtime sanity checks
96   CFG_RUSTC_FLAGS += -O --cfg rtopt
97 endif
98
99 ifdef CFG_DISABLE_DEBUG
100   CFG_RUSTC_FLAGS += --cfg ndebug
101   CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
102 else
103   $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
104   CFG_RUSTC_FLAGS += --cfg debug
105   CFG_GCCISH_CFLAGS += -DRUST_DEBUG
106 endif
107
108 ifdef SAVE_TEMPS
109   CFG_RUSTC_FLAGS += --save-temps
110 endif
111 ifdef ASM_COMMENTS
112   CFG_RUSTC_FLAGS += -Z asm-comments
113 endif
114 ifdef TIME_PASSES
115   CFG_RUSTC_FLAGS += -Z time-passes
116 endif
117 ifdef TIME_LLVM_PASSES
118   CFG_RUSTC_FLAGS += -Z time-llvm-passes
119 endif
120 ifdef TRACE
121   CFG_RUSTC_FLAGS += -Z trace
122 endif
123 ifdef CFG_DISABLE_RPATH
124 CFG_RUSTC_FLAGS += -C no-rpath
125 endif
126
127 # The executables crated during this compilation process have no need to include
128 # static copies of libstd and libextra. We also generate dynamic versions of all
129 # libraries, so in the interest of space, prefer dynamic linking throughout the
130 # compilation process.
131 #
132 # Note though that these flags are omitted for stage2+. This means that the
133 # snapshot will be generated with a statically linked rustc so we only have to
134 # worry about the distribution of one file (with its native dynamic
135 # dependencies)
136 RUSTFLAGS_STAGE0 += -C prefer-dynamic
137 RUSTFLAGS_STAGE1 += -C prefer-dynamic
138
139 # platform-specific auto-configuration
140 include $(CFG_SRC_DIR)mk/platform.mk
141
142 # Run the stage1/2 compilers under valgrind
143 ifdef VALGRIND_COMPILE
144   CFG_VALGRIND_COMPILE :=$(CFG_VALGRIND)
145 else
146   CFG_VALGRIND_COMPILE :=
147 endif
148
149 ifdef CFG_ENABLE_VALGRIND
150   $(info cfg: enabling valgrind (CFG_ENABLE_VALGRIND))
151 else
152   CFG_VALGRIND :=
153 endif
154 ifdef CFG_BAD_VALGRIND
155   $(info cfg: disabling valgrind due to its unreliability on this platform)
156   CFG_VALGRIND :=
157 endif
158
159
160 ######################################################################
161 # Target-and-rule "utility variables"
162 ######################################################################
163
164 define DEF_X
165 X_$(1) := $(CFG_EXE_SUFFIX_$(1))
166 endef
167 $(foreach target,$(CFG_TARGET),\
168   $(eval $(call DEF_X,$(target))))
169
170 # "Source" files we generate in builddir along the way.
171 GENERATED :=
172
173 # Delete the built-in rules.
174 .SUFFIXES:
175 %:: %,v
176 %:: RCS/%,v
177 %:: RCS/%
178 %:: s.%
179 %:: SCCS/s.%
180
181
182 ######################################################################
183 # Cleaning out old crates
184 ######################################################################
185
186 # $(1) is the path for directory to match against
187 # $(2) is the glob to use in the match
188 #
189 # Note that a common bug is to accidentally construct the glob denoted
190 # by $(2) with a space character prefix, which invalidates the
191 # construction $(1)$(2).
192 define CHECK_FOR_OLD_GLOB_MATCHES
193   $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: there are previous" \'$(notdir $(2))\' "libraries:" $$MATCHES; fi
194 endef
195
196 # Same interface as above, but deletes rather than just listing the files.
197 ifdef VERBOSE
198 define REMOVE_ALL_OLD_GLOB_MATCHES
199   $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then echo "warning: removing previous" \'$(notdir $(1))\' "libraries:" $$MATCHES; rm $$MATCHES ; fi
200 endef
201 else
202 define REMOVE_ALL_OLD_GLOB_MATCHES
203   $(Q)MATCHES="$(wildcard $(1))"; if [ -n "$$MATCHES" ] ; then rm $$MATCHES ; fi
204 endef
205 endif
206
207 # We use a different strategy for LIST_ALL_OLD_GLOB_MATCHES_EXCEPT
208 # than in the macros above because it needs the result of running the
209 # `ls` command after other rules in the command list have run; the
210 # macro-expander for $(wildcard ...) would deliver its results too
211 # soon. (This is in contrast to the macros above, which are meant to
212 # be run at the outset of a command list in a rule.)
213 ifdef VERBOSE
214 define LIST_ALL_OLD_GLOB_MATCHES
215   @echo "info: now are following matches for" '$(notdir $(1))' "libraries:"
216   @( ls $(1) 2>/dev/null || true )
217 endef
218 else
219 define LIST_ALL_OLD_GLOB_MATCHES
220 endef
221 endif
222
223 ######################################################################
224 # LLVM macros
225 ######################################################################
226
227 # FIXME: x86-ism
228 LLVM_COMPONENTS=x86 arm mips ipo bitreader bitwriter linker asmparser jit mcjit \
229                 interpreter instrumentation
230
231 # Only build these LLVM tools
232 LLVM_TOOLS=bugpoint llc llvm-ar llvm-as llvm-dis llvm-mc opt llvm-extract
233
234 define DEF_LLVM_VARS
235 # The configure script defines these variables with the target triples
236 # separated by Z. This defines new ones with the expected format.
237 ifeq ($$(CFG_LLVM_ROOT),)
238 CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1)))
239 CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
240 else
241 CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_ROOT)
242 endif
243
244 # Any rules that depend on LLVM should depend on LLVM_CONFIG
245 LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
246 LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
247 LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
248 LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
249 LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
250 LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
251 LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
252 LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
253 # On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
254 # so we replace -I with -iquote to ensure that it searches bundled LLVM first.
255 LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags))
256 LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)
257
258 LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X_$(1))
259 LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X_$(1))
260
261 endef
262
263 $(foreach host,$(CFG_HOST), \
264  $(eval $(call DEF_LLVM_VARS,$(host))))
265
266 ######################################################################
267 # Exports for sub-utilities
268 ######################################################################
269
270 # Note that any variable that re-configure should pick up needs to be
271 # exported
272
273 export CFG_SRC_DIR
274 export CFG_BUILD_DIR
275 ifdef CFG_VER_DATE
276 export CFG_VER_DATE
277 endif
278 ifdef CFG_VER_HASH
279 export CFG_VER_HASH
280 endif
281 export CFG_VERSION
282 export CFG_VERSION_WIN
283 export CFG_RELEASE
284 export CFG_PACKAGE_NAME
285 export CFG_BUILD
286 export CFG_LLVM_ROOT
287 export CFG_ENABLE_MINGW_CROSS
288 export CFG_PREFIX
289 export CFG_LIBDIR
290 export CFG_LIBDIR_RELATIVE
291 export CFG_DISABLE_INJECT_STD_VERSION
292
293 ######################################################################
294 # Per-stage targets and runner
295 ######################################################################
296
297 STAGES = 0 1 2 3
298
299 define SREQ
300 # $(1) is the stage number
301 # $(2) is the target triple
302 # $(3) is the host triple
303
304 # Destinations of artifacts for the host compiler
305 HROOT$(1)_H_$(3) = $(3)/stage$(1)
306 HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
307 HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
308
309 # Destinations of artifacts for target architectures
310 TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
311 TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin
312 TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib
313
314 # Preqrequisites for using the stageN compiler
315 ifeq ($(1),0)
316 HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
317 else
318 HSREQ$(1)_H_$(3) = \
319         $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
320         $$(MKFILE_DEPS)
321 endif
322
323 # Prerequisites for using the stageN compiler to build target artifacts
324 TSREQ$(1)_T_$(2)_H_$(3) = \
325         $$(HSREQ$(1)_H_$(3)) \
326         $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a \
327         $$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
328
329 # Prerequisites for a working stageN compiler and libraries, for a specific
330 # target
331 SREQ$(1)_T_$(2)_H_$(3) = \
332         $$(TSREQ$(1)_T_$(2)_H_$(3)) \
333         $$(foreach dep,$$(TARGET_CRATES),\
334             $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
335
336 # Prerequisites for a working stageN compiler and complete set of target
337 # libraries
338 CSREQ$(1)_T_$(2)_H_$(3) = \
339         $$(TSREQ$(1)_T_$(2)_H_$(3)) \
340         $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
341         $$(foreach dep,$$(CRATES),$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
342
343 ifeq ($(1),0)
344 # Don't run the stage0 compiler under valgrind - that ship has sailed
345 CFG_VALGRIND_COMPILE$(1) =
346 else
347 CFG_VALGRIND_COMPILE$(1) = $$(CFG_VALGRIND_COMPILE)
348 endif
349
350 # Add RUSTFLAGS_STAGEN values to the build command
351 EXTRAFLAGS_STAGE$(1) = $$(RUSTFLAGS_STAGE$(1))
352
353 CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
354
355 endef
356
357 # Same macro/variables as above, but defined in a separate loop so it can use
358 # all the variables above for all archs. The RPATH_VAR setup sometimes needs to
359 # reach across triples to get things in order.
360 #
361 # Defines (with the standard $(1)_T_$(2)_H_$(3) suffix):
362 # * `LD_LIBRARY_PATH_ENV_NAME`: the name for the key to use in the OS
363 #   environment to access or extend the lookup path for dynamic
364 #   libraries.  Note on Windows, that key is `$PATH`, and thus not
365 #   only conflates programs with dynamic libraries, but also often
366 #   contains spaces which confuse make.
367 # * `LD_LIBRARY_PATH_ENV_HOSTDIR`: the entry to add to lookup path for the host
368 # * `LD_LIBRARY_PATH_ENV_TARGETDIR`: the entry to add to lookup path for target
369 #
370 # Below that, HOST_RPATH_VAR and TARGET_RPATH_VAR are defined in terms of the
371 # above settings.
372 #
373 define SREQ_CMDS
374
375 ifeq ($$(OSTYPE_$(3)),apple-darwin)
376   LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := DYLD_LIBRARY_PATH
377 else
378 ifeq ($$(CFG_WINDOWSY_$(2)),1)
379   LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := PATH
380 else
381   LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3) := LD_LIBRARY_PATH
382 endif
383 endif
384
385 LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
386     $$(CURDIR)/$$(HLIB$(1)_H_$(3))
387 LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
388     $$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))
389
390 HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
391   $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
392 TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
393   $$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
394
395 RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))
396
397 # Pass --cfg stage0 only for the build->host part of stage0;
398 # if you're building a cross config, the host->* parts are
399 # effectively stage1, since it uses the just-built stage0.
400 #
401 # This logic is similar to how the LD_LIBRARY_PATH variable must
402 # change be slightly different when doing cross compilations.
403 # The build doesn't copy over all target libraries into
404 # a new directory, so we need to point the library path at
405 # the build directory where all the target libraries came
406 # from (the stage0 build host). Otherwise the relative rpaths
407 # inside of the rustc binary won't get resolved correctly.
408 ifeq ($(1),0)
409 ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
410 CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
411
412 RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3))
413 endif
414 endif
415
416 STAGE$(1)_T_$(2)_H_$(3) :=                                              \
417         $$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3))                            \
418                 $$(call CFG_RUN_TARG_$(3),$(1),                         \
419                 $$(CFG_VALGRIND_COMPILE$(1))                            \
420                 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))                     \
421                 --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3))                     \
422                 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
423                 $$(RUSTC_FLAGS_$(2))
424
425 PERF_STAGE$(1)_T_$(2)_H_$(3) :=                                         \
426         $$(Q)$$(call CFG_RUN_TARG_$(3),$(1),                            \
427                 $$(CFG_PERF_TOOL)                                       \
428                 $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))                     \
429                 --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3))                     \
430                 $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
431                 $$(RUSTC_FLAGS_$(2))
432
433 endef
434
435 $(foreach build,$(CFG_HOST), \
436  $(eval $(foreach target,$(CFG_TARGET), \
437   $(eval $(foreach stage,$(STAGES), \
438    $(eval $(call SREQ,$(stage),$(target),$(build))))))))
439
440 $(foreach build,$(CFG_HOST), \
441  $(eval $(foreach target,$(CFG_TARGET), \
442   $(eval $(foreach stage,$(STAGES), \
443    $(eval $(call SREQ_CMDS,$(stage),$(target),$(build))))))))
444
445 ######################################################################
446 # rustc-H-targets
447 #
448 # Builds a functional Rustc for the given host.
449 ######################################################################
450
451 define DEF_RUSTC_STAGE_TARGET
452 # $(1) == architecture
453 # $(2) == stage
454
455 rustc-stage$(2)-H-$(1):                                                 \
456         $$(foreach target,$$(CFG_TARGET),$$(SREQ$(2)_T_$$(target)_H_$(1)))
457
458 endef
459
460 $(foreach host,$(CFG_HOST),                                             \
461  $(eval $(foreach stage,1 2 3,                                          \
462   $(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
463
464 rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
465 rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
466 rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
467
468 define DEF_RUSTC_TARGET
469 # $(1) == architecture
470
471 rustc-H-$(1): rustc-stage2-H-$(1)
472 endef
473
474 $(foreach host,$(CFG_TARGET),                   \
475  $(eval $(call DEF_RUSTC_TARGET,$(host))))
476
477 rustc-stage1: rustc-stage1-H-$(CFG_BUILD)
478 rustc-stage2: rustc-stage2-H-$(CFG_BUILD)
479 rustc-stage3: rustc-stage3-H-$(CFG_BUILD)
480 rustc: rustc-H-$(CFG_BUILD)
481
482 rustc-H-all: $(foreach host,$(CFG_HOST),rustc-H-$(host))
483
484 ######################################################################
485 # Entrypoint rule
486 ######################################################################
487
488 .DEFAULT_GOAL := all
489
490 define ALL_TARGET_N
491 ifneq ($$(findstring $(1),$$(CFG_HOST)),)
492 # This is a host
493 all-target-$(1)-host-$(2): $$(CSREQ2_T_$(1)_H_$(2))
494 else
495 # This is a target only
496 all-target-$(1)-host-$(2): $$(SREQ2_T_$(1)_H_$(2))
497 endif
498 endef
499
500 $(foreach target,$(CFG_TARGET), \
501  $(foreach host,$(CFG_HOST), \
502  $(eval $(call ALL_TARGET_N,$(target),$(host)))))
503
504 ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
505         $(foreach host,$(CFG_HOST), \
506  all-target-$(target)-host-$(host)))
507
508 all: $(ALL_TARGET_RULES) $(GENERATED) docs
509
510 ######################################################################
511 # Build system documentation
512 ######################################################################
513
514 # $(1) is the name of the doc <section> in Makefile.in
515 # pick everything between tags | remove first line | remove last line
516 # | remove extra (?) line | strip leading `#` from lines
517 SHOW_DOCS = $(Q)awk '/<$(1)>/,/<\/$(1)>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^\# \?//'
518
519 help:
520         $(call SHOW_DOCS,help)
521
522 tips:
523         $(call SHOW_DOCS,tips)
524
525 nitty-gritty:
526         $(call SHOW_DOCS,nitty-gritty)