targets/toolchain_makefile.py
changeset 510 8038c08b9874
parent 508 73ecb803d8af
child 521 02cb9e5fb6f6
equal deleted inserted replaced
509:aa5645a25d64 510:8038c08b9874
     1 import os, re, operator
     1 import os, re
     2 from wxPopen import ProcessLogger
     2 from wxPopen import ProcessLogger
     3 import hashlib, shutil
     3 import hashlib
     4 from toolchain_gcc import toolchain_gcc
       
     5 
     4 
     6 includes_re =  re.compile('\s*#include\s*["<]([^">]*)[">].*')
     5 includes_re =  re.compile('\s*#include\s*["<]([^">]*)[">].*')
     7 
     6 
     8 class toolchain_makefile():
     7 class toolchain_makefile():
     9     def __init__(self, PluginsRootInstance):
     8     def __init__(self, PluginsRootInstance):
    10         self.PluginsRootInstance = PluginsRootInstance
     9         self.PluginsRootInstance = PluginsRootInstance
    11         self.md5key = None 
    10         self.md5key = None 
    12         self.buildpath = None
    11         self.buildpath = None
    13         self.SetBuildPath(self.PluginsRootInstance._getBuildPath())
    12         self.SetBuildPath(self.PluginsRootInstance._getBuildPath())
    14 
       
    15     def getTarget(self):
       
    16         target = self.PluginsRootInstance.BeremizRoot.getTargetType()
       
    17         if target.getcontent() is None:
       
    18             target = self.PluginsRootInstance.GetDefaultTarget()
       
    19         return target
       
    20 
    13 
    21     def SetBuildPath(self, buildpath):
    14     def SetBuildPath(self, buildpath):
    22         self.buildpath = buildpath
    15         self.buildpath = buildpath
    23         self.exe_path = os.path.join(self.buildpath, "ArmPLC_rom.bin")
    16         self.exe_path = os.path.join(self.buildpath, "ArmPLC_rom.bin")
    24         self.md5_path = os.path.join(self.buildpath, "ArmPLC.md5")
    17         self.md5_path = os.path.join(self.buildpath, "ArmPLC.md5")
    62         beremizcommand = {"src": ' '.join(srcfiles),
    55         beremizcommand = {"src": ' '.join(srcfiles),
    63                           "cflags": ' '.join(cflags),
    56                           "cflags": ' '.join(cflags),
    64                           "md5": self.md5key
    57                           "md5": self.md5key
    65                          }
    58                          }
    66         
    59         
    67         target = self.getTarget().getcontent()["value"]
    60         target = self.PluginsRootInstance.GetTarget().getcontent()["value"]
    68         command = target.getCommand().split(' ') +\
    61         command = target.getCommand().split(' ') +\
    69                   [target.getBuildPath()] +\
    62                   [target.getBuildPath()] +\
    70                   [arg % beremizcommand for arg in target.getArguments().split(' ')] +\
    63                   [arg % beremizcommand for arg in target.getArguments().split(' ')] +\
    71                   target.getRule().split(' ')
    64                   target.getRule().split(' ')
    72         
    65