edabc7e44cad963a0f6e7fbfc04f9fbaea1bfb5f
[samba.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 def HEIMDAL_AUTOPROTO(bld, header, source, options=None, group='prototypes'):
7     '''rule for heimdal prototype generation'''
8     bld.SET_BUILD_GROUP(group)
9     if options is None:
10         options='-q -P comment -o'
11     SET_TARGET_TYPE(bld, header, 'PROTOTYPE')
12     t = bld(rule='${PERL} ${HEIMDAL}/cf/make-proto.pl ${OPTIONS} ${TGT[0].abspath(env)} ${SRC}',
13             source=source,
14             target=header,
15             on_results=True,
16             ext_out='.c',
17             before='cc')
18     t.env.HEIMDAL = os.path.join(bld.srcnode.abspath(), 'source4/heimdal')
19     t.env.OPTIONS = options
20 Build.BuildContext.HEIMDAL_AUTOPROTO = HEIMDAL_AUTOPROTO
21
22
23 def HEIMDAL_AUTOPROTO_PRIVATE(bld, header, source):
24     '''rule for private heimdal prototype generation'''
25     bld.HEIMDAL_AUTOPROTO(header, source, options='-q -P comment -p')
26 Build.BuildContext.HEIMDAL_AUTOPROTO_PRIVATE = HEIMDAL_AUTOPROTO_PRIVATE
27
28
29 def SAMBA_AUTOPROTO(bld, header, source):
30     '''rule for samba prototype generation'''
31     bld.SET_BUILD_GROUP('prototypes')
32     relpath = os_path_relpath(bld.curdir, bld.srcnode.abspath())
33     name = os.path.join(relpath, header)
34     SET_TARGET_TYPE(bld, name, 'PROTOTYPE')
35     t = bld(
36         name = name,
37         source = source,
38         target = header,
39         on_results=True,
40         ext_out='.c',
41         before ='cc',
42         rule = '${SCRIPT}/mkproto.pl --srcdir=.. --builddir=. --public=/dev/null --private=${TGT} ${SRC}'
43         )
44     t.env.SCRIPT = os.path.join(bld.srcnode.abspath(), 'source4/script')
45 Build.BuildContext.SAMBA_AUTOPROTO = SAMBA_AUTOPROTO
46