greg@425: import os, re, operator greg@425: from wxPopen import ProcessLogger greg@425: import hashlib, shutil greg@425: from toolchain_gcc import toolchain_gcc greg@425: greg@425: includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') greg@425: greg@425: class toolchain_makefile(toolchain_gcc): greg@425: """ greg@425: This abstract class contains GCC specific code. greg@425: It cannot be used as this and should be inherited in a target specific greg@425: class such as target_linux or target_win32 greg@425: """ greg@425: greg@425: def build(self): greg@425: srcfiles= [] greg@425: cflags = [] greg@425: for Location, CFilesAndCFLAGS, DoCalls in self.PluginsRootInstance.LocationCFilesAndCFLAGS: greg@425: # Get CFiles list to give it to makefile greg@425: for CFile, CFLAGS in CFilesAndCFLAGS: greg@425: CFileName = os.path.basename(CFile) greg@425: srcfiles.append(CFileName) greg@425: if CFLAGS not in cflags: greg@425: cflags.append(CFLAGS) greg@425: greg@425: beremizcommand = {"src": ' '.join(srcfiles), greg@425: "cflags": ' '.join(cflags) greg@425: } greg@425: greg@425: target = self.getTarget().getcontent()["value"] greg@425: command = target.getCommand().split(' ') +\ greg@425: [target.getBuildPath()] +\ greg@425: [arg % beremizcommand for arg in target.getArguments().split(' ')] +\ greg@425: target.getRule().split(' ') greg@425: greg@425: # Call Makefile to build PLC code and link it with target specific code greg@425: status, result, err_result = ProcessLogger(self.PluginsRootInstance.logger, greg@425: command).spin() greg@425: if status : greg@425: self.PluginsRootInstance.logger.write_error(_("C compilation of %s failed.\n")) greg@425: return False greg@425: return True