summaryrefslogtreecommitdiff
path: root/buildtools/wafadmin/Tools/nasm.py
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-01-04 00:31:27 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-01-04 22:34:20 +0100
commit4f4bce5301ffd8c12aed1b108affa1a75feefb67 (patch)
tree1607accd70a2c37a9b996f7b42ec926b014cfe5b /buildtools/wafadmin/Tools/nasm.py
parent1b45f2aed86dda9fda6e6bcf1c9c7cbdc471c18d (diff)
downloadsamba-4f4bce5301ffd8c12aed1b108affa1a75feefb67.tar.gz
samba-4f4bce5301ffd8c12aed1b108affa1a75feefb67.tar.bz2
samba-4f4bce5301ffd8c12aed1b108affa1a75feefb67.zip
Include waf as an extracted source directory, rather than as a one-in-a-file script.
Diffstat (limited to 'buildtools/wafadmin/Tools/nasm.py')
-rw-r--r--buildtools/wafadmin/Tools/nasm.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/buildtools/wafadmin/Tools/nasm.py b/buildtools/wafadmin/Tools/nasm.py
new file mode 100644
index 0000000000..b99c3c7340
--- /dev/null
+++ b/buildtools/wafadmin/Tools/nasm.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# encoding: utf-8
+# Thomas Nagy, 2008
+
+"""
+Nasm processing
+"""
+
+import os
+import TaskGen, Task, Utils
+from TaskGen import taskgen, before, extension
+
+nasm_str = '${NASM} ${NASM_FLAGS} ${NASM_INCLUDES} ${SRC} -o ${TGT}'
+
+EXT_NASM = ['.s', '.S', '.asm', '.ASM', '.spp', '.SPP']
+
+@before('apply_link')
+def apply_nasm_vars(self):
+
+ # flags
+ if hasattr(self, 'nasm_flags'):
+ for flag in self.to_list(self.nasm_flags):
+ self.env.append_value('NASM_FLAGS', flag)
+
+ # includes - well, if we suppose it works with c processing
+ if hasattr(self, 'includes'):
+ for inc in self.to_list(self.includes):
+ node = self.path.find_dir(inc)
+ if not node:
+ raise Utils.WafError('cannot find the dir' + inc)
+ self.env.append_value('NASM_INCLUDES', '-I%s' % node.srcpath(self.env))
+ self.env.append_value('NASM_INCLUDES', '-I%s' % node.bldpath(self.env))
+
+@extension(EXT_NASM)
+def nasm_file(self, node):
+ try: obj_ext = self.obj_ext
+ except AttributeError: obj_ext = '_%d.o' % self.idx
+
+ task = self.create_task('nasm', node, node.change_ext(obj_ext))
+ self.compiled_tasks.append(task)
+
+ self.meths.append('apply_nasm_vars')
+
+# create our action here
+Task.simple_task_type('nasm', nasm_str, color='BLUE', ext_out='.o', shell=False)
+
+def detect(conf):
+ nasm = conf.find_program(['nasm', 'yasm'], var='NASM', mandatory=True)
+