diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-09-20 18:56:49 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-09-20 18:56:49 +0000 |
commit | 85539c8c262c0c9e227c87fd1de02c53c163b7d8 (patch) | |
tree | b6f96899ca745c157a6de93ad27013416976fc06 /src/rule.cpp | |
parent | 5a32418a040e967887aa6e01e41abc22932471db (diff) | |
download | build-85539c8c262c0c9e227c87fd1de02c53c163b7d8.tar.gz build-85539c8c262c0c9e227c87fd1de02c53c163b7d8.tar.bz2 build-85539c8c262c0c9e227c87fd1de02c53c163b7d8.tar.xz build-85539c8c262c0c9e227c87fd1de02c53c163b7d8.zip |
Changed the api for variable replacement contexts. There can now be multiple
levels of contextual inheritance, so now sub-targets automatically get their
parent target's context variables, if they need them.
Diffstat (limited to '')
-rw-r--r-- | src/rule.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rule.cpp b/src/rule.cpp index dcf62d4..f1b0317 100644 --- a/src/rule.cpp +++ b/src/rule.cpp | |||
@@ -70,7 +70,9 @@ StringList Rule::execute( Build &bld, StringList &lInput, PerformList &lPerf ) | |||
70 | for( PerformList::iterator k = lPerform.begin(); | 70 | for( PerformList::iterator k = lPerform.begin(); |
71 | k != lPerform.end(); k++ ) | 71 | k != lPerform.end(); k++ ) |
72 | { | 72 | { |
73 | Perform *p = (*k)->duplicate( bld, target, &mTmp ); | 73 | StringList cont; |
74 | cont.push_front( target ); | ||
75 | Perform *p = (*k)->duplicate( bld, &cont, &mTmp ); | ||
74 | p->setTarget( target ); | 76 | p->setTarget( target ); |
75 | p->setRule( sName ); | 77 | p->setRule( sName ); |
76 | //p->setReqFuncs( &lReqFuncs ); | 78 | //p->setReqFuncs( &lReqFuncs ); |
@@ -86,7 +88,9 @@ StringList Rule::execute( Build &bld, StringList &lInput, PerformList &lPerf ) | |||
86 | StringList::iterator j = lProduces.begin(); | 88 | StringList::iterator j = lProduces.begin(); |
87 | { | 89 | { |
88 | VarMap mTmp; | 90 | VarMap mTmp; |
89 | std::string target = bld.replVars( (*j), (*i), NULL ); | 91 | StringList cont; |
92 | cont.push_front( (*i) ); | ||
93 | std::string target = bld.replVars( (*j), &cont, NULL ); | ||
90 | mTmp["target"] = target; | 94 | mTmp["target"] = target; |
91 | lNewOut.push_back( target ); | 95 | lNewOut.push_back( target ); |
92 | mTmp["match"] = (*i); | 96 | mTmp["match"] = (*i); |
@@ -99,14 +103,17 @@ StringList Rule::execute( Build &bld, StringList &lInput, PerformList &lPerf ) | |||
99 | for( PerformList::iterator k = lPerform.begin(); | 103 | for( PerformList::iterator k = lPerform.begin(); |
100 | k != lPerform.end(); k++ ) | 104 | k != lPerform.end(); k++ ) |
101 | { | 105 | { |
102 | Perform *p = (*k)->duplicate( bld, target, &mTmp ); | 106 | StringList cont2; |
107 | cont2.push_front( (*i) ); | ||
108 | cont2.push_front( target ); | ||
109 | Perform *p = (*k)->duplicate( bld, &cont2, &mTmp ); | ||
103 | p->setTarget( target ); | 110 | p->setTarget( target ); |
104 | p->setRule( sName ); | 111 | p->setRule( sName ); |
105 | for( FunctionList::iterator f = lReqFuncs.begin(); | 112 | for( FunctionList::iterator f = lReqFuncs.begin(); |
106 | f != lReqFuncs.end(); f++ ) | 113 | f != lReqFuncs.end(); f++ ) |
107 | { | 114 | { |
108 | p->getReqFuncs().push_back( | 115 | p->getReqFuncs().push_back( |
109 | (*f)->duplicate( bld, target, &mTmp ) | 116 | (*f)->duplicate( bld, &cont2, &mTmp ) |
110 | ); | 117 | ); |
111 | } | 118 | } |
112 | lPerf.push_back( p ); | 119 | lPerf.push_back( p ); |