mirror of https://github.com/ARMmbed/mbed-os.git
rework the common template to place objects into bin
parent
c988ce178d
commit
86585197da
|
@ -1,12 +1,31 @@
|
||||||
# This file was automagically generated by mbed.org. For more information,
|
# This file was automagically generated by mbed.org. For more information,
|
||||||
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
|
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
|
||||||
|
|
||||||
|
ifeq (,$(filter bin,$(notdir $(CURDIR))))
|
||||||
|
.SUFFIXES:
|
||||||
|
OBJDIR := bin
|
||||||
|
MAKETARGET = $(MAKE) --no-print-directory -C $@ -f $(CURDIR)/Makefile \
|
||||||
|
SRCDIR=$(CURDIR) $(MAKECMDGOALS)
|
||||||
|
.PHONY: $(OBJDIR) clean
|
||||||
|
$(OBJDIR):
|
||||||
|
+@[ -d $@ ] || mkdir -p $@
|
||||||
|
+@$(MAKETARGET)
|
||||||
|
Makefile : ;
|
||||||
|
% :: $(OBJDIR) ; :
|
||||||
|
clean :
|
||||||
|
rm -rf $(OBJDIR)
|
||||||
|
{% block target_clean -%}
|
||||||
|
{% endblock %}
|
||||||
|
else
|
||||||
|
|
||||||
|
VPATH = $(SRCDIR)
|
||||||
|
|
||||||
GCC_BIN =
|
GCC_BIN =
|
||||||
PROJECT = {{name}}
|
PROJECT = {{name}}
|
||||||
OBJECTS = {% for f in to_be_compiled %}{{f}} {% endfor %}
|
OBJECTS = {% for f in to_be_compiled %}{{f}} {% endfor %}
|
||||||
SYS_OBJECTS = {% for f in object_files %}{{f}} {% endfor %}
|
SYS_OBJECTS = {% for f in object_files %}{{f}} {% endfor %}
|
||||||
INCLUDE_PATHS = {% for p in include_paths %}-I{{p}} {% endfor %}
|
INCLUDE_PATHS = {% for p in include_paths %}-I../{{p}} {% endfor %}
|
||||||
LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
|
LIBRARY_PATHS = {% for p in library_paths %}-L../{{p}} {% endfor %}
|
||||||
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
|
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
|
||||||
LINKER_SCRIPT = {{linker_script}}
|
LINKER_SCRIPT = {{linker_script}}
|
||||||
{%- block additional_variables -%}{% endblock %}
|
{%- block additional_variables -%}{% endblock %}
|
||||||
|
@ -49,34 +68,35 @@ else
|
||||||
CC_FLAGS += -DNDEBUG -Os
|
CC_FLAGS += -DNDEBUG -Os
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: all clean lst size
|
.PHONY: all lst size
|
||||||
|
|
||||||
{% block target_all -%}
|
{% block target_all -%}
|
||||||
all: $(PROJECT).bin $(PROJECT).hex size
|
all: $(PROJECT).bin $(PROJECT).hex size
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block target_clean -%}
|
|
||||||
clean:
|
|
||||||
rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS)
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
.asm.o:
|
.asm.o:
|
||||||
|
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
|
||||||
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
|
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
|
||||||
.s.o:
|
.s.o:
|
||||||
|
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
|
||||||
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
|
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
|
||||||
.S.o:
|
.S.o:
|
||||||
|
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
|
||||||
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
|
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
|
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
|
||||||
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
||||||
|
|
||||||
.cpp.o:
|
.cpp.o:
|
||||||
|
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
|
||||||
$(CPP) $(CPPC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
$(CPP) $(CPPC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
|
||||||
|
|
||||||
|
|
||||||
{% block target_project_elf %}
|
{% block target_project_elf %}
|
||||||
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
|
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(LINKER_SCRIPT)
|
||||||
$(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ -Wl,--start-group $(LIBRARIES) $(LD_SYS_LIBS) -Wl,--end-group
|
$(LD) $(LD_FLAGS) -T$(filter %.ld, $^) $(LIBRARY_PATHS) -o $@ $(filter %.o, $^) -Wl,--start-group $(LIBRARIES) $(LD_SYS_LIBS) -Wl,--end-group
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
$(PROJECT).bin: $(PROJECT).elf
|
$(PROJECT).bin: $(PROJECT).elf
|
||||||
|
@ -97,4 +117,5 @@ DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
|
||||||
{% block additional_targets %}{% endblock %}
|
{% block additional_targets %}{% endblock %}
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
"""
|
"""
|
||||||
from exporters import Exporter
|
from exporters import Exporter
|
||||||
from os.path import splitext, basename
|
from os.path import splitext, basename
|
||||||
|
from os import curdir
|
||||||
|
|
||||||
|
|
||||||
class GccArm(Exporter):
|
class GccArm(Exporter):
|
||||||
|
@ -128,6 +129,7 @@ class GccArm(Exporter):
|
||||||
def generate(self):
|
def generate(self):
|
||||||
# "make" wants Unix paths
|
# "make" wants Unix paths
|
||||||
self.resources.win_to_unix()
|
self.resources.win_to_unix()
|
||||||
|
self.resources.relative_to(curdir)
|
||||||
|
|
||||||
to_be_compiled = []
|
to_be_compiled = []
|
||||||
for r_type in ['s_sources', 'c_sources', 'cpp_sources']:
|
for r_type in ['s_sources', 'c_sources', 'cpp_sources']:
|
||||||
|
|
Loading…
Reference in New Issue