diff options
author | David Greene <greened@obbligato.org> | 2011-03-04 23:02:52 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2011-03-04 23:02:52 +0000 |
commit | b1939d5db6f95f18c9898861c58d2eac6456f06b (patch) | |
tree | 9b5d5cd8daa86c1d10898fc2e25d8089f190cce4 /utils | |
parent | 0795abd0d44d3e299978c273f52c2dbf4924a6e9 (diff) |
Fix the case where the number of jobs is less than the
number of threads. In that case make the number of threads
equal to the number of jobs and launch one jobs on each
thread. This makes things work like make -j.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/llvmbuild | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/utils/llvmbuild b/utils/llvmbuild index fb8500d38e..5912c50ddf 100755 --- a/utils/llvmbuild +++ b/utils/llvmbuild @@ -650,7 +650,8 @@ class Builder(threading.Thread): def configure(self, component, srcdir, builddir, flags, env): - self.logger.debug("Configure " + str(flags)) + self.logger.debug("Configure " + str(flags) + " " + str(srcdir) + " -> " + + str(builddir)) configure_files = dict( llvm=[(srcdir + "/configure", builddir + "/Makefile")], @@ -721,8 +722,16 @@ branch_abbrev = get_path_abbrevs(set(options.branch)) work_queue = queue.Queue() -for t in range(options.threads): - jobs = options.jobs // options.threads +jobs = options.jobs // options.threads +if jobs == 0: + jobs = 1 + +numthreads = options.threads +if jobs < numthreads: + numthreads = jobs + jobs = 1 + +for t in range(numthreads): builder = Builder(work_queue, jobs, build_abbrev, source_abbrev, branch_abbrev, options) |