Skip to content

Commit 7e18cc5

Browse files
authored
Merge pull request #9596 from vmedcy/make-cmd-files
Implement Linker command/response files in make export
2 parents 09db995 + 6918e6a commit 7e18cc5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tools/export/makefile/Makefile.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ $(PROJECT).link_script{{link_script_ext}}: $(LINKER_SCRIPT)
135135

136136
{% block target_project_elf %}
137137
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) {% if pp_cmd -%} $(PROJECT).link_script{{link_script_ext}} {% else%} $(LINKER_SCRIPT) {% endif %}
138+
+@echo "$(filter %.o, $^)" > .link_options.txt
138139
+@echo "link: $(notdir $@)"
139-
@$(LD) $(LD_FLAGS) {{link_script_option}} $(filter-out %.o, $^) $(LIBRARY_PATHS) --output $@ $(filter %.o, $^) $(LIBRARIES) $(LD_SYS_LIBS)
140+
@$(LD) $(LD_FLAGS) {{link_script_option}} $(filter-out %.o, $^) $(LIBRARY_PATHS) --output $@ {{response_option}}.link_options.txt $(LIBRARIES) $(LD_SYS_LIBS)
140141
{% endblock %}
141142

142143
$(PROJECT).bin: $(PROJECT).elf

tools/export/makefile/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def generate(self):
113113
'user_library_flag': self.USER_LIBRARY_FLAG,
114114
'needs_asm_preproc': self.PREPROCESS_ASM,
115115
'shell_escape': shell_escape,
116+
'response_option': self.RESPONSE_OPTION,
116117
}
117118

118119
if hasattr(self.toolchain, "preproc"):
@@ -233,6 +234,7 @@ class GccArm(Makefile):
233234
TOOLCHAIN = "GCC_ARM"
234235
LINK_SCRIPT_OPTION = "-T"
235236
USER_LIBRARY_FLAG = "-L"
237+
RESPONSE_OPTION = "@"
236238

237239
@staticmethod
238240
def prepare_lib(libname):
@@ -250,6 +252,7 @@ class Arm(Makefile):
250252
LINK_SCRIPT_OPTION = "--scatter"
251253
USER_LIBRARY_FLAG = "--userlibpath "
252254
TEMPLATE = 'make-arm'
255+
RESPONSE_OPTION = "--via "
253256

254257
@staticmethod
255258
def prepare_lib(libname):
@@ -289,6 +292,7 @@ class IAR(Makefile):
289292
TOOLCHAIN = "IAR"
290293
LINK_SCRIPT_OPTION = "--config"
291294
USER_LIBRARY_FLAG = "-L"
295+
RESPONSE_OPTION = "-f "
292296

293297
@staticmethod
294298
def prepare_lib(libname):

0 commit comments

Comments
 (0)