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
5from waflib import Utils,Task,Errors
6from waflib.TaskGen import taskgen_method,feature,extension
7from waflib.Tools import d_scan,d_config
8from waflib.Tools.ccroot import link_task,stlink_task
9class d(Task.Task):
10	color='GREEN'
11	run_str='${D} ${DFLAGS} ${DINC_ST:INCPATHS} ${D_SRC_F:SRC} ${D_TGT_F:TGT}'
12	scan=d_scan.scan
13class d_with_header(d):
14	run_str='${D} ${DFLAGS} ${DINC_ST:INCPATHS} ${D_HDR_F:tgt.outputs[1].bldpath()} ${D_SRC_F:SRC} ${D_TGT_F:tgt.outputs[0].bldpath()}'
15class d_header(Task.Task):
16	color='BLUE'
17	run_str='${D} ${D_HEADER} ${SRC}'
18class dprogram(link_task):
19	run_str='${D_LINKER} ${LINKFLAGS} ${DLNK_SRC_F}${SRC} ${DLNK_TGT_F:TGT} ${RPATH_ST:RPATH} ${DSTLIB_MARKER} ${DSTLIBPATH_ST:STLIBPATH} ${DSTLIB_ST:STLIB} ${DSHLIB_MARKER} ${DLIBPATH_ST:LIBPATH} ${DSHLIB_ST:LIB}'
20	inst_to='${BINDIR}'
21class dshlib(dprogram):
22	inst_to='${LIBDIR}'
23class dstlib(stlink_task):
24	pass
25@extension('.d','.di','.D')
26def d_hook(self,node):
27	ext=Utils.destos_to_binfmt(self.env.DEST_OS)=='pe'and'obj'or'o'
28	out='%s.%d.%s'%(node.name,self.idx,ext)
29	def create_compiled_task(self,name,node):
30		task=self.create_task(name,node,node.parent.find_or_declare(out))
31		try:
32			self.compiled_tasks.append(task)
33		except AttributeError:
34			self.compiled_tasks=[task]
35		return task
36	if getattr(self,'generate_headers',None):
37		tsk=create_compiled_task(self,'d_with_header',node)
38		tsk.outputs.append(node.change_ext(self.env.DHEADER_ext))
39	else:
40		tsk=create_compiled_task(self,'d',node)
41	return tsk
42@taskgen_method
43def generate_header(self,filename):
44	try:
45		self.header_lst.append([filename,self.install_path])
46	except AttributeError:
47		self.header_lst=[[filename,self.install_path]]
48@feature('d')
49def process_header(self):
50	for i in getattr(self,'header_lst',[]):
51		node=self.path.find_resource(i[0])
52		if not node:
53			raise Errors.WafError('file %r not found on d obj'%i[0])
54		self.create_task('d_header',node,node.change_ext('.di'))
55