summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2005-03-31 12:39:41 (UTC)
committer Michael Krelin <hacker@klever.net>2005-03-31 12:39:41 (UTC)
commit9c755a29c43bcf4a3a1bbd55ae7e590fc6ff2e21 (patch) (unidiff)
tree63c9962ece5d759d3a752b3bf338786b8a6d0993
parent5c757590c7561f6d85b3f9011aa0695c4111b379 (diff)
downloadsitecing-9c755a29c43bcf4a3a1bbd55ae7e590fc6ff2e21.zip
sitecing-9c755a29c43bcf4a3a1bbd55ae7e590fc6ff2e21.tar.gz
sitecing-9c755a29c43bcf4a3a1bbd55ae7e590fc6ff2e21.tar.bz2
saving ticks on dependencies processing
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--lib/component_factory.cc96
1 files changed, 43 insertions, 53 deletions
diff --git a/lib/component_factory.cc b/lib/component_factory.cc
index 1253111..a5ced6b 100644
--- a/lib/component_factory.cc
+++ b/lib/component_factory.cc
@@ -38,4 +38,3 @@ namespace sitecing {
38 return; 38 return;
39 }catch(utility_no_affix& una) { 39 }catch(utility_no_affix& una) { }
40 }
41 // .so binaries 40 // .so binaries
@@ -53,11 +52,11 @@ namespace sitecing {
53 throw konforka::exception(CODEPOINT,"component is outside of component root"); 52 throw konforka::exception(CODEPOINT,"component is outside of component root");
54 }catch(utility_no_suffix& uns) { 53 }catch(utility_no_suffix& uns) { }
55 } 54 try {
56 // preprocessor targets 55 // preprocessor targets
56 string noro = strip_prefix(dp,root_intermediate);
57 for(int ppt=0;ppt<sizeof(pp_targets)/sizeof(*pp_targets);ppt++) { 57 for(int ppt=0;ppt<sizeof(pp_targets)/sizeof(*pp_targets);ppt++) {
58 try { 58 try {
59 string nos = strip_suffix(dp,pp_targets[ppt]); 59 string nos = strip_suffix(noro,pp_targets[ppt]);
60 string noro = strip_prefix(nos,root_intermediate); 60 deps.push_back(root_source+nos); // depends on the source
61 deps.push_back(root_source+noro); 61 ifstream imports((root_intermediate+nos+".imports").c_str(),ios::in);
62 ifstream imports((root_intermediate+noro+".imports").c_str(),ios::in);
63 if(imports.good()) { 62 if(imports.good()) {
@@ -70,3 +69,3 @@ namespace sitecing {
70 } 69 }
71 ifstream ancestors((root_intermediate+noro+".ancestors").c_str(),ios::in); 70 ifstream ancestors((root_intermediate+nos+".ancestors").c_str(),ios::in);
72 if(ancestors.good()) { 71 if(ancestors.good()) {
@@ -79,3 +78,3 @@ namespace sitecing {
79 } 78 }
80 config_options *co_intermediate_deps = config.lookup_config(noro,config_options::flag_intermediate_deps); 79 config_options *co_intermediate_deps = config.lookup_config(nos,config_options::flag_intermediate_deps);
81 if(co_intermediate_deps) { 80 if(co_intermediate_deps) {
@@ -85,5 +84,3 @@ namespace sitecing {
85 return; 84 return;
86 }catch(utility_no_affix& una) { 85 }catch(utility_no_suffix& uns) { }
87 // do nothing. must be a cpp dependency.
88 }
89 } 86 }
@@ -92,5 +89,4 @@ namespace sitecing {
92 try { 89 try {
93 string nos = strip_suffix(dp,cc_targets[cct]); 90 string nos = strip_suffix(noro,cc_targets[cct]);
94 string noro = strip_prefix(nos,root_intermediate); 91 deps.push_back(root_intermediate+nos+".cc");
95 deps.push_back(root_intermediate+noro+".cc");
96 config_options *co_cpp_deps = config.lookup_config(noro,config_options::flag_cpp_deps); 92 config_options *co_cpp_deps = config.lookup_config(noro,config_options::flag_cpp_deps);
@@ -103,3 +99,3 @@ namespace sitecing {
103 if(str.find_first_of("\\:")==string::npos) 99 if(str.find_first_of("\\:")==string::npos)
104 deps.push_back(combine_path(config.root_source+noro,str)); 100 deps.push_back(combine_path(config.root_source+nos,str));
105 } 101 }
@@ -108,6 +104,5 @@ namespace sitecing {
108 // XXX: extra deps like IntermediateDeps? 104 // XXX: extra deps like IntermediateDeps?
109 }catch(utility_no_affix& una) { 105 }catch(utility_no_suffix& uns) { }
110 // do nothing.
111 }
112 } 106 }
107 }catch(utility_no_prefix& unp) { }
113 } 108 }
@@ -142,4 +137,3 @@ namespace sitecing {
142 return; 137 return;
143 }catch(utility_no_prefix& unp) { 138 }catch(utility_no_prefix& unp) { }
144 }
145 // .so files 139 // .so files
@@ -185,4 +179,5 @@ namespace sitecing {
185 throw konforka::exception(CODEPOINT,"component is outside of component root"); 179 throw konforka::exception(CODEPOINT,"component is outside of component root");
186 }catch(utility_no_suffix& uns) { 180 }catch(utility_no_suffix& uns) { }
187 } 181 try {
182 string noro = strip_prefix(dp,root_intermediate);
188 // compiler targets 183 // compiler targets
@@ -190,6 +185,5 @@ namespace sitecing {
190 try { 185 try {
191 string nos = strip_suffix(dp,cc_targets[cct]); 186 string nos = strip_suffix(noro,cc_targets[cct]);
192 string noro = strip_prefix(nos,root_intermediate); 187 string cc = root_intermediate+nos+".cc";
193 string cc = root_intermediate+noro+".cc"; 188 string o = root_intermediate+nos+".o";
194 string o = root_intermediate+noro+".o";
195 if(access(cc.c_str(),R_OK)) 189 if(access(cc.c_str(),R_OK))
@@ -197,10 +191,10 @@ namespace sitecing {
197 make_path(dir_name(cc),0755); 191 make_path(dir_name(cc),0755);
198 string pwd = dir_name(root_source+noro); 192 string pwd = dir_name(root_source+nos);
199 auto_chdir dir_changer(pwd); 193 auto_chdir dir_changer(pwd);
200 file_lock lock_source(root_intermediate+noro+".lock"); 194 file_lock lock_source(root_intermediate+nos+".lock");
201 file_lock lock_cc(root_intermediate+noro+".o.lock"); 195 file_lock lock_cc(root_intermediate+nos+".o.lock");
202 int stdO = open((root_intermediate+noro+".stdout").c_str(),O_CREAT|O_TRUNC|O_WRONLY,0664); 196 int stdO = open((root_intermediate+nos+".stdout").c_str(),O_CREAT|O_TRUNC|O_WRONLY,0664);
203 if(stdO<0) 197 if(stdO<0)
204 throw konforka::exception(CODEPOINT,"failed to open/create compiler stdout"); 198 throw konforka::exception(CODEPOINT,"failed to open/create compiler stdout");
205 int stdE = open((root_intermediate+noro+".stderr").c_str(),O_CREAT|O_TRUNC|O_WRONLY,0664); 199 int stdE = open((root_intermediate+nos+".stderr").c_str(),O_CREAT|O_TRUNC|O_WRONLY,0664);
206 if(stdE<0) { 200 if(stdE<0) {
@@ -210,3 +204,3 @@ namespace sitecing {
210 list<string> args; 204 list<string> args;
211 config_options *co_cpp_flags = config.lookup_config(noro,config_options::flag_cpp_flags); 205 config_options *co_cpp_flags = config.lookup_config(nos,config_options::flag_cpp_flags);
212 if(co_cpp_flags) { 206 if(co_cpp_flags) {
@@ -217,3 +211,3 @@ namespace sitecing {
217 args.push_back("-I"+root_source); 211 args.push_back("-I"+root_source);
218 args.push_back("-MD"); args.push_back("-MF"); args.push_back(root_intermediate+noro+".d"); 212 args.push_back("-MD"); args.push_back("-MF"); args.push_back(root_intermediate+nos+".d");
219 args.push_back("-c"); 213 args.push_back("-c");
@@ -224,7 +218,5 @@ namespace sitecing {
224 if(! (WIFEXITED(rv) && !WEXITSTATUS(rv)) ) 218 if(! (WIFEXITED(rv) && !WEXITSTATUS(rv)) )
225 throw compile_error(CODEPOINT,"failed to compile component",noro); 219 throw compile_error(CODEPOINT,"failed to compile component",nos);
226 return; 220 return;
227 }catch(utility_no_affix& una) { 221 }catch(utility_no_suffix& uns) { }
228 // do nothing, not a compiler target
229 }
230 } 222 }
@@ -233,11 +225,10 @@ namespace sitecing {
233 try { 225 try {
234 string nos = strip_suffix(dp,pp_targets[ppt]); 226 string nos = strip_suffix(noro,pp_targets[ppt]);
235 string noro = strip_prefix(nos,root_intermediate); 227 string src = root_source+nos;
236 string src = root_source+noro;
237 if(access(src.c_str(),R_OK)) 228 if(access(src.c_str(),R_OK))
238 throw konforka::exception(CODEPOINT,string("can't access component source (")+src+")"); 229 throw konforka::exception(CODEPOINT,string("can't access component source (")+src+")");
239 make_path(dir_name(root_intermediate+noro),0755); 230 make_path(dir_name(root_intermediate+nos),0755);
240 file_lock lock(root_intermediate+noro+".lock"); 231 file_lock lock(root_intermediate+nos+".lock");
241 sitecing_parser parser(*this); 232 sitecing_parser parser(*this);
242 config_options *co_skeleton = config.lookup_config(noro,config_options::flag_skeleton); 233 config_options *co_skeleton = config.lookup_config(nos,config_options::flag_skeleton);
243 if(co_skeleton) 234 if(co_skeleton)
@@ -245,3 +236,3 @@ namespace sitecing {
245 static const char *id_chars = "abcdefghijklmnopqrstuvwxyz0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 236 static const char *id_chars = "abcdefghijklmnopqrstuvwxyz0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ";
246 parser.class_name = normalize_path(noro,strip_leading_slash|strip_trailing_slash); 237 parser.class_name = normalize_path(nos,strip_leading_slash|strip_trailing_slash);
247 for(string::size_type illc = parser.class_name.find_first_not_of(id_chars);illc!=string::npos;illc=parser.class_name.find_first_not_of(id_chars,illc)) { 238 for(string::size_type illc = parser.class_name.find_first_not_of(id_chars);illc!=string::npos;illc=parser.class_name.find_first_not_of(id_chars,illc)) {
@@ -252,10 +243,10 @@ namespace sitecing {
252 parser.class_name = "_SCC_"+parser.class_name; 243 parser.class_name = "_SCC_"+parser.class_name;
253 parser.output_basename = nos; 244 parser.output_basename = root_intermediate+nos;
254 parser.component_basename = noro; 245 parser.component_basename = nos;
255 try { 246 try {
256 parser.preprocess(src); 247 parser.preprocess(src);
257 string sf = root_intermediate+noro+".pp_stamp"; 248 string sf = root_intermediate+nos+".pp_stamp";
258 ofstream sfs(sf.c_str(),ios::trunc|ios::out); // touch .pp_stamp 249 ofstream sfs(sf.c_str(),ios::trunc|ios::out); // touch .pp_stamp
259 }catch(preprocessor_error& pe) { 250 }catch(preprocessor_error& pe) {
260 pe.component_name = noro; 251 pe.component_name = nos;
261 pe.see(CODEPOINT); 252 pe.see(CODEPOINT);
@@ -264,6 +255,5 @@ namespace sitecing {
264 return; 255 return;
265 }catch(utility_no_affix& una) { 256 }catch(utility_no_suffix& uns) { }
266 // must be a crap from .d file
267 }
268 } 257 }
258 }catch(utility_no_prefix& unp) { }
269 cerr << "ignoring build request for " << dp << endl; 259 cerr << "ignoring build request for " << dp << endl;