def system_build(system, configuration): inc_path_args = ['-I%s' % i for i in system.include_paths] if len(system.c_files) == 0: raise SystemBuildError("Zero C files in system definition") shared_args = [ '-shared', '-fPIC', '-std=c90' ] if configuration['output_type'] == 'shared-library' else [] execute(['gcc', '-o', system.output_file, '-Wall', '-Werror'] + shared_args + inc_path_args + system.c_files)
def system_build(output_file, modules, include_paths=None): if include_paths is None: include_paths = [] inc_path_args = ['-I%s' % i for i in include_paths] c_files = [] for mod in modules: c_files.extend(mod.c_files()) if not c_files: raise SystemBuildError("Zero C files in system definition") execute(['gcc', '-o', output_file, '-Wall'] + inc_path_args + c_files)
def system_build(system, configuration): inc_path_args = [ '-I%s' % i for i in system.include_paths + [os.path.dirname(os.path.abspath(__file__))] ] if len(system.c_files) == 0: raise SystemBuildError("Zero C files in system definition") shared_args = [ '-shared', '-fPIC' ] if configuration['output_type'] == 'shared-library' else [] execute('gcc -std=c90 -Werror -Wall --all-warnings -Wpedantic -pedantic -o' .split() + [system.output_file] + shared_args + inc_path_args + system.c_files)
def system_build(system, configuration): inc_path_args = ['-I%s' % i for i in system.include_paths] if not system.c_files: raise SystemBuildError("Zero C files in system definition") if configuration['output_type'] == 'shared-library': shared_args = ['-shared'] if sys.platform != 'win32': shared_args.append('-fPIC') else: shared_args = [] execute([ 'gcc', '-o', system.output_file, '-Wall', '-Werror', '-std=c90', '-D_DEFAULT_SOURCE', '-D_POSIX_C_SOURCE' ] + shared_args + inc_path_args + system.c_files)
def system_build(system, configuration): inc_path_args = [ '-I%s' % i for i in system.include_paths + [os.path.dirname(os.path.abspath(__file__))] ] if len(system.c_files) == 0: raise SystemBuildError("Zero C files in system definition") shared_args = [ '-shared', '-fPIC' ] if configuration['output_type'] == 'shared-library' else [] execute( 'gcc -std=c90 -Werror -Wall --all-warnings -Wpedantic -pedantic -Wextra -O -Winit-self -Wswitch-default \ -Wswitch-enum -fstrict-aliasing -fstrict-overflow -Wstrict-overflow=5 -Wundef -Wbad-function-cast -Wcast-qual \ -Wcast-align -Wwrite-strings -Wjump-misses-init -Wlogical-op -Waggregate-return -Wstrict-prototypes \ -Wmissing-prototypes -Wmissing-declarations -Wpacked -Wredundant-decls -o'. split() + [system.output_file] + shared_args + inc_path_args + system.c_files)
def post_prepare(self, system, config): # Now find all the BITBAND variables in all the c_files. def callback(macro_name, expanded_args): bitband_macros = ('BITBAND_VAR', 'BITBAND_VAR_ARRAY', 'VOLATILE_BITBAND_VAR', 'VOLATILE_BITBAND_VAR_ARRAY') if macro_name in bitband_macros and \ len(expanded_args[1]) == 1 and \ expanded_args[1][0].type == 'CPP_ID': config['bit_aliases'].append(expanded_args[1][0].value) pre_processor = ply.cpp.Preprocessor(include_paths=system.include_paths, macro_callback=callback) for c_file in system.c_files: with open(c_file) as file_obj: try: pre_processor.parse(file_obj.read(), c_file) except ply.cpp.CppError as exc: raise SystemBuildError(str(exc)) super().post_prepare(system, config)