1# Copyright 2002, 2003, 2005 Vladimir Prus
2# Distributed under the Boost Software License, Version 1.0.
3# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
4
5import os ;
6import gcc ;
7import property ;
8import toolset ;
9
10rule properties-as-path ( properties * )
11{
12    local r ;
13    for local p in $(properties)
14    {
15	    if $(p:G) != <action>
16	    {
17	        r += $(p) ;
18	    }
19    }
20    return [ property.as-path
21        [ property.remove incidental : $(r) ] ] ;
22}
23
24
25toolset.flags yfc-compile KNOWN-PROPERTIES : <toolset> <optimization> ;
26toolset.flags yfc-link KNOWN-PROPERTIES : <toolset> <optimization> ;
27
28
29rule yfc-compile ( target : sources * : property-set * )
30{
31    PROPERTIES on $(target) = [ properties-as-path $(property-set) ] ;
32}
33
34actions yfc-compile
35{
36    echo $(PROPERTIES) > $(<)
37    echo $(>) >> $(<)
38}
39
40rule yfc-link ( target : sources * : property-set * )
41{
42    PROPERTIES on $(target) = [ properties-as-path $(property-set) ] ;
43}
44
45actions yfc-link
46{
47    echo $(PROPERTIES) > $(<)
48    echo $(>) >> $(<)
49}
50
51if [ os.name ] = VMS
52{
53    actions yfc-compile
54    {
55        PIPE WRITE SYS$OUTPUT "$(PROPERTIES)" | TYPE SYS$INPUT /OUT=$(<:W)
56        PIPE WRITE SYS$OUTPUT "$(>:J= ",")" | APPEND /NEW SYS$INPUT $(<:W)
57    }
58
59    actions yfc-link
60    {
61        PIPE WRITE SYS$OUTPUT "$(PROPERTIES)" | TYPE SYS$INPUT /OUT=$(<:W)
62        OPEN /APPEND FOUT $(<:W)
63        WRITE FOUT "$(>:J= ",")"
64        CLOSE FOUT
65    }
66}
67
68#IMPORT $(__name__) : yfc-compile yfc-link : : yfc-compile yfc-link ;
69