File: verbatim.jam

package info (click to toggle)
boost-build 2.0-m11-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,624 kB
  • ctags: 2,387
  • sloc: ansic: 12,978; python: 5,209; xml: 4,782; cpp: 555; yacc: 456; sh: 237; makefile: 71
file content (53 lines) | stat: -rw-r--r-- 2,025 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#  Copyright (C) Vladimir Prus 2003-2004. Permission to copy, use, modify, sell and
#  distribute this software is granted provided this copyright notice appears in
#  all copies. This software is provided "as is" without express or implied
#  warranty, and with no claim as to its suitability for any purpose.

#
#  This file shows some of the primary customization mechanisms in Boost.Build V2
#  and should serve as a basic for your own customization.
#  Each part has a comment describing its purpose, and you can pick the parts
#  which are relevant to your case, remove everything else, and then change names
#  and actions to taste.

#  Declare a new target type. This allows Boost.Build to do something sensible
#  when targets with the .verbatim extension are found in sources.
import type ;
type.register VERBATIM : verbatim ;

#  Declare a dependency scanner for the new target type. The
#  'inline-file.py' script does not handle includes, so this is
#  only for illustraction.
import scanner ;
#  First, define a new class, derived from 'common-scanner',
#  that class has all the interesting logic, and we only need
#  to override the 'pattern' method which return regular
#  expression to use when scanning.
class verbatim-scanner : common-scanner 
{
    rule pattern ( )
    {
        return "//###include[ ]*\"([^\"]*)\"" ;
    }
}

# Register the scanner class. The 'include' is
# the property which specifies the search path
# for includes.
scanner.register verbatim-scanner : include ;
# Assign the scanner class to the target type.
# Now, all .verbatim sources will be scanned.
# To test this, build the project, touch the 
# t2.verbatim file and build again.
type.set-scanner VERBATIM : verbatim-scanner ;

import generators ;
generators.register-standard verbatim.inline-file : VERBATIM : CPP ;

# Note: To use Cygwin Python on Windows change the following line
# to "python inline_file.py $(<) $(>)"
# Also, make sure that "python" in in PATH.
actions inline-file 
{
    "./inline_file.py" $(<) $(>)
}