mbed-os for GR-LYCHEE
Dependents: mbed-os-example-blinky-gr-lychee GR-Boads_Camera_sample GR-Boards_Audio_Recoder GR-Boads_Camera_DisplayApp ... more
Diff: tools/export/makefile/Makefile.tmpl
- Revision:
- 0:f782d9c66c49
diff -r 000000000000 -r f782d9c66c49 tools/export/makefile/Makefile.tmpl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/export/makefile/Makefile.tmpl Fri Feb 02 05:42:23 2018 +0000 @@ -0,0 +1,159 @@ +# 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 %} + +.asm.o: + +@$(call MAKEDIR,$(dir $@)) + +@echo "Assemble: $(notdir $<)" + @$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $< + +.s.o: + +@$(call MAKEDIR,$(dir $@)) + +@echo "Assemble: $(notdir $<)" + @$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $< + +.S.o: + +@$(call MAKEDIR,$(dir $@)) + +@echo "Assemble: $(notdir $<)" + @$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $< + +.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 %{{link_script_ext}}, $^) $(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 +############################################################################### +