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