Generate scons substitute info in top file
This commit is contained in:
+8
-1
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
|
||||||
#version info of the library, we use 5 chars from the git hash
|
#version info of the library, we use 5 chars from the git hash
|
||||||
revision = os.popen('git describe --abbrev=5 --dirty --always').read()[:-1]
|
revision = os.popen('git describe --abbrev=5 --dirty --always').read()[:-1]
|
||||||
@@ -78,7 +79,6 @@ if os.environ.has_key('CC'):
|
|||||||
env['CC'] = os.environ['CC']
|
env['CC'] = os.environ['CC']
|
||||||
|
|
||||||
env.AddMethod(InstallPerm)
|
env.AddMethod(InstallPerm)
|
||||||
Export('env', 'build_type', 'prefix', 'version_info', 'test_xml')
|
|
||||||
|
|
||||||
env.Append(CFLAGS = ['-std=gnu99','-Wall', '-Wextra', '-Wundef', '-Wcast-qual','-Wshadow' ,'-Wcast-align','-pipe', '-ggdb', '-pthread'])
|
env.Append(CFLAGS = ['-std=gnu99','-Wall', '-Wextra', '-Wundef', '-Wcast-qual','-Wshadow' ,'-Wcast-align','-pipe', '-ggdb', '-pthread'])
|
||||||
env.Append(LINKFLAGS = ['-O2', '-pthread'])
|
env.Append(LINKFLAGS = ['-O2', '-pthread'])
|
||||||
@@ -103,6 +103,13 @@ if GetOption('coverage'):
|
|||||||
env.Append(CFLAGS = ['--coverage'])
|
env.Append(CFLAGS = ['--coverage'])
|
||||||
env.Append(LINKFLAGS = ['--coverage'])
|
env.Append(LINKFLAGS = ['--coverage'])
|
||||||
|
|
||||||
|
# Generate substitute dictionary
|
||||||
|
subst_info = dict(('@' + key + '@', version_info[key]) for key in version_info)
|
||||||
|
subst_info['@prefix'] = prefix
|
||||||
|
subst_info['@build_host@'] = platform.node()
|
||||||
|
|
||||||
|
Export('env', 'build_type', 'prefix', 'version_info', 'test_xml', 'subst_info')
|
||||||
|
|
||||||
#put all .sconsign files in one place
|
#put all .sconsign files in one place
|
||||||
env.SConsignFile()
|
env.SConsignFile()
|
||||||
|
|
||||||
|
|||||||
+2
-6
@@ -1,14 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
import platform
|
|
||||||
|
|
||||||
Import('env', 'build_type', 'prefix', 'version_info')
|
Import('env', 'build_type', 'prefix', 'subst_info')
|
||||||
|
|
||||||
ucore_env = env.Clone()
|
ucore_env = env.Clone()
|
||||||
|
|
||||||
#substitute @version_xx@ strings
|
ucore_env.Substfile('version.c.in', SUBST_DICT = subst_info)
|
||||||
subst_version_info = dict(('@' + key + '@', version_info[key]) for key in version_info)
|
|
||||||
subst_version_info['@build_host@'] = platform.node()
|
|
||||||
ucore_env.Substfile('version.c.in', SUBST_DICT = subst_version_info)
|
|
||||||
|
|
||||||
sources = ucore_env.Glob('*.c')
|
sources = ucore_env.Glob('*.c')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user