Skip to content

Commit 07cb268

Browse files
theotherjimmyadbridge
authored andcommitted
Use internal class variable for resolving templates in makefiles
This allows other exporters to inherit from make and change the name of the exporter without breaking.
1 parent 0058695 commit 07cb268

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/export/makefile/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ def generate(self):
9191
ctx.update(self.flags)
9292

9393
for templatefile in \
94-
['makefile/%s_%s.tmpl' % (self.NAME.lower(),
94+
['makefile/%s_%s.tmpl' % (self.TEMPLATE,
9595
self.target.lower())] + \
96-
['makefile/%s_%s.tmpl' % (self.NAME.lower(),
96+
['makefile/%s_%s.tmpl' % (self.TEMPLATE,
9797
label.lower()) for label
9898
in self.toolchain.target.extra_labels] +\
99-
['makefile/%s.tmpl' % self.NAME.lower()]:
99+
['makefile/%s.tmpl' % self.TEMPLATE]:
100100
try:
101101
self.gen_file(templatefile, ctx, 'Makefile')
102102
break
@@ -143,6 +143,7 @@ class GccArm(Makefile):
143143
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
144144
if "GCC_ARM" in obj.supported_toolchains]
145145
NAME = 'Make-GCC-ARM'
146+
TEMPLATE = 'make-gcc-arm'
146147
TOOLCHAIN = "GCC_ARM"
147148
LINK_SCRIPT_OPTION = "-T"
148149
USER_LIBRARY_FLAG = "-L"
@@ -157,6 +158,7 @@ class Armc5(Makefile):
157158
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
158159
if "ARM" in obj.supported_toolchains]
159160
NAME = 'Make-ARMc5'
161+
TEMPLATE = 'make-armc5'
160162
TOOLCHAIN = "ARM"
161163
LINK_SCRIPT_OPTION = "--scatter"
162164
USER_LIBRARY_FLAG = "--userlibpath "
@@ -171,6 +173,7 @@ class IAR(Makefile):
171173
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
172174
if "IAR" in obj.supported_toolchains]
173175
NAME = 'Make-IAR'
176+
TEMPLATE = 'make-iar'
174177
TOOLCHAIN = "IAR"
175178
LINK_SCRIPT_OPTION = "--config"
176179
USER_LIBRARY_FLAG = "-L"

0 commit comments

Comments
 (0)