buildtools/wafsamba: use top for waf 2.0
[samba.git] / buildtools / wafsamba / samba_autoproto.py
1 # waf build tool for building automatic prototypes from C source
2
3 import os
4 from waflib import Build
5 from samba_utils import SET_TARGET_TYPE, os_path_relpath
6
7 def SAMBA_AUTOPROTO(bld, header, source):
8     '''rule for samba prototype generation'''
9     bld.SET_BUILD_GROUP('prototypes')
10     relpath = os_path_relpath(bld.path.abspath(), bld.srcnode.abspath())
11     name = os.path.join(relpath, header)
12     SET_TARGET_TYPE(bld, name, 'PROTOTYPE')
13     t = bld(
14         name = name,
15         source = source,
16         target = header,
17         update_outputs=True,
18         ext_out='.c',
19         before ='c',
20         rule = '${PERL} "${SCRIPT}/mkproto.pl" --srcdir=.. --builddir=. --public=/dev/null --private="${TGT}" ${SRC}'
21         )
22     t.env.SCRIPT = os.path.join(bld.srcnode.abspath(), 'source4/script')
23 Build.BuildContext.SAMBA_AUTOPROTO = SAMBA_AUTOPROTO
24