aboutsummaryrefslogtreecommitdiff
path: root/src/builder.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-08-02 06:54:48 +0000
committerMike Buland <eichlan@xagasoft.com>2006-08-02 06:54:48 +0000
commit062fcfb96c56ecfb69b8c3162ced65b63e863752 (patch)
tree59fbd75fe3ff72776556be8f7e9782726396fc06 /src/builder.cpp
parent53526ddd639aaed8ce90486b02ba621e02f6b505 (diff)
downloadbuild-062fcfb96c56ecfb69b8c3162ced65b63e863752.tar.gz
build-062fcfb96c56ecfb69b8c3162ced65b63e863752.tar.bz2
build-062fcfb96c56ecfb69b8c3162ced65b63e863752.tar.xz
build-062fcfb96c56ecfb69b8c3162ced65b63e863752.zip
Build will now only perform your extra code for using programs to generate more
dependancies per target, and only if none of the other target's dependancies required a rebuild.
Diffstat (limited to 'src/builder.cpp')
-rw-r--r--src/builder.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/builder.cpp b/src/builder.cpp
index d448243..c4f2d12 100644
--- a/src/builder.cpp
+++ b/src/builder.cpp
@@ -217,6 +217,7 @@ void Builder::varAddSet( const char *sName, const char *sValue )
217 217
218void Builder::processRequires( std::list<std::string> &lInput ) 218void Builder::processRequires( std::list<std::string> &lInput )
219{ 219{
220 // These are cheap and handy to have all the time
220 for( regreqlist::iterator i = lRequiresRegexp.begin(); 221 for( regreqlist::iterator i = lRequiresRegexp.begin();
221 i != lRequiresRegexp.end(); i++ ) 222 i != lRequiresRegexp.end(); i++ )
222 { 223 {
@@ -240,6 +241,8 @@ void Builder::processRequires( std::list<std::string> &lInput )
240 } 241 }
241 } 242 }
242 243
244 // These are only done on request now, they were too expensive
245 /*
243 for( regreqlist::iterator i = lRequiresRegexpCommand.begin(); 246 for( regreqlist::iterator i = lRequiresRegexpCommand.begin();
244 i != lRequiresRegexpCommand.end(); i++ ) 247 i != lRequiresRegexpCommand.end(); i++ )
245 { 248 {
@@ -302,6 +305,69 @@ void Builder::processRequires( std::list<std::string> &lInput )
302 } 305 }
303 } 306 }
304 } 307 }
308 */
309}
310
311void Builder::genRequiresFor( const char *sName )
312{
313 for( regreqlist::iterator i = lRequiresRegexpCommand.begin();
314 i != lRequiresRegexpCommand.end(); i++ )
315 {
316 RegExp *re = (*i).first;
317 if( re->execute( sName ) )
318 {
319 varmap *revars = regexVars( re );
320 std::string s = varRepl( (*i).second.c_str(), "", revars );
321 FILE *fcmd = popen( s.c_str(), "r" );
322 std::string rhs;
323 bool bHeader = true;
324 for(;;)
325 {
326 if( feof( fcmd ) )
327 break;
328 int cc = fgetc( fcmd );
329 if( cc == EOF )
330 break;
331 unsigned char c = cc;
332 if( bHeader )
333 {
334 if( c == ':' )
335 bHeader = false;
336 }
337 else
338 {
339 if( c == ' ' || c == '\t' )
340 {
341 if( rhs != "" )
342 {
343 requiresNormal(
344 sName,
345 rhs.c_str()
346 );
347 rhs = "";
348 }
349 }
350 else
351 {
352 if( c == '\\' )
353 c = fgetc( fcmd );
354 if( c != '\n' )
355 rhs += c;
356 }
357 }
358 }
359 if( rhs != "" )
360 {
361 requiresNormal(
362 sName,
363 rhs.c_str()
364 );
365 rhs = "";
366 }
367 pclose( fcmd );
368 delete revars;
369 }
370 }
305} 371}
306 372
307std::map<std::string, std::string> *Builder::regexVars( RegExp *re ) 373std::map<std::string, std::string> *Builder::regexVars( RegExp *re )