third_party:waf: update to upstream 2.0.4 release
[samba.git] / third_party / waf / waflib / Tools / gdc.py
1 #! /usr/bin/env python
2 # encoding: utf-8
3 # WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
4
5 #!/usr/bin/env python
6 # encoding: utf-8
7 # Carlos Rafael Giani, 2007 (dv)
8
9 from waflib.Tools import ar, d
10 from waflib.Configure import conf
11
12 @conf
13 def find_gdc(conf):
14         """
15         Finds the program gdc and set the variable *D*
16         """
17         conf.find_program('gdc', var='D')
18
19         out = conf.cmd_and_log(conf.env.D + ['--version'])
20         if out.find("gdc") == -1:
21                 conf.fatal("detected compiler is not gdc")
22
23 @conf
24 def common_flags_gdc(conf):
25         """
26         Sets the flags required by *gdc*
27         """
28         v = conf.env
29
30         v.DFLAGS            = []
31
32         v.D_SRC_F           = ['-c']
33         v.D_TGT_F           = '-o%s'
34
35         v.D_LINKER          = v.D
36         v.DLNK_SRC_F        = ''
37         v.DLNK_TGT_F        = '-o%s'
38         v.DINC_ST           = '-I%s'
39
40         v.DSHLIB_MARKER = v.DSTLIB_MARKER = ''
41         v.DSTLIB_ST = v.DSHLIB_ST         = '-l%s'
42         v.DSTLIBPATH_ST = v.DLIBPATH_ST   = '-L%s'
43
44         v.LINKFLAGS_dshlib  = ['-shared']
45
46         v.DHEADER_ext       = '.di'
47         v.DFLAGS_d_with_header = '-fintfc'
48         v.D_HDR_F           = '-fintfc-file=%s'
49
50 def configure(conf):
51         """
52         Configuration for gdc
53         """
54         conf.find_gdc()
55         conf.load('ar')
56         conf.load('d')
57         conf.common_flags_gdc()
58         conf.d_platform_flags()
59