Skip to content

Commit b11e73d

Browse files
committed
mk: Add some serious documentation and 'make help'
'make help' is implemented in a fairly ridiculous way, using awk to parse comments out of Makefile.in and displaying them.
1 parent d365c3a commit b11e73d

File tree

1 file changed

+54
-1
lines changed

1 file changed

+54
-1
lines changed

Makefile.in

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,54 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11-
# An explanation of how the build is structured:
11+
# <help>
12+
#
13+
# # The Rust Build System
14+
#
15+
# Start with these these build targets:
16+
#
17+
# * all - The default rule. Builds a complete stage2 compiler, std,
18+
# and extra for all hosts and targets
19+
# * docs - Generate HTML documentation for the std and extra libraries
20+
# from source code comments
21+
# * rustc - The stage 2 compiler for the build platform with standard
22+
# and extra libraries
23+
# * install
24+
# * uninstall
25+
# * check - Run tests
26+
# * check-stage1-$(crate) - Run tests for a crate, e.g. `check-stage1-std`
27+
# * check-stage1-rpass - Run the language tests
28+
# * check-docs - Run the doc tests
29+
#
30+
# Then mix in some of these environment variables to harness the
31+
# ultimate power of Rust Build System.
32+
#
33+
# * `VERBOSE=1` - Print all commands. Use this to see what's going on.
34+
# * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
35+
# * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
36+
# * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
37+
# (may require `CFG_ENABLE_VALGRIND`)
38+
# * `NO_REBUILD=1` - Don't rebootstrap when testing std
39+
# (and possibly other crates)
40+
# * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations
41+
# * `ASM_COMMENTS=1` - Use `-Z asm-comments`
42+
# * `TIME_PASSES=1` - Use `-Z time-passes`
43+
# * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes`
44+
# * `TRACE=1` - Use `-Z trace`
45+
#
46+
# This is hardly all there is to know of The Rust Build System's
47+
# mysteries. Your journey continues on the wiki[1][2].
48+
#
49+
# [1]: https://github.com/mozilla/rust/wiki/Note-build-system
50+
# [2]: https://github.com/mozilla/rust/wiki/Note-testsuite
51+
#
52+
# </help>
53+
#
54+
# # An (old) explanation of how the build is structured:
55+
#
56+
# *Note: Hey, like, this is probably inaccurate, and is definitely
57+
# an outdated and insufficient explanation of the remarkable
58+
# and discomfiting Rust Build System.*
1259
#
1360
# There are multiple build stages (0-3) needed to verify that the
1461
# compiler is properly self-hosting. Each stage is divided between
@@ -598,3 +645,9 @@ endif
598645
# header file dependencies.
599646
ALL_DEP_FILES := $(ALL_OBJ_FILES:%.o=%.d)
600647
-include $(ALL_DEP_FILES)
648+
649+
help:
650+
# Show the comments from this file as "help"
651+
# pick everything between tags | remove first line | remove last line
652+
# | remove extra (?) line | strip leading `#` from lines
653+
$(Q)awk '/<help>/,/<\/help>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^# \?//'

0 commit comments

Comments
 (0)