summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2005-03-31 20:07:16 (UTC)
committer Michael Krelin <hacker@klever.net>2005-03-31 20:07:16 (UTC)
commit185d182cd6d3e0593a3627837f3bb400b654e602 (patch) (unidiff)
treebf848291cf5fb161df0a028ca9f3a3095f862d0b
parentc9a601eeae3457d28fb1dfd7592ce29d2b06f411 (diff)
downloadsitecing-185d182cd6d3e0593a3627837f3bb400b654e602.zip
sitecing-185d182cd6d3e0593a3627837f3bb400b654e602.tar.gz
sitecing-185d182cd6d3e0593a3627837f3bb400b654e602.tar.bz2
Yes, I did break dependency handling a bit.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--lib/component_factory.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/component_factory.cc b/lib/component_factory.cc
index 2a2eefe..5c18bb7 100644
--- a/lib/component_factory.cc
+++ b/lib/component_factory.cc
@@ -55,74 +55,80 @@ namespace sitecing {
55 // preprocessor targets 55 // preprocessor targets
56 string noro = strip_prefix(dp,root_intermediate); 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(noro,pp_targets[ppt]); 59 string nos = strip_suffix(noro,pp_targets[ppt]);
60 deps.push_back(root_source+nos); // depends on the source 60 deps.push_back(root_source+nos); // depends on the source
61 ifstream imports((root_intermediate+nos+".imports").c_str(),ios::in); 61 ifstream imports((root_intermediate+nos+".imports").c_str(),ios::in);
62 if(imports.good()) { 62 if(imports.good()) {
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 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);
80 if(co_intermediate_deps) { 81 if(co_intermediate_deps) {
81 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)
82 deps.push_back(*i); 83 deps.push_back(*i);
83 } 84 }
84 return; 85 return;
85 }catch(utility_no_suffix& uns) { } 86 }catch(utility_no_suffix& uns) { }
86 } 87 }
87 // compiler targets 88 // compiler targets
88 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++) {
89 try { 90 try {
90 string nos = strip_suffix(noro,cc_targets[cct]); 91 string nos = strip_suffix(noro,cc_targets[cct]);
91 deps.push_back(root_intermediate+nos+".cc"); 92 deps.push_back(root_intermediate+nos+".cc");
92 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);
93 if( (!co_cpp_deps) || co_cpp_deps->cpp_deps) { 94 if( (!co_cpp_deps) || co_cpp_deps->cpp_deps) {
94 ifstream df((root_intermediate+noro+".d").c_str(),ios::in); 95 ifstream df((root_intermediate+noro+".d").c_str(),ios::in);
95 if(df.good()) { 96 if(df.good()) {
96 string str; 97 string str;
97 while(!df.eof()) { 98 while(!df.eof()) {
98 df >> str; 99 df >> str;
99 if(str.find_first_of("\\:")==string::npos) 100 if(str.find_first_of("\\:")==string::npos)
100 deps.push_back(combine_path(config.root_source+nos,str)); 101 deps.push_back(combine_path(config.root_source+nos,str));
101 } 102 }
102 } 103 }
103 } 104 }
104 // XXX: extra deps like IntermediateDeps? 105 // XXX: intermediate_deps should be broken down
106 config_options *co_intermediate_deps = config.lookup_config(nos,config_options::flag_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)
109 deps.push_back(*i);
110 }
105 }catch(utility_no_suffix& uns) { } 111 }catch(utility_no_suffix& uns) { }
106 } 112 }
107 }catch(utility_no_prefix& unp) { } 113 }catch(utility_no_prefix& unp) { }
108 } 114 }
109 115
110 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) {
111 string dp = normalize_path(dst,strip_trailing_slash); 117 string dp = normalize_path(dst,strip_trailing_slash);
112 // XXX: or just compare it off, instead of throwing things around. 118 // XXX: or just compare it off, instead of throwing things around.
113 try { 119 try {
114 string noro = strip_prefix(dp,root_intermediate); 120 string noro = strip_prefix(dp,root_intermediate);
115 for(int ppt=0;(ppt+1)<sizeof(pp_targets)/sizeof(*pp_targets);ppt++) { 121 for(int ppt=0;(ppt+1)<sizeof(pp_targets)/sizeof(*pp_targets);ppt++) {
116 try { 122 try {
117 string nos = strip_suffix(noro,pp_targets[ppt]); 123 string nos = strip_suffix(noro,pp_targets[ppt]);
118 return file_factory::is_uptodate(root_intermediate+nos+".pp_stamp",deps); 124 return file_factory::is_uptodate(root_intermediate+nos+".pp_stamp",deps);
119 }catch(utility_no_suffix& uns) { } 125 }catch(utility_no_suffix& uns) { }
120 } 126 }
121 bool rv = file_factory::is_uptodate(dst,deps); 127 bool rv = file_factory::is_uptodate(dst,deps);
122 return rv; 128 return rv;
123 }catch(utility_no_prefix& unp) { } 129 }catch(utility_no_prefix& unp) { }
124 try { 130 try {
125 strip_prefix(dp,root_so); 131 strip_prefix(dp,root_so);
126 return file_factory::is_uptodate(dst,deps); 132 return file_factory::is_uptodate(dst,deps);
127 }catch(utility_no_prefix& unp) { } 133 }catch(utility_no_prefix& unp) { }
128 return true; 134 return true;