2 # compiler definition for a generic C compiler
3 # based on suncc.py from waf
6 from waflib import Errors
7 from waflib.Tools import ccroot, ar
8 from waflib.Configure import conf
11 # Let waflib provide useful defaults, but
12 # provide generic_cc as last resort fallback on
15 from waflib.Tools.compiler_c import c_compiler
16 for key in c_compiler.keys():
17 c_compiler[key].append('generic_cc')
20 def find_generic_cc(conf):
25 elif 'CC' in conf.environ:
26 cc = conf.environ['CC']
28 cc = conf.find_program('cc', var='CC')
30 conf.fatal('generic_cc was not found')
33 conf.cmd_and_log(cc + ['--version'])
34 except Errors.WafError:
35 conf.fatal('%r --version could not be executed' % cc)
38 v.CC_NAME = 'generic_cc'
41 def generic_cc_common_flags(conf):
45 v.CC_TGT_F = ['-c', '-o']
53 v.CCLNK_TGT_F = ['-o']
55 v.LIB_ST = '-l%s' # template for adding libs
56 v.LIBPATH_ST = '-L%s' # template for adding libpaths
58 v.STLIBPATH_ST = '-L%s'
60 v.cprogram_PATTERN = '%s'
61 v.cshlib_PATTERN = 'lib%s.so'
62 v.cstlib_PATTERN = 'lib%s.a'
65 conf.find_generic_cc()
67 conf.generic_cc_common_flags()