diff --git a/SConstruct b/SConstruct index 467e347..4a4e817 100644 --- a/SConstruct +++ b/SConstruct @@ -71,6 +71,7 @@ AddOption('--32', build_type = GetOption('build_type') assertions = GetOption('assertions') +stack_protection = GetOption('stack_protection') test_xml = GetOption('test_xml') prefix = GetOption('prefix') if not (build_type in ['debug', 'release']): @@ -112,7 +113,7 @@ if build_type == 'release': elif build_type == 'debug': env.Append(CPPDEFINES = ['DEBUG']) -if GetOption('stack_protection'): +if stack_protection: env.Append(CFLAGS = ['-fstack-protector', '--param=ssp-buffer-size=4']) env.Append(CPPDEFINES = ['_FORTIFY_SOURCE=2']) @@ -123,6 +124,12 @@ if GetOption('coverage'): # Generate substitute dictionary subst_info = dict(('@' + key + '@', version_info[key]) for key in version_info) subst_info['@prefix@'] = prefix +subst_info['@build_type@'] = build_type +if assertions: + subst_info['@build_type@'] += '_A' +if stack_protection: + subst_info['@build_type@'] += '_SP' + subst_info['@build_host@'] = platform.node() Export('env', 'build_type', 'prefix', 'version_info', 'test_xml', 'subst_info') diff --git a/include/ucore/version.h b/include/ucore/version.h index 23803a1..71a2225 100644 --- a/include/ucore/version.h +++ b/include/ucore/version.h @@ -50,6 +50,9 @@ extern const char ucore_version_str[]; */ extern const char ucore_build_host[]; +/** The build type (release or debug) + */ +extern const char ucore_build_type[]; #ifdef __cplusplus } #endif diff --git a/src/version.c.in b/src/version.c.in index 6f41e8d..ade8110 100644 --- a/src/version.c.in +++ b/src/version.c.in @@ -7,4 +7,5 @@ const int ucore_version_patch = @version_patch@; const char ucore_version_str[] = "@version_str@"; const char ucore_build_host[] = "@build_host@"; +const char ucore_build_type[] = "@build_type@";