aboutsummaryrefslogtreecommitdiff
path: root/src
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
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 '')
-rw-r--r--src/builder.cpp66
-rw-r--r--src/builder.h1
-rw-r--r--src/filetarget.cpp12
3 files changed, 78 insertions, 1 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 )
diff --git a/src/builder.h b/src/builder.h
index f27a042..296b9d7 100644
--- a/src/builder.h
+++ b/src/builder.h
@@ -54,6 +54,7 @@ public:
54 void processRequires( std::list<std::string> &lInput ); 54 void processRequires( std::list<std::string> &lInput );
55 void requires( const char *sBase, const char *sReq ); 55 void requires( const char *sBase, const char *sReq );
56 void requiresFromCommand( const char *sBase, const char *sReq ); 56 void requiresFromCommand( const char *sBase, const char *sReq );
57 void genRequiresFor( const char *sName );
57 void requiresRegexp( bool on ) 58 void requiresRegexp( bool on )
58 { 59 {
59 bReqRegexp = on; 60 bReqRegexp = on;
diff --git a/src/filetarget.cpp b/src/filetarget.cpp
index cd95188..ca9a39f 100644
--- a/src/filetarget.cpp
+++ b/src/filetarget.cpp
@@ -81,10 +81,10 @@ void FileTarget::check( Builder &bld )
81 81
82 bld.processRequires( lOutput ); 82 bld.processRequires( lOutput );
83 83
84
85 for( std::list<Perform *>::iterator i = perf.begin(); 84 for( std::list<Perform *>::iterator i = perf.begin();
86 i != perf.end(); i++ ) 85 i != perf.end(); i++ )
87 { 86 {
87 bool bExtraReqs = false;
88 time_t target = getTime( std::string((*i)->getTarget()) ); 88 time_t target = getTime( std::string((*i)->getTarget()) );
89 std::list<std::string> *lReqs = bld.getRequires( (*i)->getTarget() ); 89 std::list<std::string> *lReqs = bld.getRequires( (*i)->getTarget() );
90 if( lReqs == NULL ) 90 if( lReqs == NULL )
@@ -101,6 +101,16 @@ void FileTarget::check( Builder &bld )
101 updateTime( (*i)->getTarget() ); 101 updateTime( (*i)->getTarget() );
102 break; 102 break;
103 } 103 }
104 if( bExtraReqs == false )
105 {
106 std::list<std::string>::iterator k = j;
107 k++;
108 if( k == lReqs->end() )
109 {
110 bExtraReqs = true;
111 bld.genRequiresFor( (*i)->getTarget() );
112 }
113 }
104 } 114 }
105 } 115 }
106 116