s3: libsmbclient: Add missing talloc stackframe.
[bbaumbach/samba-autobuild/.git] / buildtools / wafadmin / Tools / gas.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Thomas Nagy, 2008 (ita)
4
5 "as and gas"
6
7 import os, sys
8 import Task
9 from TaskGen import extension, taskgen, after, before
10
11 EXT_ASM = ['.s', '.S', '.asm', '.ASM', '.spp', '.SPP']
12
13 as_str = '${AS} ${ASFLAGS} ${_ASINCFLAGS} ${SRC} -o ${TGT}'
14 Task.simple_task_type('asm', as_str, 'PINK', ext_out='.o', shell=False)
15
16 @extension(EXT_ASM)
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
21
22         task = self.create_task('asm', node, node.change_ext(obj_ext))
23         self.compiled_tasks.append(task)
24         self.meths.append('asm_incflags')
25
26 @after('apply_obj_vars_cc')
27 @after('apply_obj_vars_cxx')
28 @before('apply_link')
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])
33
34 def detect(conf):
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
38