From 062fcfb96c56ecfb69b8c3162ced65b63e863752 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 2 Aug 2006 06:54:48 +0000 Subject: 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. --- src/builder.cpp | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'src/builder.cpp') 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 ) void Builder::processRequires( std::list &lInput ) { + // These are cheap and handy to have all the time for( regreqlist::iterator i = lRequiresRegexp.begin(); i != lRequiresRegexp.end(); i++ ) { @@ -240,6 +241,8 @@ void Builder::processRequires( std::list &lInput ) } } + // These are only done on request now, they were too expensive + /* for( regreqlist::iterator i = lRequiresRegexpCommand.begin(); i != lRequiresRegexpCommand.end(); i++ ) { @@ -302,6 +305,69 @@ void Builder::processRequires( std::list &lInput ) } } } + */ +} + +void Builder::genRequiresFor( const char *sName ) +{ + for( regreqlist::iterator i = lRequiresRegexpCommand.begin(); + i != lRequiresRegexpCommand.end(); i++ ) + { + RegExp *re = (*i).first; + if( re->execute( sName ) ) + { + varmap *revars = regexVars( re ); + std::string s = varRepl( (*i).second.c_str(), "", revars ); + FILE *fcmd = popen( s.c_str(), "r" ); + std::string rhs; + bool bHeader = true; + for(;;) + { + if( feof( fcmd ) ) + break; + int cc = fgetc( fcmd ); + if( cc == EOF ) + break; + unsigned char c = cc; + if( bHeader ) + { + if( c == ':' ) + bHeader = false; + } + else + { + if( c == ' ' || c == '\t' ) + { + if( rhs != "" ) + { + requiresNormal( + sName, + rhs.c_str() + ); + rhs = ""; + } + } + else + { + if( c == '\\' ) + c = fgetc( fcmd ); + if( c != '\n' ) + rhs += c; + } + } + } + if( rhs != "" ) + { + requiresNormal( + sName, + rhs.c_str() + ); + rhs = ""; + } + pclose( fcmd ); + delete revars; + } + } } std::map *Builder::regexVars( RegExp *re ) -- cgit v1.2.3