3 # Thomas Nagy, 2008 (ita)
9 from TaskGen
import extension
, taskgen
, after
, before
11 EXT_ASM
= ['.s', '.S', '.asm', '.ASM', '.spp', '.SPP']
13 as_str
= '${AS} ${ASFLAGS} ${_ASINCFLAGS} ${SRC} -o ${TGT}'
14 Task
.simple_task_type('asm', as_str
, 'PINK', ext_out
='.o', shell
=False)
17 def asm_hook(self
, node
):
18 # create the compilation task: cpp or cc
19 try: obj_ext
= self
.obj_ext
20 except AttributeError: obj_ext
= '_%d.o' % self
.idx
22 task
= self
.create_task('asm', node
, node
.change_ext(obj_ext
))
23 self
.compiled_tasks
.append(task
)
24 self
.meths
.append('asm_incflags')
26 @after('apply_obj_vars_cc')
27 @after('apply_obj_vars_cxx')
29 def asm_incflags(self
):
30 self
.env
.append_value('_ASINCFLAGS', self
.env
.ASINCFLAGS
)
31 var
= ('cxx' in self
.features
) and 'CXX' or 'CC'
32 self
.env
.append_value('_ASINCFLAGS', self
.env
['_%sINCFLAGS' % var
])
35 conf
.find_program(['gas', 'as'], var
='AS')
36 if not conf
.env
.AS
: conf
.env
.AS
= conf
.env
.CC
37 #conf.env.ASFLAGS = ['-c'] <- may be necesary for .S files