diff options
-rw-r--r-- | share/autoinclude/general-rules.bld | 1 | ||||
-rw-r--r-- | src/context.cpp | 13 | ||||
-rw-r--r-- | src/functiongetmakedeps.cpp | 5 | ||||
-rw-r--r-- | src/rule.cpp | 5 | ||||
-rw-r--r-- | src/rule.h | 3 | ||||
-rw-r--r-- | src/target.cpp | 1 |
6 files changed, 21 insertions, 7 deletions
diff --git a/share/autoinclude/general-rules.bld b/share/autoinclude/general-rules.bld index 30a4376..95a5e0c 100644 --- a/share/autoinclude/general-rules.bld +++ b/share/autoinclude/general-rules.bld | |||
@@ -79,7 +79,6 @@ rule "cpp" | |||
79 | { | 79 | { |
80 | input "*.cpp"; | 80 | input "*.cpp"; |
81 | output INPUT.cppToObj(); | 81 | output INPUT.cppToObj(); |
82 | // output replace(".cpp", ".o"); | ||
83 | requires getMakeDeps("${CXX} ${CXXFLAGS} -M ${INPUT}"); | 82 | requires getMakeDeps("${CXX} ${CXXFLAGS} -M ${INPUT}"); |
84 | profile "build" | 83 | profile "build" |
85 | { | 84 | { |
diff --git a/src/context.cpp b/src/context.cpp index e9330e5..efe8098 100644 --- a/src/context.cpp +++ b/src/context.cpp | |||
@@ -144,13 +144,20 @@ void Context::pushScope() | |||
144 | 144 | ||
145 | void Context::pushScope( const VarHash &hNewVars ) | 145 | void Context::pushScope( const VarHash &hNewVars ) |
146 | { | 146 | { |
147 | // sio << "Pushing scope, merging contexts." << sio.nl << sio.nl; | ||
147 | VarHash h = hNewVars; | 148 | VarHash h = hNewVars; |
148 | if( !sVars.isEmpty() ) | 149 | if( !sVars.isEmpty() ) |
149 | { | 150 | { |
151 | // sio << "hNewVars = " << h << sio.nl << sio.nl | ||
152 | // << "sVars = " << sVars.peek() << sio.nl; | ||
150 | for( VarHash::iterator i = sVars.peek().begin(); i; i++ ) | 153 | for( VarHash::iterator i = sVars.peek().begin(); i; i++ ) |
151 | { | 154 | { |
155 | // sio << "Checking '" << i.getKey() << "' (" << i.getValue() << ")." << sio.nl; | ||
152 | if( !h.has( i.getKey() ) ) | 156 | if( !h.has( i.getKey() ) ) |
157 | { | ||
158 | // sio << " Context doesn't have '" << i.getKey() << "' adding... '" << i.getValue() << "'." << sio.nl; | ||
153 | h.insert( i.getKey(), i.getValue() ); | 159 | h.insert( i.getKey(), i.getValue() ); |
160 | } | ||
154 | } | 161 | } |
155 | } | 162 | } |
156 | sVars.push( h ); | 163 | sVars.push( h ); |
@@ -158,7 +165,7 @@ void Context::pushScope( const VarHash &hNewVars ) | |||
158 | 165 | ||
159 | VarHash &Context::getScope() | 166 | VarHash &Context::getScope() |
160 | { | 167 | { |
161 | return sVars.first(); | 168 | return sVars.peek(); |
162 | } | 169 | } |
163 | 170 | ||
164 | void Context::popScope() | 171 | void Context::popScope() |
@@ -344,14 +351,14 @@ void Context::buildTargetTree( Runner &r ) | |||
344 | } | 351 | } |
345 | } | 352 | } |
346 | 353 | ||
347 | void Context::buildTargetTree( class Runner &r, class Target * /*pTarget*/, const Bu::FString &sInput, Rule *pMaster, StrList &lNewIns ) | 354 | void Context::buildTargetTree( class Runner &r, class Target *pTarget, const Bu::FString &sInput, Rule *pMaster, StrList &lNewIns ) |
348 | { | 355 | { |
349 | Target *pNewTarget = NULL; | 356 | Target *pNewTarget = NULL; |
350 | for( RuleHash::iterator i = hRule.begin(); i; i++ ) | 357 | for( RuleHash::iterator i = hRule.begin(); i; i++ ) |
351 | { | 358 | { |
352 | if( (*i)->hasOutputs() && (*i)->ruleMatches( r, sInput ) ) | 359 | if( (*i)->hasOutputs() && (*i)->ruleMatches( r, sInput ) ) |
353 | { | 360 | { |
354 | pNewTarget = (*i)->createTarget( r, sInput ); | 361 | pNewTarget = (*i)->createTarget( r, sInput, pTarget ); |
355 | 362 | ||
356 | Bu::Hash<ptrdiff_t, bool> hDone; | 363 | Bu::Hash<ptrdiff_t, bool> hDone; |
357 | for( StrList::const_iterator oi = | 364 | for( StrList::const_iterator oi = |
diff --git a/src/functiongetmakedeps.cpp b/src/functiongetmakedeps.cpp index 1aded15..008a509 100644 --- a/src/functiongetmakedeps.cpp +++ b/src/functiongetmakedeps.cpp | |||
@@ -1,4 +1,6 @@ | |||
1 | #include "functiongetmakedeps.h" | 1 | #include "functiongetmakedeps.h" |
2 | #include "context.h" | ||
3 | #include "view.h" | ||
2 | 4 | ||
3 | #include <bu/process.h> | 5 | #include <bu/process.h> |
4 | #include <bu/sio.h> | 6 | #include <bu/sio.h> |
@@ -19,6 +21,7 @@ Bu::FString FunctionGetMakeDeps::getName() const | |||
19 | 21 | ||
20 | Variable FunctionGetMakeDeps::call( Variable &/*input*/, VarList lParams ) | 22 | Variable FunctionGetMakeDeps::call( Variable &/*input*/, VarList lParams ) |
21 | { | 23 | { |
24 | pContext->getView()->cmdStarted( lParams.first().getString().getStr() ); | ||
22 | Process p( Process::StdOut, "/bin/bash", "/bin/bash", "-c", | 25 | Process p( Process::StdOut, "/bin/bash", "/bin/bash", "-c", |
23 | lParams.first().getString().getStr(), NULL ); | 26 | lParams.first().getString().getStr(), NULL ); |
24 | 27 | ||
@@ -31,6 +34,8 @@ Variable FunctionGetMakeDeps::call( Variable &/*input*/, VarList lParams ) | |||
31 | sBuf.append( buf, iRead ); | 34 | sBuf.append( buf, iRead ); |
32 | } | 35 | } |
33 | 36 | ||
37 | pContext->getView()->cmdFinished( "", "", p.childExitStatus() ); | ||
38 | |||
34 | Variable vRet( Variable::typeList ); | 39 | Variable vRet( Variable::typeList ); |
35 | 40 | ||
36 | Bu::FString::iterator i, j; | 41 | Bu::FString::iterator i, j; |
diff --git a/src/rule.cpp b/src/rule.cpp index 4c42346..7578707 100644 --- a/src/rule.cpp +++ b/src/rule.cpp | |||
@@ -73,9 +73,10 @@ void Rule::prepTarget( class Target *pTarget ) | |||
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | Target *Rule::createTarget( class Runner &r, const Bu::FString &sInput ) | 76 | Target *Rule::createTarget( class Runner &r, const Bu::FString &sInput, |
77 | Target *pParent ) | ||
77 | { | 78 | { |
78 | r.getContext().pushScope(); | 79 | r.getContext().pushScope( pParent->getVars() ); |
79 | r.getContext().addVariable("INPUT", sInput ); | 80 | r.getContext().addVariable("INPUT", sInput ); |
80 | Target *pTrg = new Target( false ); | 81 | Target *pTrg = new Target( false ); |
81 | for( AstBranchList::iterator i = lOutput.begin(); i; i++ ) | 82 | for( AstBranchList::iterator i = lOutput.begin(); i; i++ ) |
@@ -22,7 +22,8 @@ public: | |||
22 | void addProfile( const AstBranch *pProfile ); | 22 | void addProfile( const AstBranch *pProfile ); |
23 | 23 | ||
24 | void prepTarget( class Target *pTarget ); | 24 | void prepTarget( class Target *pTarget ); |
25 | class Target *createTarget( class Runner &r, const Bu::FString &sInput ); | 25 | class Target *createTarget( class Runner &r, const Bu::FString &sInput, |
26 | class Target *pParent ); | ||
26 | bool ruleMatches( class Runner &r, const Bu::FString &sInput ); | 27 | bool ruleMatches( class Runner &r, const Bu::FString &sInput ); |
27 | 28 | ||
28 | void addTag( const Bu::FString &sTag ); | 29 | void addTag( const Bu::FString &sTag ); |
diff --git a/src/target.cpp b/src/target.cpp index f3e54b7..8eec07a 100644 --- a/src/target.cpp +++ b/src/target.cpp | |||
@@ -191,6 +191,7 @@ const Profile *Target::getProfile( const Bu::FString &sName ) const | |||
191 | 191 | ||
192 | void Target::setVars( const VarHash &hNewVars ) | 192 | void Target::setVars( const VarHash &hNewVars ) |
193 | { | 193 | { |
194 | |||
194 | hVars = hNewVars; | 195 | hVars = hNewVars; |
195 | } | 196 | } |
196 | 197 | ||