Include waf as an extracted source directory, rather than as a one-in-a-file script.
[samba.git] / buildtools / wafadmin / Tools / gdc.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Carlos Rafael Giani, 2007 (dv)
4
5 import sys
6 import Utils, ar
7 from Configure import conftest
8
9 @conftest
10 def find_gdc(conf):
11         conf.find_program('gdc', var='D_COMPILER', mandatory=True)
12
13 @conftest
14 def common_flags_gdc(conf):
15         v = conf.env
16
17         # _DFLAGS _DIMPORTFLAGS
18
19         # for mory info about the meaning of this dict see dmd.py
20         v['DFLAGS']            = []
21
22         v['D_SRC_F']           = ''
23         v['D_TGT_F']           = ['-c', '-o', '']
24         v['DPATH_ST']          = '-I%s' # template for adding import paths
25
26         # linker
27         v['D_LINKER']          = v['D_COMPILER']
28         v['DLNK_SRC_F']        = ''
29         v['DLNK_TGT_F']        = ['-o', '']
30
31         v['DLIB_ST']           = '-l%s' # template for adding libs
32         v['DLIBPATH_ST']       = '-L%s' # template for adding libpaths
33
34         # debug levels
35         v['DLINKFLAGS']        = []
36         v['DFLAGS_OPTIMIZED']  = ['-O3']
37         v['DFLAGS_DEBUG']      = ['-O0']
38         v['DFLAGS_ULTRADEBUG'] = ['-O0']
39
40         v['D_shlib_DFLAGS']    = []
41         v['D_shlib_LINKFLAGS'] = ['-shared']
42
43         v['DHEADER_ext']       = '.di'
44         v['D_HDR_F']           = '-fintfc -fintfc-file='
45
46 def detect(conf):
47         conf.find_gdc()
48         conf.check_tool('ar')
49         conf.check_tool('d')
50         conf.common_flags_gdc()
51         conf.d_platform_flags()
52