Merge tag 'linux-kselftest-kunit-fixes-5.11-rc3' of git://git.kernel.org/pub/scm...
[linux/fpc-iii.git] / Documentation / sphinx / parallel-wrapper.sh
blobe54c44ce117d51835f7aeaba820ca48256681915
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0+
4 # Figure out if we should follow a specific parallelism from the make
5 # environment (as exported by scripts/jobserver-exec), or fall back to
6 # the "auto" parallelism when "-jN" is not specified at the top-level
7 # "make" invocation.
9 sphinx="$1"
10 shift || true
12 parallel="$PARALLELISM"
13 if [ -z "$parallel" ] ; then
14 # If no parallelism is specified at the top-level make, then
15 # fall back to the expected "-jauto" mode that the "htmldocs"
16 # target has had.
17 auto=$(perl -e 'open IN,"'"$sphinx"' --version 2>&1 |";
18 while (<IN>) {
19 if (m/([\d\.]+)/) {
20 print "auto" if ($1 >= "1.7")
23 close IN')
24 if [ -n "$auto" ] ; then
25 parallel="$auto"
28 # Only if some parallelism has been determined do we add the -jN option.
29 if [ -n "$parallel" ] ; then
30 parallel="-j$parallel"
33 exec "$sphinx" $parallel "$@"