1
1
# This file was automagically generated by mbed.org. For more information,
2
2
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
3
3
4
+ ifeq (,$(filter bin,$(notdir $(CURDIR))))
5
+ .SUFFIXES:
6
+ OBJDIR := bin
7
+ MAKETARGET = $(MAKE) --no-print-directory -C $@ -f $(CURDIR)/Makefile \
8
+ SRCDIR=$(CURDIR) $(MAKECMDGOALS)
9
+ .PHONY: $(OBJDIR) clean
10
+ $(OBJDIR):
11
+ +@[ -d $@ ] || mkdir -p $@
12
+ +@$(MAKETARGET)
13
+ Makefile : ;
14
+ % :: $(OBJDIR) ; :
15
+ clean :
16
+ rm -rf $(OBJDIR)
17
+ {% block target_clean -%}
18
+ {% endblock %}
19
+ else
20
+
21
+ VPATH = $(SRCDIR)
22
+
4
23
GCC_BIN =
5
24
PROJECT = {{name}}
6
25
OBJECTS = {% for f in to_be_compiled %}{{f}} {% endfor %}
7
26
SYS_OBJECTS = {% for f in object_files %}{{f}} {% endfor %}
8
- INCLUDE_PATHS = {% for p in include_paths %}-I{{p}} {% endfor %}
9
- LIBRARY_PATHS = {% for p in library_paths %}-L{{p}} {% endfor %}
27
+ INCLUDE_PATHS = {% for p in include_paths %}-I../ {{p}} {% endfor %}
28
+ LIBRARY_PATHS = {% for p in library_paths %}-L../ {{p}} {% endfor %}
10
29
LIBRARIES = {% for lib in libraries %}-l{{lib}} {% endfor %}
11
30
LINKER_SCRIPT = {{linker_script}}
12
31
{%- block additional_variables -%}{% endblock %}
49
68
CC_FLAGS += -DNDEBUG -Os
50
69
endif
51
70
52
- .PHONY: all clean lst size
71
+ .PHONY: all lst size
53
72
54
73
{% block target_all -%}
55
74
all: $(PROJECT).bin $(PROJECT).hex size
56
75
{% endblock %}
57
76
58
- {% block target_clean -%}
59
- clean:
60
- rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS)
61
- {% endblock %}
62
77
63
78
.asm.o:
79
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
64
80
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
65
81
.s.o:
82
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
66
83
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
67
84
.S.o:
85
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
68
86
$(CC) $(CPU) -c $(ASM_FLAGS) -o $@ $<
69
87
70
88
.c.o:
89
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
71
90
$(CC) $(CC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
72
91
73
92
.cpp.o:
93
+ @[ -d $(dir $@) ] || mkdir -p $(dir $@)
74
94
$(CPP) $(CPPC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ $<
75
95
76
96
77
97
{% block target_project_elf %}
78
- $(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
79
- $(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT ) $(LIBRARY_PATHS) -o $@ $^ -Wl,--start-group $(LIBRARIES) $(LD_SYS_LIBS) -Wl,--end-group
98
+ $(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(LINKER_SCRIPT)
99
+ $(LD) $(LD_FLAGS) -T$(filter %.ld, $^ ) $(LIBRARY_PATHS) -o $@ $(filter %.o, $^) -Wl,--start-group $(LIBRARIES) $(LD_SYS_LIBS) -Wl,--end-group
80
100
{% endblock %}
81
101
82
102
$(PROJECT).bin: $(PROJECT).elf
@@ -97,4 +117,5 @@ DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
97
117
-include $(DEPS)
98
118
99
119
{% block additional_targets %}{% endblock %}
120
+ endif
100
121
0 commit comments