diff options
Diffstat (limited to 'scripts/make-intercept/make')
-rwxr-xr-x | scripts/make-intercept/make | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/scripts/make-intercept/make b/scripts/make-intercept/make new file mode 100755 index 00000000000..23cfb11b84b --- /dev/null +++ b/scripts/make-intercept/make @@ -0,0 +1,31 @@ +#!/usr/bin/env python +import sys +import os +import subprocess + +if "BB_MAKEFIFO" in os.environ: + fifoname = os.environ["BB_MAKEFIFO"] + + r = os.open(fifoname, os.O_RDONLY|os.O_NONBLOCK) + w = os.open(fifoname, os.O_WRONLY) + os.close(r) + r = os.open(fifoname, os.O_RDONLY) + + seen = False + for i in sys.argv: + if "-j" in i: + seen = True + if seen: + os.environ["MAKEFLAGS"] = "-j --jobserver-fds=" + str(r) + "," + str(w) + +newpath = [] +origpath = os.environ["PATH"].split(":") +for p in origpath: + if "make-intercept" in p: + continue + newpath.append(p) +os.environ["PATH"] = ":".join(newpath) + +sys.argv[0] = "make" + +sys.exit(subprocess.call(sys.argv, shell=False)) |