10 import TaskGen
, Task
, Utils
11 from TaskGen
import taskgen
, before
, extension
13 nasm_str
= '${NASM} ${NASM_FLAGS} ${NASM_INCLUDES} ${SRC} -o ${TGT}'
15 EXT_NASM
= ['.s', '.S', '.asm', '.ASM', '.spp', '.SPP']
18 def apply_nasm_vars(self
):
21 if hasattr(self
, 'nasm_flags'):
22 for flag
in self
.to_list(self
.nasm_flags
):
23 self
.env
.append_value('NASM_FLAGS', flag
)
25 # includes - well, if we suppose it works with c processing
26 if hasattr(self
, 'includes'):
27 for inc
in self
.to_list(self
.includes
):
28 node
= self
.path
.find_dir(inc
)
30 raise Utils
.WafError('cannot find the dir' + inc
)
31 self
.env
.append_value('NASM_INCLUDES', '-I%s' % node
.srcpath(self
.env
))
32 self
.env
.append_value('NASM_INCLUDES', '-I%s' % node
.bldpath(self
.env
))
35 def nasm_file(self
, node
):
36 try: obj_ext
= self
.obj_ext
37 except AttributeError: obj_ext
= '_%d.o' % self
.idx
39 task
= self
.create_task('nasm', node
, node
.change_ext(obj_ext
))
40 self
.compiled_tasks
.append(task
)
42 self
.meths
.append('apply_nasm_vars')
44 # create our action here
45 Task
.simple_task_type('nasm', nasm_str
, color
='BLUE', ext_out
='.o', shell
=False)
48 nasm
= conf
.find_program(['nasm', 'yasm'], var
='NASM', mandatory
=True)