blob: a3a2bb90df8ffefd58774f751f7c1bde1328cc8c [file] [log] [blame]
akmhoquefa8ee9b2014-03-14 09:06:24 -05001#! /usr/bin/env python
2# encoding: utf-8
3# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
4
5import os,sys,re
6from waflib import Utils,Build
7from waflib.Configure import conf
8def get_extensions(lst):
9 ret=[]
10 for x in Utils.to_list(lst):
11 try:
12 if not isinstance(x,str):
13 x=x.name
14 ret.append(x[x.rfind('.')+1:])
15 except Exception:
16 pass
17 return ret
18def sniff_features(**kw):
19 exts=get_extensions(kw['source'])
20 type=kw['_type']
21 feats=[]
22 if'cxx'in exts or'cpp'in exts or'c++'in exts or'cc'in exts or'C'in exts:
23 feats.append('cxx')
24 if'c'in exts or'vala'in exts:
25 feats.append('c')
26 if'd'in exts:
27 feats.append('d')
28 if'java'in exts:
29 feats.append('java')
30 if'java'in exts:
31 return'java'
32 if type in['program','shlib','stlib']:
33 for x in feats:
34 if x in['cxx','d','c']:
35 feats.append(x+type)
36 return feats
37def set_features(kw,_type):
38 kw['_type']=_type
39 kw['features']=Utils.to_list(kw.get('features',[]))+Utils.to_list(sniff_features(**kw))
40@conf
41def program(bld,*k,**kw):
42 set_features(kw,'program')
43 return bld(*k,**kw)
44@conf
45def shlib(bld,*k,**kw):
46 set_features(kw,'shlib')
47 return bld(*k,**kw)
48@conf
49def stlib(bld,*k,**kw):
50 set_features(kw,'stlib')
51 return bld(*k,**kw)
52@conf
53def objects(bld,*k,**kw):
54 set_features(kw,'objects')
55 return bld(*k,**kw)