@@ -44,7 +44,8 @@ def generate(self):
4444 self .resources .c_sources +
4545 self .resources .cpp_sources ]
4646
47- libraries = [splitext (lib )[0 ][3 :] for lib in self .resources .libraries ]
47+ libraries = [self .prepare_lib (basename (lib )) for lib
48+ in self .resources .libraries ]
4849
4950 ctx = {
5051 'name' : self .project_name ,
@@ -70,6 +71,7 @@ def generate(self):
7071 'elf2bin_cmd' : "\' " + self .toolchain .elf2bin + "\' " ,
7172 'link_script_ext' : self .toolchain .LINKER_EXT ,
7273 'link_script_option' : self .LINK_SCRIPT_OPTION ,
74+ 'user_library_flag' : self .USER_LIBRARY_FLAG ,
7375 }
7476
7577 for key in ['include_paths' , 'library_paths' , 'linker_script' ,
@@ -108,6 +110,11 @@ class GccArm(Makefile):
108110 NAME = 'Make-GCC-ARM'
109111 TOOLCHAIN = "GCC_ARM"
110112 LINK_SCRIPT_OPTION = "-T"
113+ USER_LIBRARY_FLAG = "-L"
114+
115+ @staticmethod
116+ def prepare_lib (libname ):
117+ return "-l:" + libname
111118
112119
113120class Armc5 (Makefile ):
@@ -117,6 +124,11 @@ class Armc5(Makefile):
117124 NAME = 'Make-ARMc5'
118125 TOOLCHAIN = "ARM"
119126 LINK_SCRIPT_OPTION = "--scatter"
127+ USER_LIBRARY_FLAG = "--userlibpath "
128+
129+ @staticmethod
130+ def prepare_lib (libname ):
131+ return libname
120132
121133
122134class IAR (Makefile ):
@@ -126,3 +138,10 @@ class IAR(Makefile):
126138 NAME = 'Make-IAR'
127139 TOOLCHAIN = "IAR"
128140 LINK_SCRIPT_OPTION = "--config"
141+ USER_LIBRARY_FLAG = "-L"
142+
143+ @staticmethod
144+ def prepare_lib (libname ):
145+ if "lib" == libname [:3 ]:
146+ libname = libname [3 :]
147+ return "-l" + splitext (libname )[0 ]
0 commit comments