Skip to content

Commit c2470e9

Browse files
committed
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 fe80efe commit c2470e9

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
@@ -88,12 +88,12 @@ def generate(self):
8888
ctx.update(self.flags)
8989

9090
for templatefile in \
91-
['makefile/%s_%s.tmpl' % (self.NAME.lower(),
91+
['makefile/%s_%s.tmpl' % (self.TEMPLATE,
9292
self.target.lower())] + \
93-
['makefile/%s_%s.tmpl' % (self.NAME.lower(),
93+
['makefile/%s_%s.tmpl' % (self.TEMPLATE,
9494
label.lower()) for label
9595
in self.toolchain.target.extra_labels] +\
96-
['makefile/%s.tmpl' % self.NAME.lower()]:
96+
['makefile/%s.tmpl' % self.TEMPLATE]:
9797
try:
9898
self.gen_file(templatefile, ctx, 'Makefile')
9999
break
@@ -108,6 +108,7 @@ class GccArm(Makefile):
108108
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
109109
if "GCC_ARM" in obj.supported_toolchains]
110110
NAME = 'Make-GCC-ARM'
111+
TEMPLATE = 'make-gcc-arm'
111112
TOOLCHAIN = "GCC_ARM"
112113
LINK_SCRIPT_OPTION = "-T"
113114
USER_LIBRARY_FLAG = "-L"
@@ -122,6 +123,7 @@ class Armc5(Makefile):
122123
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
123124
if "ARM" in obj.supported_toolchains]
124125
NAME = 'Make-ARMc5'
126+
TEMPLATE = 'make-armc5'
125127
TOOLCHAIN = "ARM"
126128
LINK_SCRIPT_OPTION = "--scatter"
127129
USER_LIBRARY_FLAG = "--userlibpath "
@@ -136,6 +138,7 @@ class IAR(Makefile):
136138
TARGETS = [target for target, obj in TARGET_MAP.iteritems()
137139
if "IAR" in obj.supported_toolchains]
138140
NAME = 'Make-IAR'
141+
TEMPLATE = 'make-iar'
139142
TOOLCHAIN = "IAR"
140143
LINK_SCRIPT_OPTION = "--config"
141144
USER_LIBRARY_FLAG = "-L"

0 commit comments

Comments
 (0)