-rw-r--r-- | lib/component_factory.cc | 2 | ||||
-rw-r--r-- | lib/file_factory.cc | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/component_factory.cc b/lib/component_factory.cc index b5e95af..d9692de 100644 --- a/lib/component_factory.cc +++ b/lib/component_factory.cc | |||
@@ -63,65 +63,65 @@ namespace sitecing { | |||
63 | string str; | 63 | string str; |
64 | while(!imports.eof()) { | 64 | while(!imports.eof()) { |
65 | imports >> str; | 65 | imports >> str; |
66 | if(!str.empty()) | 66 | if(!str.empty()) |
67 | deps.push_back(root_intermediate+str+".classname"); | 67 | deps.push_back(root_intermediate+str+".classname"); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | ifstream ancestors((root_intermediate+nos+".ancestors").c_str(),ios::in); | 70 | ifstream ancestors((root_intermediate+nos+".ancestors").c_str(),ios::in); |
71 | if(ancestors.good()) { | 71 | if(ancestors.good()) { |
72 | string str; | 72 | string str; |
73 | while(!ancestors.eof()) { | 73 | while(!ancestors.eof()) { |
74 | ancestors >> str; | 74 | ancestors >> str; |
75 | if(!str.empty()) | 75 | if(!str.empty()) |
76 | deps.push_back(root_intermediate+str+".classname"); | 76 | deps.push_back(root_intermediate+str+".classname"); |
77 | } | 77 | } |
78 | } | 78 | } |
79 | // XXX: intermediate_deps should be broken down | 79 | // XXX: intermediate_deps should be broken down |
80 | config_options *co_intermediate_deps = config.lookup_config(nos,config_options::flag_intermediate_deps); | 80 | config_options *co_intermediate_deps = config.lookup_config(nos,config_options::flag_intermediate_deps); |
81 | if(co_intermediate_deps) { | 81 | if(co_intermediate_deps) { |
82 | for(list<string>::const_iterator i=co_intermediate_deps->intermediate_deps.begin();i!=co_intermediate_deps->intermediate_deps.end();++i) | 82 | for(list<string>::const_iterator i=co_intermediate_deps->intermediate_deps.begin();i!=co_intermediate_deps->intermediate_deps.end();++i) |
83 | deps.push_back(*i); | 83 | deps.push_back(*i); |
84 | } | 84 | } |
85 | return; | 85 | return; |
86 | }catch(utility_no_suffix& uns) { } | 86 | }catch(utility_no_suffix& uns) { } |
87 | } | 87 | } |
88 | // compiler targets | 88 | // compiler targets |
89 | for(int cct=0;cct<sizeof(cc_targets)/sizeof(*cc_targets);cct++) { | 89 | for(int cct=0;cct<sizeof(cc_targets)/sizeof(*cc_targets);cct++) { |
90 | try { | 90 | try { |
91 | string nos = strip_suffix(noro,cc_targets[cct]); | 91 | string nos = strip_suffix(noro,cc_targets[cct]); |
92 | deps.push_back(root_intermediate+nos+".cc"); | 92 | deps.push_back(root_intermediate+nos+".cc"); |
93 | config_options *co_cpp_deps = config.lookup_config(noro,config_options::flag_cpp_deps); | 93 | config_options *co_cpp_deps = config.lookup_config(noro,config_options::flag_cpp_deps); |
94 | if( (!co_cpp_deps) || co_cpp_deps->cpp_deps) { | 94 | if( (!co_cpp_deps) || co_cpp_deps->cpp_deps) { |
95 | ifstream df((root_intermediate+noro+".d").c_str(),ios::in); | 95 | ifstream df((root_intermediate+nos+".d").c_str(),ios::in); |
96 | if(df.good()) { | 96 | if(df.good()) { |
97 | string str; | 97 | string str; |
98 | while(!df.eof()) { | 98 | while(!df.eof()) { |
99 | df >> str; | 99 | df >> str; |
100 | if(str.find_first_of("\\:")==string::npos) | 100 | if(str.find_first_of("\\:")==string::npos) |
101 | deps.push_back(combine_path(config.root_source+nos,str)); | 101 | deps.push_back(combine_path(config.root_source+nos,str)); |
102 | } | 102 | } |
103 | } | 103 | } |
104 | } | 104 | } |
105 | // XXX: intermediate_deps should be broken down | 105 | // XXX: intermediate_deps should be broken down |
106 | config_options *co_intermediate_deps = config.lookup_config(nos,config_options::flag_intermediate_deps); | 106 | config_options *co_intermediate_deps = config.lookup_config(nos,config_options::flag_intermediate_deps); |
107 | if(co_intermediate_deps) { | 107 | if(co_intermediate_deps) { |
108 | for(list<string>::const_iterator i=co_intermediate_deps->intermediate_deps.begin();i!=co_intermediate_deps->intermediate_deps.end();++i) | 108 | for(list<string>::const_iterator i=co_intermediate_deps->intermediate_deps.begin();i!=co_intermediate_deps->intermediate_deps.end();++i) |
109 | deps.push_back(*i); | 109 | deps.push_back(*i); |
110 | } | 110 | } |
111 | }catch(utility_no_suffix& uns) { } | 111 | }catch(utility_no_suffix& uns) { } |
112 | } | 112 | } |
113 | }catch(utility_no_prefix& unp) { } | 113 | }catch(utility_no_prefix& unp) { } |
114 | } | 114 | } |
115 | 115 | ||
116 | bool component_factory::is_uptodate(const string& dst,file_list_t *deps) { | 116 | bool component_factory::is_uptodate(const string& dst,file_list_t *deps) { |
117 | string dp = normalize_path(dst,strip_trailing_slash); | 117 | string dp = normalize_path(dst,strip_trailing_slash); |
118 | try { | 118 | try { |
119 | string noro = strip_prefix(dp,root_intermediate); | 119 | string noro = strip_prefix(dp,root_intermediate); |
120 | for(int ppt=0;(ppt+1)<sizeof(pp_targets)/sizeof(*pp_targets);ppt++) { | 120 | for(int ppt=0;(ppt+1)<sizeof(pp_targets)/sizeof(*pp_targets);ppt++) { |
121 | try { | 121 | try { |
122 | string nos = strip_suffix(noro,pp_targets[ppt]); | 122 | string nos = strip_suffix(noro,pp_targets[ppt]); |
123 | return file_factory::is_uptodate(root_intermediate+nos+".pp_stamp",deps); | 123 | return file_factory::is_uptodate(root_intermediate+nos+".pp_stamp",deps); |
124 | }catch(utility_no_suffix& uns) { } | 124 | }catch(utility_no_suffix& uns) { } |
125 | } | 125 | } |
126 | bool rv = file_factory::is_uptodate(dst,deps); | 126 | bool rv = file_factory::is_uptodate(dst,deps); |
127 | return rv; | 127 | return rv; |
diff --git a/lib/file_factory.cc b/lib/file_factory.cc index 7ca7b86..c22fac2 100644 --- a/lib/file_factory.cc +++ b/lib/file_factory.cc | |||
@@ -1,53 +1,53 @@ | |||
1 | #ifdef USE_PCH | 1 | #ifdef USE_PCH |
2 | #include "pch.h" | 2 | #include "pch.h" |
3 | #else | 3 | #else |
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | #include <sys/stat.h> | 5 | #include <sys/stat.h> |
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | #include <konforka/exception.h> | 7 | #include <konforka/exception.h> |
8 | using namespace std; | 8 | using namespace std; |
9 | #include "sitecing/file_factory.h" | 9 | #include "sitecing/file_factory.h" |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | namespace sitecing { | 12 | namespace sitecing { |
13 | 13 | ||
14 | bool file_factory::is_uptodate(const string& dst,file_list_t* deps) { | 14 | bool file_factory::is_uptodate(const string& dst,file_list_t* deps) { |
15 | file_list_t deplist; | 15 | file_list_t deplist; |
16 | file_list_t *fl = deps?deps:&deplist; | 16 | file_list_t *fl = deps?deps:&deplist; |
17 | get_dependencies(dst,*fl); | 17 | get_dependencies(dst,*fl); |
18 | struct stat stdst; | 18 | struct stat stdst; |
19 | if(stat(dst.c_str(),&stdst)) | 19 | if(stat(dst.c_str(),&stdst)) |
20 | return false; | 20 | return false; |
21 | for(file_list_t::const_iterator i=fl->begin();i!=fl->end();i++) { | 21 | for(file_list_t::const_iterator i=fl->begin();i!=fl->end();++i) { |
22 | struct stat stdep; | 22 | struct stat stdep; |
23 | if(stat(i->c_str(),&stdep)) | 23 | if(stat(i->c_str(),&stdep)) |
24 | return false; | 24 | return false; |
25 | if(stdst.st_mtime<stdep.st_mtime) | 25 | if(stdst.st_mtime<stdep.st_mtime) |
26 | return false; | 26 | return false; |
27 | if(!is_uptodate(*i)) | 27 | if(!is_uptodate(*i)) |
28 | return false; | 28 | return false; |
29 | } | 29 | } |
30 | return true; | 30 | return true; |
31 | } | 31 | } |
32 | 32 | ||
33 | void file_factory::make(const string& dst) { | 33 | void file_factory::make(const string& dst) { |
34 | try { | 34 | try { |
35 | depth++; | 35 | depth++; |
36 | if(depth>25) | 36 | if(depth>25) |
37 | throw konforka::exception(CODEPOINT,"recursed too deeply."); | 37 | throw konforka::exception(CODEPOINT,"recursed too deeply."); |
38 | file_list_t deps; | 38 | file_list_t deps; |
39 | if(!is_uptodate(dst,&deps)) { | 39 | if(!is_uptodate(dst,&deps)) { |
40 | for(file_list_t::const_iterator i=deps.begin();i!=deps.end();i++) | 40 | for(file_list_t::const_iterator i=deps.begin();i!=deps.end();i++) |
41 | make(*i); | 41 | make(*i); |
42 | if(!is_uptodate(dst,&deps)) | 42 | if(!is_uptodate(dst,&deps)) |
43 | build(dst); | 43 | build(dst); |
44 | } | 44 | } |
45 | depth--; | 45 | depth--; |
46 | }catch(konforka::exception& ke) { | 46 | }catch(konforka::exception& ke) { |
47 | depth--; | 47 | depth--; |
48 | ke.see(CODEPOINT); | 48 | ke.see(CODEPOINT); |
49 | throw; | 49 | throw; |
50 | }catch(...) { | 50 | }catch(...) { |
51 | depth--; | 51 | depth--; |
52 | throw; | 52 | throw; |
53 | } | 53 | } |