nasm.py :  » Build » Waf » waf-1.5.17 » wafadmin » Tools » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Build » Waf 
Waf » waf 1.5.17 » wafadmin » Tools » nasm.py
#!/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)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.