targets/toolchain_gcc.py
changeset 510 8038c08b9874
parent 427 7ac746c07ff2
child 677 607731b33026
equal deleted inserted replaced
509:aa5645a25d64 510:8038c08b9874
    12     """
    12     """
    13     def __init__(self, PluginsRootInstance):
    13     def __init__(self, PluginsRootInstance):
    14         self.PluginsRootInstance = PluginsRootInstance
    14         self.PluginsRootInstance = PluginsRootInstance
    15         self.buildpath = None
    15         self.buildpath = None
    16         self.SetBuildPath(self.PluginsRootInstance._getBuildPath())
    16         self.SetBuildPath(self.PluginsRootInstance._getBuildPath())
    17 
    17     
    18     def getTarget(self):
       
    19         target = self.PluginsRootInstance.BeremizRoot.getTargetType()
       
    20         if target.getcontent() is None:
       
    21             target = self.PluginsRootInstance.GetDefaultTarget()
       
    22         return target
       
    23 
       
    24     def getBuilderCFLAGS(self):
    18     def getBuilderCFLAGS(self):
    25         """
    19         """
    26         Returns list of builder specific CFLAGS
    20         Returns list of builder specific CFLAGS
    27         """
    21         """
    28         return [self.getTarget().getcontent()["value"].getCFLAGS()]
    22         return [self.PluginsRootInstance.GetTarget().getcontent()["value"].getCFLAGS()]
    29 
    23 
    30     def getBuilderLDFLAGS(self):
    24     def getBuilderLDFLAGS(self):
    31         """
    25         """
    32         Returns list of builder specific LDFLAGS
    26         Returns list of builder specific LDFLAGS
    33         """
    27         """
    34         return self.PluginsRootInstance.LDFLAGS + \
    28         return self.PluginsRootInstance.LDFLAGS + \
    35                [self.getTarget().getcontent()["value"].getLDFLAGS()]
    29                [self.PluginsRootInstance.GetTarget().getcontent()["value"].getLDFLAGS()]
    36 
    30 
    37     def GetBinaryCode(self):
    31     def GetBinaryCode(self):
    38         try:
    32         try:
    39             return open(self.exe_path, "rb").read()
    33             return open(self.exe_path, "rb").read()
    40         except Exception, e:
    34         except Exception, e:
    86         # TODO detect cicular deps.
    80         # TODO detect cicular deps.
    87         return reduce(operator.and_, map(self.check_and_update_hash_and_deps, deps), match)
    81         return reduce(operator.and_, map(self.check_and_update_hash_and_deps, deps), match)
    88                 
    82                 
    89     def build(self):
    83     def build(self):
    90         # Retrieve toolchain user parameters
    84         # Retrieve toolchain user parameters
    91         toolchain_params = self.getTarget().getcontent()["value"]
    85         toolchain_params = self.PluginsRootInstance.GetTarget().getcontent()["value"]
    92         self.compiler = toolchain_params.getCompiler()
    86         self.compiler = toolchain_params.getCompiler()
    93         self.linker = toolchain_params.getLinker()
    87         self.linker = toolchain_params.getLinker()
    94 
    88 
    95         Builder_CFLAGS = ' '.join(self.getBuilderCFLAGS())
    89         Builder_CFLAGS = ' '.join(self.getBuilderCFLAGS())
    96 
    90