build: support variable expansion in source= arguments to build rules
[nivanova/samba-autobuild/.git] / buildtools / wafsamba / samba_autoproto.py
1 # waf build tool for building automatic prototypes from C source
2
3 import Build
4 from samba_utils import *
5
6 # rule for heimdal prototype generation
7 def HEIMDAL_AUTOPROTO(bld, header, source, options=None, group='prototypes'):
8     bld.SET_BUILD_GROUP(group)
9     if options is None:
10         options='-q -P comment -o'
11     t = bld(rule='${PERL} ../heimdal/cf/make-proto.pl ${OPTIONS} ${TGT[0].abspath(env)} ${SRC}',
12             source=source,
13             target=header,
14             on_results=True,
15             ext_out='.c',
16             before='cc')
17     t.env.OPTIONS = options
18 Build.BuildContext.HEIMDAL_AUTOPROTO = HEIMDAL_AUTOPROTO
19
20 # rule for private heimdal prototype generation
21 def HEIMDAL_AUTOPROTO_PRIVATE(bld, header, source):
22     bld.HEIMDAL_AUTOPROTO(header, source, options='-q -P comment -p')
23 Build.BuildContext.HEIMDAL_AUTOPROTO_PRIVATE = HEIMDAL_AUTOPROTO_PRIVATE
24
25 # rule for samba prototype generation
26 def SAMBA_AUTOPROTO(bld, header, source):
27     bld.SET_BUILD_GROUP('prototypes')
28     bld(
29         source = source,
30         target = header,
31         on_results=True,
32         ext_out='.c',
33         before ='cc',
34         rule = '../script/mkproto.pl --srcdir=.. --builddir=. --public=/dev/null --private=${TGT} ${SRC}'
35         )
36 Build.BuildContext.SAMBA_AUTOPROTO = SAMBA_AUTOPROTO
37