comparison python/ppci/buildtasks.py @ 342:86b02c98a717 devel

Moved target directory
author Windel Bouwman
date Sat, 01 Mar 2014 15:40:31 +0100
parents b00219172a42
children 3bb7dcfe5529
comparison
equal deleted inserted replaced
341:4d204f6f7d4e 342:86b02c98a717
13 from .tasks import Task, TaskError 13 from .tasks import Task, TaskError
14 from . import DiagnosticsManager, CompilerError 14 from . import DiagnosticsManager, CompilerError
15 from .assembler import Assembler 15 from .assembler import Assembler
16 from .objectfile import ObjectFile 16 from .objectfile import ObjectFile
17 from .linker import Linker 17 from .linker import Linker
18 import outstream 18 from .outstream import BinaryOutputStream
19 19
20 20
21 class BuildTask(Task): 21 class BuildTask(Task):
22 """ Base task for all kind of weird build tasks """ 22 """ Base task for all kind of weird build tasks """
23 def __init__(self, name): 23 def __init__(self, name):
30 output into an object file """ 30 output into an object file """
31 def __init__(self, source, target, output_object): 31 def __init__(self, source, target, output_object):
32 super().__init__('Assemble') 32 super().__init__('Assemble')
33 self.source = source 33 self.source = source
34 self.output = output_object 34 self.output = output_object
35 self.ostream = outstream.BinaryOutputStream(self.output) 35 self.ostream = BinaryOutputStream(self.output)
36 self.assembler = Assembler(target, self.ostream) 36 self.assembler = Assembler(target, self.ostream)
37 37
38 def run(self): 38 def run(self):
39 self.ostream.selectSection('code') 39 self.ostream.selectSection('code')
40 self.assembler.assemble(self.source) 40 self.assembler.assemble(self.source)
72 Verifier().verify(ircode) 72 Verifier().verify(ircode)
73 73
74 # Code generation: 74 # Code generation:
75 d = {'ircode':ircode} 75 d = {'ircode':ircode}
76 self.logger.debug('Starting code generation for {}'.format(ircode), extra=d) 76 self.logger.debug('Starting code generation for {}'.format(ircode), extra=d)
77 o = outstream.BinaryOutputStream(self.output) 77 o = BinaryOutputStream(self.output)
78 cg.generate(ircode, o) 78 cg.generate(ircode, o)
79 79
80 if not c3b.ok: 80 if not c3b.ok:
81 diag.printErrors() 81 diag.printErrors()
82 raise TaskError('Compile errors') 82 raise TaskError('Compile errors')