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
tools/export/makefile/Makefile.tmpl@0:f782d9c66c49, 2018-02-02 (annotated)
- Committer:
- dkato
- Date:
- Fri Feb 02 05:42:23 2018 +0000
- Revision:
- 0:f782d9c66c49
mbed-os for GR-LYCHEE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkato | 0:f782d9c66c49 | 1 | # This file was automagically generated by mbed.org. For more information, |
dkato | 0:f782d9c66c49 | 2 | # see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded |
dkato | 0:f782d9c66c49 | 3 | |
dkato | 0:f782d9c66c49 | 4 | ############################################################################### |
dkato | 0:f782d9c66c49 | 5 | # Boiler-plate |
dkato | 0:f782d9c66c49 | 6 | |
dkato | 0:f782d9c66c49 | 7 | # cross-platform directory manipulation |
dkato | 0:f782d9c66c49 | 8 | ifeq ($(shell echo $$OS),$$OS) |
dkato | 0:f782d9c66c49 | 9 | MAKEDIR = if not exist "$(1)" mkdir "$(1)" |
dkato | 0:f782d9c66c49 | 10 | RM = rmdir /S /Q "$(1)" |
dkato | 0:f782d9c66c49 | 11 | else |
dkato | 0:f782d9c66c49 | 12 | MAKEDIR = '$(SHELL)' -c "mkdir -p \"$(1)\"" |
dkato | 0:f782d9c66c49 | 13 | RM = '$(SHELL)' -c "rm -rf \"$(1)\"" |
dkato | 0:f782d9c66c49 | 14 | endif |
dkato | 0:f782d9c66c49 | 15 | |
dkato | 0:f782d9c66c49 | 16 | OBJDIR := BUILD |
dkato | 0:f782d9c66c49 | 17 | # Move to the build directory |
dkato | 0:f782d9c66c49 | 18 | ifeq (,$(filter $(OBJDIR),$(notdir $(CURDIR)))) |
dkato | 0:f782d9c66c49 | 19 | .SUFFIXES: |
dkato | 0:f782d9c66c49 | 20 | mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) |
dkato | 0:f782d9c66c49 | 21 | MAKETARGET = '$(MAKE)' --no-print-directory -C $(OBJDIR) -f '$(mkfile_path)' \ |
dkato | 0:f782d9c66c49 | 22 | 'SRCDIR=$(CURDIR)' $(MAKECMDGOALS) |
dkato | 0:f782d9c66c49 | 23 | .PHONY: $(OBJDIR) clean |
dkato | 0:f782d9c66c49 | 24 | all: |
dkato | 0:f782d9c66c49 | 25 | +@$(call MAKEDIR,$(OBJDIR)) |
dkato | 0:f782d9c66c49 | 26 | +@$(MAKETARGET) |
dkato | 0:f782d9c66c49 | 27 | $(OBJDIR): all |
dkato | 0:f782d9c66c49 | 28 | Makefile : ; |
dkato | 0:f782d9c66c49 | 29 | % :: $(OBJDIR) ; : |
dkato | 0:f782d9c66c49 | 30 | clean : |
dkato | 0:f782d9c66c49 | 31 | $(call RM,$(OBJDIR)) |
dkato | 0:f782d9c66c49 | 32 | {% block target_clean -%} |
dkato | 0:f782d9c66c49 | 33 | {% endblock %} |
dkato | 0:f782d9c66c49 | 34 | else |
dkato | 0:f782d9c66c49 | 35 | |
dkato | 0:f782d9c66c49 | 36 | # trick rules into thinking we are in the root, when we are in the bulid dir |
dkato | 0:f782d9c66c49 | 37 | VPATH = {{vpath|join(" ")}} |
dkato | 0:f782d9c66c49 | 38 | |
dkato | 0:f782d9c66c49 | 39 | # Boiler-plate |
dkato | 0:f782d9c66c49 | 40 | ############################################################################### |
dkato | 0:f782d9c66c49 | 41 | # Project settings |
dkato | 0:f782d9c66c49 | 42 | |
dkato | 0:f782d9c66c49 | 43 | PROJECT := {{name}} |
dkato | 0:f782d9c66c49 | 44 | |
dkato | 0:f782d9c66c49 | 45 | |
dkato | 0:f782d9c66c49 | 46 | # Project settings |
dkato | 0:f782d9c66c49 | 47 | ############################################################################### |
dkato | 0:f782d9c66c49 | 48 | # Objects and Paths |
dkato | 0:f782d9c66c49 | 49 | |
dkato | 0:f782d9c66c49 | 50 | {% for obj in to_be_compiled %}OBJECTS += {{obj}} |
dkato | 0:f782d9c66c49 | 51 | {% endfor %} |
dkato | 0:f782d9c66c49 | 52 | {% for obj in object_files %} SYS_OBJECTS += {{obj}} |
dkato | 0:f782d9c66c49 | 53 | {% endfor %} |
dkato | 0:f782d9c66c49 | 54 | {% for path in include_paths %}INCLUDE_PATHS += -I{{path}} |
dkato | 0:f782d9c66c49 | 55 | {% endfor %} |
dkato | 0:f782d9c66c49 | 56 | LIBRARY_PATHS :={% for p in library_paths %} {{user_library_flag}}{{p}} {% endfor %} |
dkato | 0:f782d9c66c49 | 57 | LIBRARIES :={% for lib in libraries %} {{lib}} {% endfor %} |
dkato | 0:f782d9c66c49 | 58 | LINKER_SCRIPT ?= {{linker_script}} |
dkato | 0:f782d9c66c49 | 59 | {%- block additional_variables -%}{% endblock %} |
dkato | 0:f782d9c66c49 | 60 | |
dkato | 0:f782d9c66c49 | 61 | # Objects and Paths |
dkato | 0:f782d9c66c49 | 62 | ############################################################################### |
dkato | 0:f782d9c66c49 | 63 | # Tools and Flags |
dkato | 0:f782d9c66c49 | 64 | |
dkato | 0:f782d9c66c49 | 65 | AS = {{asm_cmd}} |
dkato | 0:f782d9c66c49 | 66 | CC = {{cc_cmd}} |
dkato | 0:f782d9c66c49 | 67 | CPP = {{cppc_cmd}} |
dkato | 0:f782d9c66c49 | 68 | LD = {{ld_cmd}} |
dkato | 0:f782d9c66c49 | 69 | ELF2BIN = {{elf2bin_cmd}} |
dkato | 0:f782d9c66c49 | 70 | {% if pp_cmd -%} |
dkato | 0:f782d9c66c49 | 71 | PREPROC = {{pp_cmd}} |
dkato | 0:f782d9c66c49 | 72 | {%- endif %} |
dkato | 0:f782d9c66c49 | 73 | {% if hex_files %} |
dkato | 0:f782d9c66c49 | 74 | SREC_CAT = srec_cat |
dkato | 0:f782d9c66c49 | 75 | {%- endif %} |
dkato | 0:f782d9c66c49 | 76 | {%- block additional_executables -%}{%- endblock %} |
dkato | 0:f782d9c66c49 | 77 | |
dkato | 0:f782d9c66c49 | 78 | {% for flag in c_flags %}C_FLAGS += {{flag}} |
dkato | 0:f782d9c66c49 | 79 | {% endfor %} |
dkato | 0:f782d9c66c49 | 80 | {% for flag in cxx_flags %}CXX_FLAGS += {{flag}} |
dkato | 0:f782d9c66c49 | 81 | {% endfor %} |
dkato | 0:f782d9c66c49 | 82 | {% for flag in asm_flags %}ASM_FLAGS += {{flag}} |
dkato | 0:f782d9c66c49 | 83 | {% endfor %} |
dkato | 0:f782d9c66c49 | 84 | |
dkato | 0:f782d9c66c49 | 85 | LD_FLAGS :={%- block ld_flags -%} {{ld_flags|join(" ")}} {% endblock %} |
dkato | 0:f782d9c66c49 | 86 | LD_SYS_LIBS :={%- block sys_libs -%} {{ld_sys_libs|join(" ")}} {% endblock %} |
dkato | 0:f782d9c66c49 | 87 | |
dkato | 0:f782d9c66c49 | 88 | # Tools and Flags |
dkato | 0:f782d9c66c49 | 89 | ############################################################################### |
dkato | 0:f782d9c66c49 | 90 | # Rules |
dkato | 0:f782d9c66c49 | 91 | |
dkato | 0:f782d9c66c49 | 92 | .PHONY: all lst size |
dkato | 0:f782d9c66c49 | 93 | |
dkato | 0:f782d9c66c49 | 94 | {% if hex_files -%} |
dkato | 0:f782d9c66c49 | 95 | all: $(PROJECT).bin $(PROJECT)-combined.hex size |
dkato | 0:f782d9c66c49 | 96 | {% else %} |
dkato | 0:f782d9c66c49 | 97 | all: $(PROJECT).bin $(PROJECT).hex size |
dkato | 0:f782d9c66c49 | 98 | {% endif %} |
dkato | 0:f782d9c66c49 | 99 | |
dkato | 0:f782d9c66c49 | 100 | .asm.o: |
dkato | 0:f782d9c66c49 | 101 | +@$(call MAKEDIR,$(dir $@)) |
dkato | 0:f782d9c66c49 | 102 | +@echo "Assemble: $(notdir $<)" |
dkato | 0:f782d9c66c49 | 103 | @$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $< |
dkato | 0:f782d9c66c49 | 104 | |
dkato | 0:f782d9c66c49 | 105 | .s.o: |
dkato | 0:f782d9c66c49 | 106 | +@$(call MAKEDIR,$(dir $@)) |
dkato | 0:f782d9c66c49 | 107 | +@echo "Assemble: $(notdir $<)" |
dkato | 0:f782d9c66c49 | 108 | @$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $< |
dkato | 0:f782d9c66c49 | 109 | |
dkato | 0:f782d9c66c49 | 110 | .S.o: |
dkato | 0:f782d9c66c49 | 111 | +@$(call MAKEDIR,$(dir $@)) |
dkato | 0:f782d9c66c49 | 112 | +@echo "Assemble: $(notdir $<)" |
dkato | 0:f782d9c66c49 | 113 | @$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $< |
dkato | 0:f782d9c66c49 | 114 | |
dkato | 0:f782d9c66c49 | 115 | .c.o: |
dkato | 0:f782d9c66c49 | 116 | +@$(call MAKEDIR,$(dir $@)) |
dkato | 0:f782d9c66c49 | 117 | +@echo "Compile: $(notdir $<)" |
dkato | 0:f782d9c66c49 | 118 | @$(CC) $(C_FLAGS) $(INCLUDE_PATHS) -o $@ $< |
dkato | 0:f782d9c66c49 | 119 | |
dkato | 0:f782d9c66c49 | 120 | .cpp.o: |
dkato | 0:f782d9c66c49 | 121 | +@$(call MAKEDIR,$(dir $@)) |
dkato | 0:f782d9c66c49 | 122 | +@echo "Compile: $(notdir $<)" |
dkato | 0:f782d9c66c49 | 123 | @$(CPP) $(CXX_FLAGS) $(INCLUDE_PATHS) -o $@ $< |
dkato | 0:f782d9c66c49 | 124 | |
dkato | 0:f782d9c66c49 | 125 | {% if pp_cmd %} |
dkato | 0:f782d9c66c49 | 126 | $(PROJECT).link_script{{link_script_ext}}: $(LINKER_SCRIPT) |
dkato | 0:f782d9c66c49 | 127 | @$(PREPROC) $< -o $@ |
dkato | 0:f782d9c66c49 | 128 | {% endif %} |
dkato | 0:f782d9c66c49 | 129 | |
dkato | 0:f782d9c66c49 | 130 | {% block target_project_elf %} |
dkato | 0:f782d9c66c49 | 131 | $(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) {% if pp_cmd -%} $(PROJECT).link_script{{link_script_ext}} {% else%} $(LINKER_SCRIPT) {% endif %} |
dkato | 0:f782d9c66c49 | 132 | +@echo "link: $(notdir $@)" |
dkato | 0:f782d9c66c49 | 133 | @$(LD) $(LD_FLAGS) {{link_script_option}} $(filter %{{link_script_ext}}, $^) $(LIBRARY_PATHS) --output $@ $(filter %.o, $^) $(LIBRARIES) $(LD_SYS_LIBS) |
dkato | 0:f782d9c66c49 | 134 | {% endblock %} |
dkato | 0:f782d9c66c49 | 135 | |
dkato | 0:f782d9c66c49 | 136 | $(PROJECT).bin: $(PROJECT).elf |
dkato | 0:f782d9c66c49 | 137 | {%- block elf2bin -%}{%- endblock %} |
dkato | 0:f782d9c66c49 | 138 | {% if not hex_files %} +@echo "===== bin file ready to flash: $(OBJDIR)/$@ =====" {% endif %} |
dkato | 0:f782d9c66c49 | 139 | |
dkato | 0:f782d9c66c49 | 140 | $(PROJECT).hex: $(PROJECT).elf |
dkato | 0:f782d9c66c49 | 141 | {%- block elf2hex -%}{%- endblock %} |
dkato | 0:f782d9c66c49 | 142 | |
dkato | 0:f782d9c66c49 | 143 | {% if hex_files %} |
dkato | 0:f782d9c66c49 | 144 | $(PROJECT)-combined.hex: $(PROJECT).hex |
dkato | 0:f782d9c66c49 | 145 | +@echo "NOTE: the $(SREC_CAT) binary is required to be present in your PATH. Please see http://srecord.sourceforge.net/ for more information." |
dkato | 0:f782d9c66c49 | 146 | $(SREC_CAT) {% for f in hex_files %}{{f}} {% endfor %} -intel $(PROJECT).hex -intel -o $(PROJECT)-combined.hex -intel --line-length=44 |
dkato | 0:f782d9c66c49 | 147 | +@echo "===== hex file ready to flash: $(OBJDIR)/$@ =====" |
dkato | 0:f782d9c66c49 | 148 | {% endif %} |
dkato | 0:f782d9c66c49 | 149 | # Rules |
dkato | 0:f782d9c66c49 | 150 | ############################################################################### |
dkato | 0:f782d9c66c49 | 151 | # Dependencies |
dkato | 0:f782d9c66c49 | 152 | |
dkato | 0:f782d9c66c49 | 153 | DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d) |
dkato | 0:f782d9c66c49 | 154 | -include $(DEPS) |
dkato | 0:f782d9c66c49 | 155 | endif |
dkato | 0:f782d9c66c49 | 156 | |
dkato | 0:f782d9c66c49 | 157 | # Dependencies |
dkato | 0:f782d9c66c49 | 158 | ############################################################################### |
dkato | 0:f782d9c66c49 | 159 |