configure.py: "ninja help" target

This adds a "help" build target, which prints out important build
targets. The printing is done in a separate shell script, becaue "ninja"
insists on print out the "command" before executing it, which makes the
help text unreadable.
This commit is contained in:
Pekka Enberg
2021-04-12 10:23:20 +03:00
parent e77c7f4543
commit 698710598a
2 changed files with 22 additions and 0 deletions

View File

@@ -2023,6 +2023,9 @@ with open(buildfile_tmp, 'w') as f:
rule extract_node_exporter
command = tar -C build -xvpf {node_exporter_filename} && rm -rfv build/node_exporter && mv -v build/{node_exporter_dirname} build/node_exporter
build $builddir/node_exporter: extract_node_exporter | always
rule print_help
command = ./scripts/build-help.sh
build help: print_help | always
''').format(**globals()))
os.rename(buildfile_tmp, buildfile)

19
scripts/build-help.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
cat << EOF
usage: ninja [options] [targets...]
Run \`ninja -h\` for help on supported options.
Build targets:
build Build artifacts for all configured build modes.
<mode>-build Build artifacts for a specific build mode.
Test targets:
test Run tests for all configured build modes.
<mode>-test Run tests for a specific build mode.
Packaging targets:
dist Build distribution packages (.rpm, .deb) for all build modes.
<mode>-dist Build distribution packages (.rpm, .deb) for a specific build mode.
EOF