Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: GPL-2.0+
0003 #
0004 # Figure out if we should follow a specific parallelism from the make
0005 # environment (as exported by scripts/jobserver-exec), or fall back to
0006 # the "auto" parallelism when "-jN" is not specified at the top-level
0007 # "make" invocation.
0008 
0009 sphinx="$1"
0010 shift || true
0011 
0012 parallel="$PARALLELISM"
0013 if [ -z "$parallel" ] ; then
0014         # If no parallelism is specified at the top-level make, then
0015         # fall back to the expected "-jauto" mode that the "htmldocs"
0016         # target has had.
0017         auto=$(perl -e 'open IN,"'"$sphinx"' --version 2>&1 |";
0018                         while (<IN>) {
0019                                 if (m/([\d\.]+)/) {
0020                                         print "auto" if ($1 >= "1.7")
0021                                 }
0022                         }
0023                         close IN')
0024         if [ -n "$auto" ] ; then
0025                 parallel="$auto"
0026         fi
0027 fi
0028 # Only if some parallelism has been determined do we add the -jN option.
0029 if [ -n "$parallel" ] ; then
0030         parallel="-j$parallel"
0031 fi
0032 
0033 exec "$sphinx" $parallel "$@"