Skip to content

Commit 334af01

Browse files
committed
mk: Improve build system help commands
1 parent ab17f44 commit 334af01

File tree

4 files changed

+103
-37
lines changed

4 files changed

+103
-37
lines changed

Makefile.in

+82-34
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,100 @@
88
# option. This file may not be copied, modified, or distributed
99
# except according to those terms.
1010

11-
# <help>
11+
# <help> \(^o^)/
1212
#
13-
# # The Rust Build System
13+
# Greetings, adventurer! The Rust Build System is at your service.
14+
#
15+
# Whether you want a genuine copy of `rustc`, access to the latest and
16+
# most authoritative Rust documentation, or even to investigate the
17+
# most intimate workings of the compiler itself, you've come to the
18+
# right place. Let's see what's on the menu.
19+
#
20+
# First, start with one of these build targets:
21+
#
22+
# * all - The default. Builds a complete, bootstrapped compiler.
23+
# `rustc` will be in `${target-triple}/stage2/bin/`. Run it
24+
# directly from the build directory if you like. This also
25+
# comes with docs in `doc/`.
26+
#
27+
# * check - Run the complete test suite
28+
#
29+
# * install - Install Rust. Note that installation is not necessary
30+
# to use the compiler.
31+
#
32+
# * uninstall - Uninstall the binaries
33+
#
34+
# For hot tips on working with The Rust Build System, just:
35+
#
36+
# type `make hot-tips`
37+
#
38+
# Otherwise
39+
#
40+
# type `make`
41+
#
42+
# </help>
43+
#
44+
# <hottips>
45+
#
46+
# # The Rust Build System Tip Line
47+
#
48+
# There are a bazillion different targets you might want to build. Here
49+
# are a few ideas.
1450
#
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
51+
# * docs - Build gobs of HTML documentation and put it into `doc/`
52+
# * check-$(crate) - Test a crate, e.g. `check-std`
53+
# * check-ref - Run the language reference tests
54+
# * check-docs - Test the documentation examples
55+
#
56+
# TODO: Lots more
2957
#
3058
# 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-
# * `NO_MKFILE_DEPS=1` - Don rebuild for modified .mk files
41-
# * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations
42-
# * `ASM_COMMENTS=1` - Use `-Z asm-comments`
43-
# * `TIME_PASSES=1` - Use `-Z time-passes`
44-
# * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes`
45-
# * `TRACE=1` - Use `-Z trace`
59+
# ultimate power of The Rust Build System.
60+
#
61+
# * `VERBOSE=1` - Print all commands. Use this to see what's going on.
62+
# * `RUSTFLAGS=...` - Add compiler flags to all `rustc` invocations
63+
#
64+
# * `TESTNAME=...` - Specify the name of tests to run
65+
# * `CHECK_IGNORED=1` - Run normally-ignored tests
66+
# * `NO_BENCH=1` - Don't run crate benchmarks (disable `--bench` flag)
67+
#
68+
# * `CFG_ENABLE_VALGRIND=1` - Run tests under valgrind
69+
# * `VALGRIND_COMPILE=1` - Run the compiler itself under valgrind
70+
# (may require `CFG_ENABLE_VALGRIND`)
71+
#
72+
# * `NO_REBUILD=1` - Don't rebootstrap when testing std
73+
# (and possibly other crates)
74+
# * `NO_MKFILE_DEPS=1` - Don rebuild for modified .mk files
75+
#
76+
# * `SAVE_TEMPS=1` - Use `--save-temps` flag on all `rustc` invocations
77+
# * `ASM_COMMENTS=1` - Use `-Z asm-comments`
78+
# * `TIME_PASSES=1` - Use `-Z time-passes`
79+
# * `TIME_LLVM_PASSES=1` - Use `-Z time-llvm-passes`
80+
# * `TRACE=1` - Use `-Z trace`
4681
#
4782
# This is hardly all there is to know of The Rust Build System's
48-
# mysteries. Your journey continues on the wiki[1][2].
83+
# mysteries. The tale continues on the wiki[1][2].
4984
#
5085
# [1]: https://github.com/mozilla/rust/wiki/Note-build-system
5186
# [2]: https://github.com/mozilla/rust/wiki/Note-testsuite
5287
#
53-
# </help>
88+
# Unless you feel like getting your hands dirty, then:
89+
#
90+
# don't type `make nitty-gritty`
91+
#
92+
# </hottips>
93+
#
94+
# <nittygritty>
95+
#
96+
# # The Rust Build System
97+
#
98+
# Gosh I wish there was something useful here (TODO).
5499
#
55100
# # An (old) explanation of how the build is structured:
56101
#
57102
# *Note: Hey, like, this is probably inaccurate, and is definitely
58103
# an outdated and insufficient explanation of the remarkable
59-
# and discomfiting Rust Build System.*
104+
# Rust Build System.*
60105
#
61106
# There are multiple build stages (0-3) needed to verify that the
62107
# compiler is properly self-hosting. Each stage is divided between
@@ -99,6 +144,9 @@
99144
# will just link against the libraries in the target lib directory.
100145
#
101146
# Admittedly this is a little convoluted.
147+
#
148+
# </nittygritty>
149+
#
102150

103151
######################################################################
104152
# Primary rules

configure

+2
Original file line numberDiff line numberDiff line change
@@ -1103,3 +1103,5 @@ rm -f config.tmp
11031103
touch config.stamp
11041104

11051105
step_msg "complete"
1106+
msg "type \`make help\`"
1107+
msg

mk/main.mk

+15-3
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,20 @@ ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET), \
428428

429429
all: $(ALL_TARGET_RULES) $(GENERATED) docs
430430

431-
help:
432-
# Show the comments from Makefile.in as "help"
431+
######################################################################
432+
# Build system documentation
433+
######################################################################
434+
435+
# $(1) is the name of the doc <section> in Makefile.in
433436
# pick everything between tags | remove first line | remove last line
434437
# | remove extra (?) line | strip leading `#` from lines
435-
$(Q)awk '/<help>/,/<\/help>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^# \?//'
438+
SHOW_DOCS = $(Q)awk '/$(1)/,/<\/$(1)>/' $(S)/Makefile.in | sed '1d' | sed '$$d' | sed 's/^\# \?//'
439+
440+
help:
441+
$(call SHOW_DOCS,help)
442+
443+
hot-tips:
444+
$(call SHOW_DOCS,hottips)
445+
446+
nitty-gritty:
447+
$(call SHOW_DOCS,nittygritty)

mk/tests.mk

+4
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ check-lite: cleantestlibs cleantmptestlogs \
190190
check-stage2-rfail check-stage2-cfail check-stage2-rmake
191191
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
192192

193+
check-ref: cleantestlibs cleantmptestlogs check-stage2-rpass \
194+
check-stage2-rfail check-stage2-cfail check-stage2-rmake
195+
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
196+
193197
.PHONY: cleantmptestlogs cleantestlibs
194198

195199
cleantmptestlogs:

0 commit comments

Comments
 (0)