summaryrefslogtreecommitdiffabout
path: root/lib/file_factory.cc
authorMichael Krelin <hacker@klever.net>2005-03-30 15:50:28 (UTC)
committer Michael Krelin <hacker@klever.net>2005-03-30 15:50:28 (UTC)
commit3ddbfeafde93d1aab16a710498d86eef4e787406 (patch) (side-by-side diff)
treed53ef21cf3b2bddfeb957c98344d0be8759ed555 /lib/file_factory.cc
parent642dc685bd0a3f1526e22827a4539aa0e06aeff7 (diff)
downloadsitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.zip
sitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.tar.gz
sitecing-3ddbfeafde93d1aab16a710498d86eef4e787406.tar.bz2
1. preprocessor doesn't touch unchanged files anymore
2. doublechedk on whether file is up to date when making 3. changed the way preprocessor targets depend on the timestamp file 4. a bugfix in strip_suffix/strip_prefix
Diffstat (limited to 'lib/file_factory.cc') (more/less context) (show whitespace changes)
-rw-r--r--lib/file_factory.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/file_factory.cc b/lib/file_factory.cc
index c6b5748..7ca7b86 100644
--- a/lib/file_factory.cc
+++ b/lib/file_factory.cc
@@ -1,55 +1,56 @@
#ifdef USE_PCH
#include "pch.h"
#else
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <konforka/exception.h>
using namespace std;
#include "sitecing/file_factory.h"
#endif
namespace sitecing {
bool file_factory::is_uptodate(const string& dst,file_list_t* deps) {
file_list_t deplist;
file_list_t *fl = deps?deps:&deplist;
get_dependencies(dst,*fl);
struct stat stdst;
if(stat(dst.c_str(),&stdst))
return false;
for(file_list_t::const_iterator i=fl->begin();i!=fl->end();i++) {
struct stat stdep;
if(stat(i->c_str(),&stdep))
return false;
if(stdst.st_mtime<stdep.st_mtime)
return false;
if(!is_uptodate(*i))
return false;
}
return true;
}
void file_factory::make(const string& dst) {
try {
depth++;
if(depth>25)
throw konforka::exception(CODEPOINT,"recursed too deeply.");
file_list_t deps;
if(!is_uptodate(dst,&deps)) {
for(file_list_t::const_iterator i=deps.begin();i!=deps.end();i++)
make(*i);
+ if(!is_uptodate(dst,&deps))
build(dst);
}
depth--;
}catch(konforka::exception& ke) {
depth--;
ke.see(CODEPOINT);
throw;
}catch(...) {
depth--;
throw;
}
}
}