author | Andrey Skvortsov <andrej.skvortzov@gmail.com> |
Thu, 09 Mar 2017 15:35:19 +0300 | |
changeset 1657 | 3a98027ff372 |
parent 1575 | de2da05089ea |
child 1709 | 1e8900fc8ddb |
permissions | -rwxr-xr-x |
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 |
|
1387
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
25 |
import os, re, operator |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
26 |
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
|
27 |
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
|
28 |
|
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 time |
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 |
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
|
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 |
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
|
34 |
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
|
35 |
self.CTRInstance = CTRInstance |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
36 |
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
|
37 |
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
|
38 |
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
|
39 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
40 |
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
|
41 |
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
|
42 |
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
|
43 |
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
|
44 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
45 |
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
|
46 |
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
|
47 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
48 |
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
|
49 |
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
|
50 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
51 |
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
|
52 |
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
|
53 |
try: |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
54 |
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
|
55 |
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
|
56 |
pass |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
57 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
else: |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
62 |
try: |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
63 |
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
|
64 |
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
|
65 |
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
|
66 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
67 |
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
|
68 |
# 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
|
69 |
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
|
70 |
# 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
|
71 |
deps = [] |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
72 |
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
|
73 |
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
|
74 |
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
|
75 |
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
|
76 |
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
|
77 |
#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
|
78 |
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
|
79 |
# 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
|
80 |
# 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
|
81 |
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
|
82 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
83 |
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
|
84 |
srcfiles= [] |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
85 |
cflags = [] |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
86 |
wholesrcdata = "" |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
87 |
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
|
88 |
# 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
|
89 |
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
|
90 |
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
|
91 |
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
|
92 |
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
|
93 |
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
|
94 |
cflags.append(CFLAGS) |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
95 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
96 |
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
|
97 |
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
|
98 |
|
1387
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
99 |
# 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
|
100 |
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
|
101 |
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
|
102 |
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
|
103 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
104 |
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
|
105 |
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
|
106 |
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
|
107 |
"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
|
108 |
"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
|
109 |
"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
|
110 |
} |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
111 |
|
1543
61f0f31ef296
fix issue with sequence of multiple whitespaces in makefile command
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1511
diff
changeset
|
112 |
# clean sequence of multiple whitespaces |
61f0f31ef296
fix issue with sequence of multiple whitespaces in makefile command
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1511
diff
changeset
|
113 |
cmd = re.sub(r"[ ]+", " ", target.getCommand()) |
61f0f31ef296
fix issue with sequence of multiple whitespaces in makefile command
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1511
diff
changeset
|
114 |
|
61f0f31ef296
fix issue with sequence of multiple whitespaces in makefile command
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
1511
diff
changeset
|
115 |
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
|
116 |
|
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
117 |
# 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
|
118 |
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
|
119 |
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
|
120 |
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
|
121 |
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
|
122 |
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
|
123 |
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
|
124 |
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
|
125 |
else : |
435965ca8b63
Re-introduced toolchain_makefile.py. This time, it comes with a 'Generic' target, and a 'genericmake' example
Edouard Tisserant
parents:
diff
changeset
|
126 |
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
|
127 |
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
|
128 |