phase1: rework MakeEnv()
authorJo-Philipp Wich <jo@mein.io>
Tue, 25 Sep 2018 13:57:28 +0000 (15:57 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 25 Sep 2018 13:57:28 +0000 (15:57 +0200)
Always set CCC and CCXX since ./staging_dir/host/bin/{gcc,g++} might be
symlinked to the ccache wrapper which uses $CCC / $CCXX to refer to the
actual compiler, even when we intend to invoke the build without ccache.

While being at it, shuffle the code around somewhat to reduce some
redundancy and to make the function a bit shorter.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
phase1/master.cfg

index 71b3c812b89c0fd441cf61a4ef5df0a15b597741..de46c1b5b05885654fda907a9ab9377822e93d09 100644 (file)
@@ -334,25 +334,18 @@ def GetNextBuild(builder, requests):
        return requests[0]
 
 def MakeEnv(overrides=None, tryccache=False):
-       if tryccache:
-               envcc = Interpolate("%(kw:cwd)s/ccache_cc.sh", cwd=GetCwd)
-               envcxx = Interpolate("%(kw:cwd)s/ccache_cxx.sh", cwd=GetCwd)
-               envccache = Interpolate("%(kw:ccache)s", ccache=GetCCache)
-               envccc = Interpolate("%(kw:cc)s", cc=GetCC)
-               envccxx = Interpolate("%(kw:cxx)s", cxx=GetCXX)
-       else:
-               envcc = Interpolate("%(kw:cc)s", cc=GetCC)
-               envcxx = Interpolate("%(kw:cxx)s", cxx=GetCXX)
-               envccache = ""
-               envccc = ""
-               envccxx = ""
        env = {
-               'CC': envcc,
-               'CXX': envcxx,
-               'CCACHE': envccache,
-               'CCC': envccc,
-               'CCXX': envccxx,
+               'CCC': Interpolate("%(kw:cc)s", cc=GetCC),
+               'CCXX': Interpolate("%(kw:cxx)s", cxx=GetCXX),
        }
+       if tryccache:
+               env['CC'] = Interpolate("%(kw:cwd)s/ccache_cc.sh", cwd=GetCwd)
+               env['CXX'] = Interpolate("%(kw:cwd)s/ccache_cxx.sh", cwd=GetCwd)
+               env['CCACHE'] = Interpolate("%(kw:ccache)s", ccache=GetCCache)
+       else:
+               env['CC'] = env['CCC']
+               env['CXX'] = env['CCXX']
+               env['CCACHE'] = ''
        if overrides is not None:
                env.update(overrides)
        return env