Clone of official tools

Committer:
Anders Blomdell
Date:
Thu Feb 04 17:17:13 2021 +0100
Revision:
47:21ae3e5a7128
Parent:
43:2a7da56ebd24
Add a few normpath calls

Who changed what in which revision?

UserRevisionLine numberNew contents of line
The Other Jimmy 31:8ea194f6145b 1 """
The Other Jimmy 31:8ea194f6145b 2 mbed SDK
The Other Jimmy 31:8ea194f6145b 3 Copyright (c) 2011-2016 ARM Limited
The Other Jimmy 31:8ea194f6145b 4
The Other Jimmy 31:8ea194f6145b 5 Licensed under the Apache License, Version 2.0 (the "License");
The Other Jimmy 31:8ea194f6145b 6 you may not use this file except in compliance with the License.
The Other Jimmy 31:8ea194f6145b 7 You may obtain a copy of the License at
The Other Jimmy 31:8ea194f6145b 8
The Other Jimmy 31:8ea194f6145b 9 http://www.apache.org/licenses/LICENSE-2.0
The Other Jimmy 31:8ea194f6145b 10
The Other Jimmy 31:8ea194f6145b 11 Unless required by applicable law or agreed to in writing, software
The Other Jimmy 31:8ea194f6145b 12 distributed under the License is distributed on an "AS IS" BASIS,
The Other Jimmy 31:8ea194f6145b 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
The Other Jimmy 31:8ea194f6145b 14 See the License for the specific language governing permissions and
The Other Jimmy 31:8ea194f6145b 15 limitations under the License.
The Other Jimmy 31:8ea194f6145b 16 """
theotherjimmy 43:2a7da56ebd24 17 from __future__ import print_function, absolute_import
theotherjimmy 43:2a7da56ebd24 18 from builtins import str
theotherjimmy 43:2a7da56ebd24 19
The Other Jimmy 31:8ea194f6145b 20 from os.path import splitext, basename, relpath, join, abspath, dirname,\
Anders Blomdell 47:21ae3e5a7128 21 exists, normpath
The Other Jimmy 31:8ea194f6145b 22 from os import remove
The Other Jimmy 31:8ea194f6145b 23 import sys
The Other Jimmy 31:8ea194f6145b 24 from subprocess import check_output, CalledProcessError, Popen, PIPE
The Other Jimmy 31:8ea194f6145b 25 import shutil
The Other Jimmy 31:8ea194f6145b 26 from jinja2.exceptions import TemplateNotFound
theotherjimmy 43:2a7da56ebd24 27 from tools.resources import FileType
theotherjimmy 40:7d3fa6b99b2b 28 from tools.export.exporters import Exporter, apply_supported_whitelist
The Other Jimmy 31:8ea194f6145b 29 from tools.utils import NotSupportedException
The Other Jimmy 31:8ea194f6145b 30 from tools.targets import TARGET_MAP
The Other Jimmy 31:8ea194f6145b 31
theotherjimmy 43:2a7da56ebd24 32 SHELL_ESCAPE_TABLE = {
theotherjimmy 43:2a7da56ebd24 33 "(": "\(",
theotherjimmy 43:2a7da56ebd24 34 ")": "\)",
theotherjimmy 43:2a7da56ebd24 35 }
theotherjimmy 43:2a7da56ebd24 36
theotherjimmy 43:2a7da56ebd24 37
theotherjimmy 43:2a7da56ebd24 38 def shell_escape(string):
theotherjimmy 43:2a7da56ebd24 39 return "".join(SHELL_ESCAPE_TABLE.get(char, char) for char in string)
theotherjimmy 43:2a7da56ebd24 40
The Other Jimmy 31:8ea194f6145b 41
The Other Jimmy 31:8ea194f6145b 42 class Makefile(Exporter):
The Other Jimmy 31:8ea194f6145b 43 """Generic Makefile template that mimics the behavior of the python build
The Other Jimmy 31:8ea194f6145b 44 system
The Other Jimmy 31:8ea194f6145b 45 """
The Other Jimmy 31:8ea194f6145b 46
The Other Jimmy 31:8ea194f6145b 47 DOT_IN_RELATIVE_PATH = True
The Other Jimmy 31:8ea194f6145b 48
The Other Jimmy 31:8ea194f6145b 49 MBED_CONFIG_HEADER_SUPPORTED = True
The Other Jimmy 31:8ea194f6145b 50
theotherjimmy 40:7d3fa6b99b2b 51 PREPROCESS_ASM = False
theotherjimmy 40:7d3fa6b99b2b 52
The Other Jimmy 36:96847d42f010 53 POST_BINARY_WHITELIST = set([
The Other Jimmy 36:96847d42f010 54 "MCU_NRF51Code.binary_hook",
The Other Jimmy 36:96847d42f010 55 "TEENSY3_1Code.binary_hook",
The Other Jimmy 36:96847d42f010 56 "LPCTargetCode.lpc_patch",
The Other Jimmy 36:96847d42f010 57 "LPC4088Code.binary_hook"
The Other Jimmy 36:96847d42f010 58 ])
The Other Jimmy 36:96847d42f010 59
theotherjimmy 40:7d3fa6b99b2b 60 @classmethod
theotherjimmy 40:7d3fa6b99b2b 61 def is_target_supported(cls, target_name):
theotherjimmy 40:7d3fa6b99b2b 62 target = TARGET_MAP[target_name]
theotherjimmy 40:7d3fa6b99b2b 63 return apply_supported_whitelist(
theotherjimmy 40:7d3fa6b99b2b 64 cls.TOOLCHAIN, cls.POST_BINARY_WHITELIST, target)
theotherjimmy 40:7d3fa6b99b2b 65
The Other Jimmy 31:8ea194f6145b 66 def generate(self):
The Other Jimmy 31:8ea194f6145b 67 """Generate the makefile
The Other Jimmy 31:8ea194f6145b 68
The Other Jimmy 31:8ea194f6145b 69 Note: subclasses should not need to override this method
The Other Jimmy 31:8ea194f6145b 70 """
The Other Jimmy 35:da9c89f8be7d 71 if not self.resources.linker_script:
The Other Jimmy 35:da9c89f8be7d 72 raise NotSupportedException("No linker script found.")
The Other Jimmy 35:da9c89f8be7d 73
The Other Jimmy 31:8ea194f6145b 74 self.resources.win_to_unix()
The Other Jimmy 31:8ea194f6145b 75
Anders Blomdell 47:21ae3e5a7128 76 to_be_compiled = [normpath(splitext(src)[0]) + ".o" for src in
The Other Jimmy 31:8ea194f6145b 77 self.resources.s_sources +
The Other Jimmy 31:8ea194f6145b 78 self.resources.c_sources +
The Other Jimmy 31:8ea194f6145b 79 self.resources.cpp_sources]
The Other Jimmy 31:8ea194f6145b 80
The Other Jimmy 31:8ea194f6145b 81 libraries = [self.prepare_lib(basename(lib)) for lib
theotherjimmy 43:2a7da56ebd24 82 in self.libraries]
The Other Jimmy 35:da9c89f8be7d 83 sys_libs = [self.prepare_sys_lib(lib) for lib
The Other Jimmy 35:da9c89f8be7d 84 in self.toolchain.sys_libs]
The Other Jimmy 31:8ea194f6145b 85
The Other Jimmy 31:8ea194f6145b 86 ctx = {
The Other Jimmy 31:8ea194f6145b 87 'name': self.project_name,
The Other Jimmy 31:8ea194f6145b 88 'to_be_compiled': to_be_compiled,
The Other Jimmy 31:8ea194f6145b 89 'object_files': self.resources.objects,
Anders Blomdell 47:21ae3e5a7128 90 'include_paths': list(set([ normpath(p) for p
Anders Blomdell 47:21ae3e5a7128 91 in self.resources.inc_dirs])),
The Other Jimmy 31:8ea194f6145b 92 'library_paths': self.resources.lib_dirs,
Anders Blomdell 47:21ae3e5a7128 93 'linker_script': normpath(self.resources.linker_script),
The Other Jimmy 31:8ea194f6145b 94 'libraries': libraries,
The Other Jimmy 35:da9c89f8be7d 95 'ld_sys_libs': sys_libs,
The Other Jimmy 31:8ea194f6145b 96 'hex_files': self.resources.hex_files,
The Other Jimmy 31:8ea194f6145b 97 'vpath': (["../../.."]
The Other Jimmy 31:8ea194f6145b 98 if (basename(dirname(dirname(self.export_dir)))
The Other Jimmy 31:8ea194f6145b 99 == "projectfiles")
The Other Jimmy 31:8ea194f6145b 100 else [".."]),
theotherjimmy 43:2a7da56ebd24 101 'cc_cmd': basename(self.toolchain.cc[0]),
theotherjimmy 43:2a7da56ebd24 102 'cppc_cmd': basename(self.toolchain.cppc[0]),
theotherjimmy 43:2a7da56ebd24 103 'asm_cmd': basename(self.toolchain.asm[0]),
theotherjimmy 43:2a7da56ebd24 104 'ld_cmd': basename(self.toolchain.ld[0]),
theotherjimmy 43:2a7da56ebd24 105 'elf2bin_cmd': basename(self.toolchain.elf2bin),
The Other Jimmy 31:8ea194f6145b 106 'link_script_ext': self.toolchain.LINKER_EXT,
The Other Jimmy 31:8ea194f6145b 107 'link_script_option': self.LINK_SCRIPT_OPTION,
The Other Jimmy 31:8ea194f6145b 108 'user_library_flag': self.USER_LIBRARY_FLAG,
theotherjimmy 40:7d3fa6b99b2b 109 'needs_asm_preproc': self.PREPROCESS_ASM,
theotherjimmy 43:2a7da56ebd24 110 'shell_escape': shell_escape,
The Other Jimmy 31:8ea194f6145b 111 }
The Other Jimmy 31:8ea194f6145b 112
The Other Jimmy 36:96847d42f010 113 if hasattr(self.toolchain, "preproc"):
theotherjimmy 43:2a7da56ebd24 114 ctx['pp_cmd'] = " ".join(
theotherjimmy 43:2a7da56ebd24 115 [basename(self.toolchain.preproc[0])] +
theotherjimmy 43:2a7da56ebd24 116 self.toolchain.preproc[1:] +
theotherjimmy 43:2a7da56ebd24 117 self.toolchain.ld[1:]
theotherjimmy 43:2a7da56ebd24 118 )
The Other Jimmy 36:96847d42f010 119 else:
The Other Jimmy 36:96847d42f010 120 ctx['pp_cmd'] = None
The Other Jimmy 36:96847d42f010 121
The Other Jimmy 31:8ea194f6145b 122 for key in ['include_paths', 'library_paths', 'linker_script',
The Other Jimmy 31:8ea194f6145b 123 'hex_files']:
The Other Jimmy 31:8ea194f6145b 124 if isinstance(ctx[key], list):
The Other Jimmy 31:8ea194f6145b 125 ctx[key] = [ctx['vpath'][0] + "/" + t for t in ctx[key]]
The Other Jimmy 31:8ea194f6145b 126 else:
The Other Jimmy 31:8ea194f6145b 127 ctx[key] = ctx['vpath'][0] + "/" + ctx[key]
The Other Jimmy 31:8ea194f6145b 128 if "../." not in ctx["include_paths"]:
The Other Jimmy 31:8ea194f6145b 129 ctx["include_paths"] += ['../.']
The Other Jimmy 31:8ea194f6145b 130 for key in ['include_paths', 'library_paths', 'hex_files',
The Other Jimmy 31:8ea194f6145b 131 'to_be_compiled']:
The Other Jimmy 31:8ea194f6145b 132 ctx[key] = sorted(ctx[key])
The Other Jimmy 36:96847d42f010 133 ctx.update(self.format_flags())
theotherjimmy 43:2a7da56ebd24 134 ctx['asm_flags'].extend(self.toolchain.asm[1:])
theotherjimmy 43:2a7da56ebd24 135 ctx['c_flags'].extend(self.toolchain.cc[1:])
theotherjimmy 43:2a7da56ebd24 136 ctx['cxx_flags'].extend(self.toolchain.cppc[1:])
theotherjimmy 43:2a7da56ebd24 137
theotherjimmy 43:2a7da56ebd24 138 # Add the virtual path the the include option in the ASM flags
theotherjimmy 43:2a7da56ebd24 139 new_asm_flags = []
theotherjimmy 43:2a7da56ebd24 140 for flag in ctx['asm_flags']:
theotherjimmy 43:2a7da56ebd24 141 if flag.startswith('-I'):
Anders Blomdell 47:21ae3e5a7128 142 new_asm_flags.append("-I"+
Anders Blomdell 47:21ae3e5a7128 143 normpath(join(ctx['vpath'][0],
Anders Blomdell 47:21ae3e5a7128 144 flag[2:])))
theotherjimmy 43:2a7da56ebd24 145 elif flag.startswith('--preinclude='):
theotherjimmy 43:2a7da56ebd24 146 new_asm_flags.append("--preinclude={}/{}".format(ctx['vpath'][0], flag[13:]))
theotherjimmy 43:2a7da56ebd24 147 else:
theotherjimmy 43:2a7da56ebd24 148 new_asm_flags.append(flag)
theotherjimmy 43:2a7da56ebd24 149 ctx['asm_flags'] = new_asm_flags
The Other Jimmy 31:8ea194f6145b 150
The Other Jimmy 31:8ea194f6145b 151 for templatefile in \
The Other Jimmy 31:8ea194f6145b 152 ['makefile/%s_%s.tmpl' % (self.TEMPLATE,
The Other Jimmy 31:8ea194f6145b 153 self.target.lower())] + \
The Other Jimmy 31:8ea194f6145b 154 ['makefile/%s_%s.tmpl' % (self.TEMPLATE,
The Other Jimmy 31:8ea194f6145b 155 label.lower()) for label
The Other Jimmy 31:8ea194f6145b 156 in self.toolchain.target.extra_labels] +\
The Other Jimmy 31:8ea194f6145b 157 ['makefile/%s.tmpl' % self.TEMPLATE]:
The Other Jimmy 31:8ea194f6145b 158 try:
The Other Jimmy 31:8ea194f6145b 159 self.gen_file(templatefile, ctx, 'Makefile')
The Other Jimmy 31:8ea194f6145b 160 break
The Other Jimmy 31:8ea194f6145b 161 except TemplateNotFound:
The Other Jimmy 31:8ea194f6145b 162 pass
The Other Jimmy 31:8ea194f6145b 163 else:
The Other Jimmy 31:8ea194f6145b 164 raise NotSupportedException("This make tool is in development")
The Other Jimmy 31:8ea194f6145b 165
The Other Jimmy 36:96847d42f010 166 def format_flags(self):
The Other Jimmy 36:96847d42f010 167 """Format toolchain flags for Makefile"""
The Other Jimmy 36:96847d42f010 168 flags = {}
theotherjimmy 43:2a7da56ebd24 169 for k, v in self.flags.items():
theotherjimmy 43:2a7da56ebd24 170 if k in ['c_flags', 'cxx_flags']:
The Other Jimmy 36:96847d42f010 171 flags[k] = map(lambda x: x.replace('"', '\\"'), v)
The Other Jimmy 36:96847d42f010 172 else:
The Other Jimmy 36:96847d42f010 173 flags[k] = v
The Other Jimmy 36:96847d42f010 174
The Other Jimmy 36:96847d42f010 175 return flags
The Other Jimmy 36:96847d42f010 176
The Other Jimmy 31:8ea194f6145b 177 @staticmethod
theotherjimmy 43:2a7da56ebd24 178 def clean(_):
theotherjimmy 43:2a7da56ebd24 179 remove("Makefile")
theotherjimmy 43:2a7da56ebd24 180 # legacy .build directory cleaned if exists
theotherjimmy 43:2a7da56ebd24 181 if exists('.build'):
theotherjimmy 43:2a7da56ebd24 182 shutil.rmtree('.build')
theotherjimmy 43:2a7da56ebd24 183 if exists('BUILD'):
theotherjimmy 43:2a7da56ebd24 184 shutil.rmtree('BUILD')
theotherjimmy 43:2a7da56ebd24 185
theotherjimmy 43:2a7da56ebd24 186 @staticmethod
The Other Jimmy 31:8ea194f6145b 187 def build(project_name, log_name="build_log.txt", cleanup=True):
The Other Jimmy 31:8ea194f6145b 188 """ Build Make project """
The Other Jimmy 31:8ea194f6145b 189 # > Make -j
The Other Jimmy 31:8ea194f6145b 190 cmd = ["make", "-j"]
The Other Jimmy 31:8ea194f6145b 191
The Other Jimmy 31:8ea194f6145b 192 # Build the project
The Other Jimmy 31:8ea194f6145b 193 p = Popen(cmd, stdout=PIPE, stderr=PIPE)
The Other Jimmy 31:8ea194f6145b 194 out, err = p.communicate()
The Other Jimmy 31:8ea194f6145b 195 ret_code = p.returncode
The Other Jimmy 31:8ea194f6145b 196
The Other Jimmy 31:8ea194f6145b 197 out_string = "=" * 10 + "STDOUT" + "=" * 10 + "\n"
The Other Jimmy 31:8ea194f6145b 198 out_string += out
The Other Jimmy 31:8ea194f6145b 199 out_string += "=" * 10 + "STDERR" + "=" * 10 + "\n"
The Other Jimmy 31:8ea194f6145b 200 out_string += err
The Other Jimmy 31:8ea194f6145b 201
The Other Jimmy 31:8ea194f6145b 202 if ret_code == 0:
The Other Jimmy 31:8ea194f6145b 203 out_string += "SUCCESS"
The Other Jimmy 31:8ea194f6145b 204 else:
The Other Jimmy 31:8ea194f6145b 205 out_string += "FAILURE"
The Other Jimmy 31:8ea194f6145b 206
theotherjimmy 43:2a7da56ebd24 207 print(out_string)
The Other Jimmy 31:8ea194f6145b 208
The Other Jimmy 31:8ea194f6145b 209 if log_name:
The Other Jimmy 31:8ea194f6145b 210 # Write the output to the log file
The Other Jimmy 31:8ea194f6145b 211 with open(log_name, 'w+') as f:
The Other Jimmy 31:8ea194f6145b 212 f.write(out_string)
The Other Jimmy 31:8ea194f6145b 213
The Other Jimmy 31:8ea194f6145b 214 # Cleanup the exported and built files
The Other Jimmy 31:8ea194f6145b 215 if cleanup:
The Other Jimmy 31:8ea194f6145b 216 remove(log_name)
theotherjimmy 43:2a7da56ebd24 217 Makefile.clean(project_name)
The Other Jimmy 31:8ea194f6145b 218
The Other Jimmy 31:8ea194f6145b 219 if ret_code != 0:
The Other Jimmy 31:8ea194f6145b 220 # Seems like something went wrong.
The Other Jimmy 31:8ea194f6145b 221 return -1
The Other Jimmy 31:8ea194f6145b 222 else:
The Other Jimmy 31:8ea194f6145b 223 return 0
The Other Jimmy 31:8ea194f6145b 224
The Other Jimmy 31:8ea194f6145b 225
The Other Jimmy 31:8ea194f6145b 226 class GccArm(Makefile):
The Other Jimmy 31:8ea194f6145b 227 """GCC ARM specific makefile target"""
The Other Jimmy 31:8ea194f6145b 228 NAME = 'Make-GCC-ARM'
The Other Jimmy 31:8ea194f6145b 229 TEMPLATE = 'make-gcc-arm'
The Other Jimmy 31:8ea194f6145b 230 TOOLCHAIN = "GCC_ARM"
The Other Jimmy 31:8ea194f6145b 231 LINK_SCRIPT_OPTION = "-T"
The Other Jimmy 31:8ea194f6145b 232 USER_LIBRARY_FLAG = "-L"
The Other Jimmy 31:8ea194f6145b 233
The Other Jimmy 31:8ea194f6145b 234 @staticmethod
The Other Jimmy 31:8ea194f6145b 235 def prepare_lib(libname):
theotherjimmy 40:7d3fa6b99b2b 236 if "lib" == libname[:3]:
theotherjimmy 40:7d3fa6b99b2b 237 libname = libname[3:-2]
theotherjimmy 40:7d3fa6b99b2b 238 return "-l" + libname
The Other Jimmy 31:8ea194f6145b 239
The Other Jimmy 35:da9c89f8be7d 240 @staticmethod
The Other Jimmy 35:da9c89f8be7d 241 def prepare_sys_lib(libname):
The Other Jimmy 35:da9c89f8be7d 242 return "-l" + libname
The Other Jimmy 35:da9c89f8be7d 243
The Other Jimmy 31:8ea194f6145b 244
theotherjimmy 40:7d3fa6b99b2b 245 class Arm(Makefile):
theotherjimmy 40:7d3fa6b99b2b 246 """ARM Compiler generic makefile target"""
The Other Jimmy 31:8ea194f6145b 247 LINK_SCRIPT_OPTION = "--scatter"
The Other Jimmy 31:8ea194f6145b 248 USER_LIBRARY_FLAG = "--userlibpath "
theotherjimmy 40:7d3fa6b99b2b 249 TEMPLATE = 'make-arm'
The Other Jimmy 31:8ea194f6145b 250
The Other Jimmy 31:8ea194f6145b 251 @staticmethod
The Other Jimmy 31:8ea194f6145b 252 def prepare_lib(libname):
The Other Jimmy 31:8ea194f6145b 253 return libname
The Other Jimmy 31:8ea194f6145b 254
The Other Jimmy 35:da9c89f8be7d 255 @staticmethod
The Other Jimmy 35:da9c89f8be7d 256 def prepare_sys_lib(libname):
The Other Jimmy 35:da9c89f8be7d 257 return libname
The Other Jimmy 35:da9c89f8be7d 258
theotherjimmy 40:7d3fa6b99b2b 259 def generate(self):
theotherjimmy 40:7d3fa6b99b2b 260 if self.resources.linker_script:
theotherjimmy 43:2a7da56ebd24 261 sct_file = self.resources.get_file_refs(FileType.LD_SCRIPT)[-1]
theotherjimmy 40:7d3fa6b99b2b 262 new_script = self.toolchain.correct_scatter_shebang(
theotherjimmy 43:2a7da56ebd24 263 sct_file.path, join("..", dirname(sct_file.name)))
theotherjimmy 43:2a7da56ebd24 264 if new_script is not sct_file:
theotherjimmy 43:2a7da56ebd24 265 self.resources.add_files_to_type(
theotherjimmy 43:2a7da56ebd24 266 FileType.LD_SCRIPT, [new_script])
theotherjimmy 40:7d3fa6b99b2b 267 self.generated_files.append(new_script)
theotherjimmy 40:7d3fa6b99b2b 268 return super(Arm, self).generate()
theotherjimmy 40:7d3fa6b99b2b 269
theotherjimmy 40:7d3fa6b99b2b 270 class Armc5(Arm):
theotherjimmy 40:7d3fa6b99b2b 271 """ARM Compiler 5 (armcc) specific makefile target"""
theotherjimmy 40:7d3fa6b99b2b 272 NAME = 'Make-ARMc5'
theotherjimmy 40:7d3fa6b99b2b 273 TOOLCHAIN = "ARM"
theotherjimmy 40:7d3fa6b99b2b 274 PREPROCESS_ASM = True
theotherjimmy 40:7d3fa6b99b2b 275
theotherjimmy 40:7d3fa6b99b2b 276 class Armc6(Arm):
theotherjimmy 40:7d3fa6b99b2b 277 """ARM Compiler 6 (armclang) specific generic makefile target"""
theotherjimmy 40:7d3fa6b99b2b 278 NAME = 'Make-ARMc6'
theotherjimmy 40:7d3fa6b99b2b 279 TOOLCHAIN = "ARMC6"
theotherjimmy 40:7d3fa6b99b2b 280
The Other Jimmy 31:8ea194f6145b 281
The Other Jimmy 31:8ea194f6145b 282 class IAR(Makefile):
The Other Jimmy 31:8ea194f6145b 283 """IAR specific makefile target"""
The Other Jimmy 31:8ea194f6145b 284 NAME = 'Make-IAR'
The Other Jimmy 31:8ea194f6145b 285 TEMPLATE = 'make-iar'
The Other Jimmy 31:8ea194f6145b 286 TOOLCHAIN = "IAR"
The Other Jimmy 31:8ea194f6145b 287 LINK_SCRIPT_OPTION = "--config"
The Other Jimmy 31:8ea194f6145b 288 USER_LIBRARY_FLAG = "-L"
The Other Jimmy 31:8ea194f6145b 289
The Other Jimmy 31:8ea194f6145b 290 @staticmethod
The Other Jimmy 31:8ea194f6145b 291 def prepare_lib(libname):
The Other Jimmy 31:8ea194f6145b 292 if "lib" == libname[:3]:
The Other Jimmy 31:8ea194f6145b 293 libname = libname[3:]
The Other Jimmy 31:8ea194f6145b 294 return "-l" + splitext(libname)[0]
The Other Jimmy 35:da9c89f8be7d 295
The Other Jimmy 35:da9c89f8be7d 296 @staticmethod
The Other Jimmy 35:da9c89f8be7d 297 def prepare_sys_lib(libname):
The Other Jimmy 35:da9c89f8be7d 298 if "lib" == libname[:3]:
The Other Jimmy 35:da9c89f8be7d 299 libname = libname[3:]
The Other Jimmy 35:da9c89f8be7d 300 return "-l" + splitext(libname)[0]