109 if os.path.exists(os.path.join(self.buildpath, depfn)): |
109 if os.path.exists(os.path.join(self.buildpath, depfn)): |
110 deps.append(depfn) |
110 deps.append(depfn) |
111 |
111 |
112 def concat_deps(self, bn): |
112 def concat_deps(self, bn): |
113 # read source |
113 # read source |
114 src = open(os.path.join(self.buildpath, bn),"r").read() |
114 src = open(os.path.join(self.buildpath, bn), "r").read() |
115 # update direct dependencies |
115 # update direct dependencies |
116 deps = [] |
116 deps = [] |
117 self.append_cfile_deps(src, deps) |
117 self.append_cfile_deps(src, deps) |
118 # recurse through deps |
118 # recurse through deps |
119 # TODO detect cicular deps. |
119 # TODO detect cicular deps. |
120 return reduce(operator.concat, map(self.concat_deps, deps), src) |
120 return reduce(operator.concat, map(self.concat_deps, deps), src) |
121 |
121 |
122 def check_and_update_hash_and_deps(self, bn): |
122 def check_and_update_hash_and_deps(self, bn): |
123 # Get latest computed hash and deps |
123 # Get latest computed hash and deps |
124 oldhash, deps = self.srcmd5.get(bn,(None,[])) |
124 oldhash, deps = self.srcmd5.get(bn, (None, [])) |
125 # read source |
125 # read source |
126 src = open(os.path.join(self.buildpath, bn)).read() |
126 src = open(os.path.join(self.buildpath, bn)).read() |
127 # compute new hash |
127 # compute new hash |
128 newhash = hashlib.md5(src).hexdigest() |
128 newhash = hashlib.md5(src).hexdigest() |
129 # compare |
129 # compare |
163 objs = [] |
163 objs = [] |
164 relink = self.GetBinaryCode() is None |
164 relink = self.GetBinaryCode() is None |
165 for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: |
165 for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: |
166 if CFilesAndCFLAGS: |
166 if CFilesAndCFLAGS: |
167 if Location: |
167 if Location: |
168 self.CTRInstance.logger.write(".".join(map(str,Location))+" :\n") |
168 self.CTRInstance.logger.write(".".join(map(str, Location))+" :\n") |
169 else: |
169 else: |
170 self.CTRInstance.logger.write(_("PLC :\n")) |
170 self.CTRInstance.logger.write(_("PLC :\n")) |
171 |
171 |
172 for CFile, CFLAGS in CFilesAndCFLAGS: |
172 for CFile, CFLAGS in CFilesAndCFLAGS: |
173 if CFile.endswith(".c"): |
173 if CFile.endswith(".c"): |