targets/toolchain_makefile.py
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 14 Aug 2017 21:20:32 +0300
changeset 1732 94ffe74e6895
parent 1730 64d8f52bc8c8
child 1736 7e61baa047f0
permissions -rwxr-xr-x
clean-up: fix PEP8 E401 multiple imports on one line
1511
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     1
#!/usr/bin/env python
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     2
# -*- coding: utf-8 -*-
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     3
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     4
# This file is part of Beremiz, a Integrated Development Environment for
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     5
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     6
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     7
# Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     8
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
     9
# See COPYING file for copyrights details.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    10
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    11
# This program is free software; you can redistribute it and/or
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    12
# modify it under the terms of the GNU General Public License
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    13
# as published by the Free Software Foundation; either version 2
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    14
# of the License, or (at your option) any later version.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    15
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    16
# This program is distributed in the hope that it will be useful,
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    19
# GNU General Public License for more details.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    20
#
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    21
# You should have received a copy of the GNU General Public License
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    22
# along with this program; if not, write to the Free Software
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    23
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
91538d0c242c add copyright notices to python files where there were missing, that
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1402
diff changeset
    24
1732
94ffe74e6895 clean-up: fix PEP8 E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1730
diff changeset
    25
import os
94ffe74e6895 clean-up: fix PEP8 E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1730
diff changeset
    26
import re
94ffe74e6895 clean-up: fix PEP8 E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1730
diff changeset
    27
import operator
1387
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    28
from util.ProcessLogger import ProcessLogger
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    29
import hashlib
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    30
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    31
import time
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    32
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    33
includes_re =  re.compile('\s*#include\s*["<]([^">]*)[">].*')
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    34
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    35
class toolchain_makefile():
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    36
    def __init__(self, CTRInstance):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    37
        self.CTRInstance = CTRInstance
1730
64d8f52bc8c8 clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1709
diff changeset
    38
        self.md5key = None
1387
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    39
        self.buildpath = None
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    40
        self.SetBuildPath(self.CTRInstance._getBuildPath())
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    41
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    42
    def SetBuildPath(self, buildpath):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    43
        if self.buildpath != buildpath:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    44
            self.buildpath = buildpath
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    45
            self.md5key = None
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    46
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    47
    def GetBinaryCode(self):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    48
        return None
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    49
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    50
    def _GetMD5FileName(self):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    51
        return os.path.join(self.buildpath, "lastbuildPLC.md5")
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    52
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    53
    def ResetBinaryCodeMD5(self):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    54
        self.md5key = None
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    55
        try:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    56
            os.remove(self._GetMD5FileName())
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    57
        except Exception, e:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    58
            pass
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    59
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    60
    def GetBinaryCodeMD5(self):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    61
        if self.md5key is not None:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    62
            return self.md5key
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    63
        else:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    64
            try:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    65
                return open(self._GetMD5FileName(), "r").read()
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    66
            except IOError, e:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    67
                return None
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    68
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    69
    def concat_deps(self, bn):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    70
        # read source
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    71
        src = open(os.path.join(self.buildpath, bn),"r").read()
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    72
        # update direct dependencies
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    73
        deps = []
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    74
        for l in src.splitlines():
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    75
            res = includes_re.match(l)
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    76
            if res is not None:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    77
                depfn = res.groups()[0]
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    78
                if os.path.exists(os.path.join(self.buildpath, depfn)):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    79
                    #print bn + " depends on "+depfn
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    80
                    deps.append(depfn)
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    81
        # recurse through deps
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    82
        # TODO detect cicular deps.
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    83
        return reduce(operator.concat, map(self.concat_deps, deps), src)
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    84
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    85
    def build(self):
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    86
        srcfiles= []
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    87
        cflags = []
1730
64d8f52bc8c8 clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1709
diff changeset
    88
        wholesrcdata = ""
1387
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    89
        for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    90
            # Get CFiles list to give it to makefile
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    91
            for CFile, CFLAGS in CFilesAndCFLAGS:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    92
                CFileName = os.path.basename(CFile)
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    93
                wholesrcdata += self.concat_deps(CFileName)
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    94
                srcfiles.append(CFileName)
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    95
                if CFLAGS not in cflags:
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    96
                    cflags.append(CFLAGS)
1730
64d8f52bc8c8 clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1709
diff changeset
    97
1387
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    98
        oldmd5 = self.md5key
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
    99
        self.md5key = hashlib.md5(wholesrcdata).hexdigest()
1575
de2da05089ea don't rebuild the makefile based project if only companyName, projectName or productName are changed
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1549
diff changeset
   100
1387
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   101
        # Store new PLC filename based on md5 key
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   102
        f = open(self._GetMD5FileName(), "w")
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   103
        f.write(self.md5key)
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   104
        f.close()
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   105
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   106
        if oldmd5 != self.md5key :
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   107
            target = self.CTRInstance.GetTarget().getcontent()
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   108
            beremizcommand = {"src": ' '.join(srcfiles),
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   109
                              "cflags": ' '.join(cflags),
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   110
                              "md5": self.md5key,
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   111
                              "buildpath": self.buildpath
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   112
                             }
1730
64d8f52bc8c8 clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1709
diff changeset
   113
64d8f52bc8c8 clean-up for PEP8: fix W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1709
diff changeset
   114
            # clean sequence of multiple whitespaces
1709
1e8900fc8ddb fix build problem when make command have trailing whitespace(s)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1575
diff changeset
   115
            cmd = re.sub(r"[ ]+", " ", target.getCommand().strip())
1543
61f0f31ef296 fix issue with sequence of multiple whitespaces in makefile command
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1511
diff changeset
   116
61f0f31ef296 fix issue with sequence of multiple whitespaces in makefile command
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1511
diff changeset
   117
            command = [ token % beremizcommand for token in cmd.split(' ')]
1387
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   118
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   119
            # Call Makefile to build PLC code and link it with target specific code
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   120
            status, result, err_result = ProcessLogger(self.CTRInstance.logger,
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   121
                                                       command).spin()
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   122
            if status :
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   123
                self.md5key = None
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   124
                self.CTRInstance.logger.write_error(_("C compilation failed.\n"))
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   125
                return False
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   126
            return True
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   127
        else :
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   128
            self.CTRInstance.logger.write(_("Source didn't change, no build.\n"))
435965ca8b63 Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff changeset
   129
            return True