Skip to content

Commit 6c4d64c

Browse files
author
Cruz Monrreal
authored
Merge pull request #7846 from theotherjimmy/gcc-distcc
Tools: Use Distcc when it's configured
2 parents f7a7315 + 09ea2a3 commit 6c4d64c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/toolchains/gcc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""
1717
import re
1818
from os.path import join, basename, splitext, dirname, exists
19+
from os import getenv
1920
from distutils.spawn import find_executable
2021
from distutils.version import LooseVersion
2122

@@ -116,6 +117,9 @@ def __init__(self, target, notify=None, macros=None, build_profile=None,
116117
self.ar = join(tool_path, "arm-none-eabi-ar")
117118
self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
118119

120+
self.use_distcc = (bool(getenv("DISTCC_POTENTIAL_HOSTS", False))
121+
and not getenv("MBED_DISABLE_DISTCC", False))
122+
119123
def version_check(self):
120124
stdout, _, retcode = run_cmd([self.cc[0], "--version"], redirect=True)
121125
msg = None
@@ -207,6 +211,8 @@ def compile(self, cc, source, object, includes):
207211

208212
# Call cmdline hook
209213
cmd = self.hook.get_cmdline_compiler(cmd)
214+
if self.use_distcc:
215+
cmd = ["distcc"] + cmd
210216

211217
return [cmd]
212218

0 commit comments

Comments
 (0)