mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Revision:
0:b74591d5ab33
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/export/makefile/Makefile.tmpl	Mon Dec 11 17:54:04 2017 +0000
@@ -0,0 +1,165 @@
+# This file was automagically generated by mbed.org. For more information, 
+# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
+
+###############################################################################
+# Boiler-plate
+
+# cross-platform directory manipulation
+ifeq ($(shell echo $$OS),$$OS)
+    MAKEDIR = if not exist "$(1)" mkdir "$(1)"
+    RM = rmdir /S /Q "$(1)"
+else
+    MAKEDIR = '$(SHELL)' -c "mkdir -p \"$(1)\""
+    RM = '$(SHELL)' -c "rm -rf \"$(1)\""
+endif
+
+OBJDIR := BUILD
+# Move to the build directory
+ifeq (,$(filter $(OBJDIR),$(notdir $(CURDIR))))
+.SUFFIXES:
+mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
+MAKETARGET = '$(MAKE)' --no-print-directory -C $(OBJDIR) -f '$(mkfile_path)' \
+		'SRCDIR=$(CURDIR)' $(MAKECMDGOALS)
+.PHONY: $(OBJDIR) clean
+all:
+	+@$(call MAKEDIR,$(OBJDIR))
+	+@$(MAKETARGET)
+$(OBJDIR): all
+Makefile : ;
+% :: $(OBJDIR) ; :
+clean :
+	$(call RM,$(OBJDIR))
+{% block target_clean -%}
+{% endblock %}
+else
+
+# trick rules into thinking we are in the root, when we are in the bulid dir
+VPATH = {{vpath|join(" ")}}
+
+# Boiler-plate
+###############################################################################
+# Project settings
+
+PROJECT := {{name}}
+
+
+# Project settings
+###############################################################################
+# Objects and Paths
+
+{% for obj in to_be_compiled %}OBJECTS += {{obj}}
+{% endfor %}
+{% for obj in object_files %} SYS_OBJECTS += {{obj}}
+{% endfor %}
+{% for path in include_paths %}INCLUDE_PATHS += -I{{path}}
+{% endfor %}
+LIBRARY_PATHS :={% for p in library_paths %} {{user_library_flag}}{{p}} {% endfor %}
+LIBRARIES :={% for lib in libraries %} {{lib}} {% endfor %}
+LINKER_SCRIPT ?= {{linker_script}}
+{%- block additional_variables -%}{% endblock %}
+
+# Objects and Paths
+###############################################################################
+# Tools and Flags
+
+AS      = {{asm_cmd}}
+CC      = {{cc_cmd}}
+CPP     = {{cppc_cmd}}
+LD      = {{ld_cmd}}
+ELF2BIN = {{elf2bin_cmd}}
+{% if pp_cmd -%}
+PREPROC = {{pp_cmd}}
+{%- endif %}
+{% if hex_files %}
+SREC_CAT = srec_cat
+{%- endif %}
+{%- block additional_executables -%}{%- endblock %}
+
+{% for flag in c_flags %}C_FLAGS += {{flag}}
+{% endfor %}
+{% for flag in cxx_flags %}CXX_FLAGS += {{flag}}
+{% endfor %}
+{% for flag in asm_flags %}ASM_FLAGS += {{flag}}
+{% endfor %}
+
+LD_FLAGS :={%- block ld_flags -%} {{ld_flags|join(" ")}} {% endblock %}
+LD_SYS_LIBS :={%- block sys_libs -%} {{ld_sys_libs|join(" ")}} {% endblock %}
+
+# Tools and Flags
+###############################################################################
+# Rules
+
+.PHONY: all lst size
+
+{% if hex_files -%}
+all: $(PROJECT).bin $(PROJECT)-combined.hex size
+{% else %}
+all: $(PROJECT).bin $(PROJECT).hex size
+{% endif %}
+
+.s.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Assemble: $(notdir $<)"
+  {% if needs_asm_preproc %}
+	@$(AS) -c $(ASM_FLAGS) -E -o $(@:.o=.E.s) $<
+	@$(AS) -c $(ASM_FLAGS) -o $@ $(@:.o=.E.s)
+  {% else %}
+	@$(AS) -c $(ASM_FLAGS) -o $@ $<
+  {% endif %}
+
+
+.S.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Assemble: $(notdir $<)"
+  {% if needs_asm_preproc %}
+	@$(AS) -c $(ASM_FLAGS) -E -o $(@:.o=.E.s) $<
+	@$(AS) -c $(ASM_FLAGS) -o $@ $(@:.o=.E.s)
+  {% else %}
+	@$(AS) -c $(ASM_FLAGS) -o $@ $<
+  {% endif %}
+
+.c.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Compile: $(notdir $<)"
+	@$(CC) $(C_FLAGS) $(INCLUDE_PATHS) -o $@ $<
+
+.cpp.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Compile: $(notdir $<)"
+	@$(CPP) $(CXX_FLAGS) $(INCLUDE_PATHS) -o $@ $<
+
+{% if pp_cmd %}
+$(PROJECT).link_script{{link_script_ext}}: $(LINKER_SCRIPT)
+	@$(PREPROC) $< -o $@
+{% endif %}
+
+{% block target_project_elf %}
+$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) {% if pp_cmd -%} $(PROJECT).link_script{{link_script_ext}} {% else%} $(LINKER_SCRIPT) {% endif %}
+	+@echo "link: $(notdir $@)"
+	@$(LD) $(LD_FLAGS) {{link_script_option}} $(filter-out %.o, $^) $(LIBRARY_PATHS) --output $@ $(filter %.o, $^) $(LIBRARIES) $(LD_SYS_LIBS)
+{% endblock %}
+
+$(PROJECT).bin: $(PROJECT).elf
+{%- block elf2bin -%}{%- endblock %}
+{% if not hex_files %}	+@echo "===== bin file ready to flash: $(OBJDIR)/$@ =====" {% endif %}
+
+$(PROJECT).hex: $(PROJECT).elf
+{%- block elf2hex -%}{%- endblock %}
+
+{% if hex_files %}
+$(PROJECT)-combined.hex: $(PROJECT).hex
+	+@echo "NOTE: the $(SREC_CAT) binary is required to be present in your PATH. Please see http://srecord.sourceforge.net/ for more information."
+	$(SREC_CAT) {% for f in hex_files %}{{f}} {% endfor %} -intel $(PROJECT).hex -intel -o $(PROJECT)-combined.hex -intel --line-length=44
+	+@echo "===== hex file ready to flash: $(OBJDIR)/$@ ====="
+{% endif %}
+# Rules
+###############################################################################
+# Dependencies
+
+DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
+-include $(DEPS)
+endif
+
+# Dependencies
+###############################################################################
+