Lines Matching +full:- +full:- +full:env
50 # We track top-level targets to automatically generate help and alias them.
72 # Build options ----------------------------------------------------------------
79 'CCFLAGS' : ['-Wall',
80 '-Werror',
81 '-fdiagnostics-show-option',
82 '-Wextra',
83 '-Wredundant-decls',
84 '-pedantic',
85 '-Wwrite-strings',
86 '-Wunused'],
93 'CCFLAGS' : ['-DVIXL_DEBUG', '-O0']
96 'CCFLAGS' : ['-O3'],
99 'CCFLAGS' : ['-DVIXL_INCLUDE_SIMULATOR_AARCH64'],
102 'CCFLAGS' : ['-g'],
103 'LINKFLAGS' : ['-g']
106 'CCFLAGS' : ['-DVIXL_NEGATIVE_TESTING']
109 'CCFLAGS' : ['-DVIXL_CODE_BUFFER_MMAP']
112 'CCFLAGS' : ['-DVIXL_CODE_BUFFER_MALLOC']
115 'CCFLAGS': ['-fsanitize=undefined'],
116 'LINKFLAGS': ['-fsanitize=undefined']
125 def modifiable_flags_handler(env):
126 env['modifiable_flags'] = \
127 'on' if 'mode' in env and env['mode'] == 'debug' else 'off'
130 def symbols_handler(env):
131 env['symbols'] = 'on' if 'mode' in env and env['mode'] == 'debug' else 'off'
133 def Is32BitHost(env):
134 return env['host_arch'] in ['aarch32', 'i386']
136 def IsAArch64Host(env):
137 return env['host_arch'] == 'aarch64'
139 def CanTargetA32(env):
140 return 'a32' in env['target']
142 def CanTargetT32(env):
143 return 't32' in env['target']
145 def CanTargetAArch32(env):
146 return CanTargetA32(env) or CanTargetT32(env)
148 def CanTargetA64(env):
149 return 'a64' in env['target']
151 def CanTargetAArch64(env):
152 return CanTargetA64(env)
157 def simulator_handler(env):
158 if not IsAArch64Host(env) and CanTargetAArch64(env):
159 env['simulator'] = 'aarch64'
161 env['simulator'] = 'none'
166 def code_buffer_allocator_handler(env):
167 directives = util.GetCompilerDirectives(env)
169 env['code_buffer_allocator'] = 'mmap'
171 env['code_buffer_allocator'] = 'malloc'
174 def default_validator(env):
178 def simulator_validator(env):
179 if env['simulator'] == 'aarch64' and not CanTargetAArch64(env):
201 def validator(name, value, env):
210 help = '%s (all|auto|comma-separated list) (any combination from [%s])' % \
213 def validator(name, value, env):
268 # Build helpers ----------------------------------------------------------------
270 def RetrieveEnvironmentVariables(env):
272 if os.getenv(key): env[key] = os.getenv(key)
273 if os.getenv('LD_LIBRARY_PATH'): env['LIBPATH'] = os.getenv('LD_LIBRARY_PATH')
275 env.Append(CCFLAGS = os.getenv('CCFLAGS').split())
277 env.Append(CXXFLAGS = os.getenv('CXXFLAGS').split())
279 env.Append(LINKFLAGS = os.getenv('LINKFLAGS').split())
281 env['ENV']['TERM'] = os.getenv('TERM')
288 # 32-bit architecture. At the moment, we cannot build VIXL's AArch64 support on
289 # a 32-bit platform.
290 # TODO: Port VIXL to build on a 32-bit platform.
291 def target_handler(env):
293 if Is32BitHost(env):
296 env['target'] = list(set(['a32', 't32']))
298 env['target'] = list(set(['a64', 'a32', 't32']))
301 def target_validator(env):
302 # TODO: Port VIXL64 to work on a 32-bit platform.
303 if Is32BitHost(env) and CanTargetAArch64(env):
304 raise UserError('Building VIXL for AArch64 in 32-bit is not supported. Set '
309 def ProcessTargetOption(env):
310 if env['target'] == []: target_handler(env)
312 if 'a32' in env['target']: env['CCFLAGS'] += ['-DVIXL_INCLUDE_TARGET_A32']
313 if 't32' in env['target']: env['CCFLAGS'] += ['-DVIXL_INCLUDE_TARGET_T32']
314 if 'a64' in env['target']: env['CCFLAGS'] += ['-DVIXL_INCLUDE_TARGET_A64']
316 target_validator(env)
319 def ProcessBuildOptions(env):
323 if var in env and env[var]:
324 env[var] += options['all'][var]
326 env[var] = options['all'][var]
330 ProcessTargetOption(env)
333 env_dict = env.Dictionary()
345 validator(env)
352 env[var] += options[key_val_couple][var]
355 def ConfigureEnvironmentForCompiler(env):
356 if CanTargetA32(env) and CanTargetT32(env):
357 # When building for only one aarch32 isa, fixing the no-return is not worth
359 env.Append(CPPFLAGS = ['-Wmissing-noreturn'])
361 compiler = util.CompilerInformation(env)
364 # -Wimplicit-fallthrough only works when compiling the code base as C++11 or
367 env.Append(CPPFLAGS = ['-Wimplicit-fallthrough', '-Wshorten-64-to-32'])
369 # The '-Wunreachable-code' flag breaks builds for clang 3.4.
370 if compiler != 'clang-3.4':
371 env.Append(CPPFLAGS = ['-Wunreachable-code'])
373 if env['ubsan'] == 'on':
374 env.Append(LINKFLAGS = ['-fuse-ld=lld'])
380 if env['mode'] == 'release':
381 if compiler == 'gcc-4.8':
382 env.Append(CPPFLAGS = ['-Wno-maybe-uninitialized'])
387 if env['negative_testing'] == 'on' and env['mode'] == 'debug' \
388 and compiler >= 'gcc-6':
389 env.Append(CPPFLAGS = ['-Wno-terminate'])
392 if 'std' in env and env['std'] == 'c++98':
393 env.Append(CPPFLAGS = ['-Wno-c++11-compat'])
396 if 'std' not in env or env['std'] == 'c++98':
397 env.Append(CPPFLAGS = ['-Wno-long-long'])
398 env.Append(CPPFLAGS = ['-Wno-variadic-macros'])
400 if 'std' in env and env['std'] in ['c++11', 'c++14']:
401 if compiler >= 'gcc-5':
402 env.Append(CPPFLAGS = ['-Wsuggest-override'])
403 elif compiler >= 'clang-3.6':
404 env.Append(CPPFLAGS = ['-Winconsistent-missing-override'])
407 def ConfigureEnvironment(env):
408 RetrieveEnvironmentVariables(env)
409 env['host_arch'] = util.GetHostArch(env)
410 ProcessBuildOptions(env)
411 if 'std' in env:
412 env.Append(CPPFLAGS = ['-std=' + env['std']])
413 std_path = env['std']
414 ConfigureEnvironmentForCompiler(env)
417 def TargetBuildDir(env):
418 # Build-time option values are embedded in the build path to avoid requiring a
422 option_value = ''.join(env[option]) if option in env else ''
433 def VIXLLibraryTarget(env):
434 build_dir = TargetBuildDir(env)
436 # Use `-r` to avoid failure when `latest` exists and is a directory.
437 subprocess.check_call(["rm", "-rf", config.dir_build_latest])
439 subprocess.check_call(["ln", "-s", build_dir, config.dir_build_latest])
443 if CanTargetAArch32(env):
446 if CanTargetAArch64(env):
449 return env.Library(join(build_dir, 'vixl'), sources)
453 # Build ------------------------------------------------------------------------
456 env = Environment(variables = vars,
467 ConfigureEnvironment(env)
468 Help(vars.GenerateHelpText(env))
469 libvixl = VIXLLibraryTarget(env)
471 env.Alias('libvixl', libvixl)
476 test_build_dir = PrepareVariantDir('test', TargetBuildDir(env))
477 test_objects = [env.Object(Glob(join(test_build_dir, '*.cc')))]
480 if CanTargetAArch32(env):
483 aarch32_examples_build_dir = PrepareVariantDir('examples/aarch32', TargetBuildDir(env))
486 prog = env.Program(join(aarch32_examples_build_dir, example),
490 env.Alias('aarch32_examples', aarch32_example_targets)
495 aarch32_benchmarks_build_dir = PrepareVariantDir('benchmarks/aarch32', TargetBuildDir(env))
498 prog = env.Program(join(aarch32_benchmarks_build_dir, bench),
502 env.Alias('aarch32_benchmarks', aarch32_benchmark_targets)
506 test_aarch32_build_dir = PrepareVariantDir(join('test', 'aarch32'), TargetBuildDir(env))
507 test_objects.append(env.Object(
509 CPPPATH = env['CPPPATH'] + [config.dir_tests]))
512 if CanTargetAArch64(env):
515 aarch64_benchmarks_build_dir = PrepareVariantDir('benchmarks/aarch64', TargetBuildDir(env))
518 prog = env.Program(join(aarch64_benchmarks_build_dir, bench),
522 env.Alias('aarch64_benchmarks', aarch64_benchmark_targets)
527 aarch64_examples_build_dir = PrepareVariantDir('examples/aarch64', TargetBuildDir(env))
530 prog = env.Program(join(aarch64_examples_build_dir, example),
534 env.Alias('aarch64_examples', aarch64_example_targets)
538 test_aarch64_build_dir = PrepareVariantDir(join('test', 'aarch64'), TargetBuildDir(env))
539 test_objects.append(env.Object(
541 CPPPATH = env['CPPPATH'] + [config.dir_tests]))
545 test_aarch64_examples_vdir = join(TargetBuildDir(env), 'test', 'aarch64', 'test_examples')
547 test_aarch64_examples_obj = env.Object(
550 CCFLAGS = env['CCFLAGS'] + ['-DTEST_EXAMPLES'],
551 CPPPATH = env['CPPPATH'] + [config.dir_aarch64_examples] + [config.dir_tests])
554 test = env.Program(join(test_build_dir, 'test-runner'), test_objects,
556 env.Alias('tests', test)
560 env.Alias('all', top_level_targets.targets)
569 env.Markdown('README.md'),
570 env.Markdown('doc/changelog.md'),
571 env.Markdown('doc/aarch32/getting-started-aarch32.md'),
572 env.Markdown('doc/aarch32/design/code-generation-aarch32.md'),
573 env.Markdown('doc/aarch32/design/literal-pool-aarch32.md'),
574 env.Markdown('doc/aarch64/supported-instructions-aarch64.md'),
575 env.Markdown('doc/aarch64/getting-started-aarch64.md'),
576 env.Markdown('doc/aarch64/topics/ycm.md'),
577 env.Markdown('doc/aarch64/topics/extending-the-disassembler.md'),
578 env.Markdown('doc/aarch64/topics/index.md'),
580 env.Alias('doc', doc)