buildtools/wafsamba: use top for waf 2.0
[samba.git] / buildtools / wafsamba / generic_cc.py
1
2 # compiler definition for a generic C compiler
3 # based on suncc.py from waf
4
5 import os, optparse
6 from waflib import Utils, Options, Configure
7 from waflib.Tools import ccroot, ar
8 from waflib.Configure import conftest
9
10 from waflib.Tools.compiler_c import c_compiler
11
12 c_compiler['default'] = ['gcc', 'generic_cc']
13 c_compiler['hpux'] = ['gcc', 'generic_cc']
14
15 @conftest
16 def find_generic_cc(conf):
17     v = conf.env
18     cc = None
19     if v['CC']: cc = v['CC']
20     elif 'CC' in conf.environ: cc = conf.environ['CC']
21     if not cc: cc = conf.find_program('cc', var='CC')
22     if not cc: conf.fatal('generic_cc was not found')
23     cc = conf.cmd_to_list(cc)
24     v['CC']  = cc
25     v['CC_NAME'] = 'generic'
26
27 @conftest
28 def generic_cc_common_flags(conf):
29     v = conf.env
30
31     v['CC_SRC_F']            = ''
32     v['CC_TGT_F']            = ['-c', '-o', '']
33     v['CPPPATH_ST']          = '-I%s' # template for adding include paths
34
35     # linker
36     if not v['LINK_CC']: v['LINK_CC'] = v['CC']
37     v['CCLNK_SRC_F']         = ''
38     v['CCLNK_TGT_F']         = ['-o', '']
39
40     v['LIB_ST']              = '-l%s' # template for adding libs
41     v['LIBPATH_ST']          = '-L%s' # template for adding libpaths
42     v['STATICLIB_ST']        = '-l%s'
43     v['STATICLIBPATH_ST']    = '-L%s'
44     v['CCDEFINES_ST']        = '-D%s'
45
46 #    v['SONAME_ST']           = '-Wl,-h -Wl,%s'
47 #    v['SHLIB_MARKER']        = '-Bdynamic'
48 #    v['STATICLIB_MARKER']    = '-Bstatic'
49
50     # program
51     v['program_PATTERN']     = '%s'
52
53     # shared library
54 #    v['shlib_CCFLAGS']       = ['-Kpic', '-DPIC']
55 #    v['shlib_LINKFLAGS']     = ['-G']
56     v['shlib_PATTERN']       = 'lib%s.so'
57
58     # static lib
59 #    v['staticlib_LINKFLAGS'] = ['-Bstatic']
60 #    v['staticlib_PATTERN']   = 'lib%s.a'
61
62 detect = '''
63 find_generic_cc
64 find_cpp
65 find_ar
66 generic_cc_common_flags
67 cc_load_tools
68 cc_add_flags
69 link_add_flags
70 '''
71