Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

tools/export/makefile/Makefile.tmpl

Committer:
switches
Date:
2016-11-11
Revision:
0:5c4d7b2438d3

File content as of revision 0:5c4d7b2438d3:

# 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

# Move to the build directory
ifeq (,$(filter .build,$(notdir $(CURDIR))))
.SUFFIXES:
OBJDIR := .build
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 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 %}
{% block sys_libs -%}{%- 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 $@ $<

{% block target_project_elf %}
$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(LINKER_SCRIPT)
	+@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 %}

$(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
{% endif %}
# Rules
###############################################################################
# Dependencies

DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
-include $(DEPS)
endif

# Dependencies
###############################################################################