-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (43 loc) · 1.06 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
TARGET = app
BUILDDIR = build
CXXFLAGS += -mthumb
CXXFLAGS += -mcpu=cortex-m7
CXXFLAGS += -mfloat-abi=hard
CXXFLAGS += -mfpu=fpv5-d16
CXXFLAGS += -O2
CXXFLAGS += -g
CXXFLAGS += -Wall
CXXFLAGS += -flto
CXXFLAGS += -ffunction-sections
CXXFLAGS += -fdata-sections
CXXFLAGS += -fno-exceptions
CXXFLAGS += -fno-rtti
CXXFLAGS += -Ideps
CXXFLAGS += -MMD
LFLAGS += -L.
LFLAGS += -T STM32F767ZITx_FLASH.ld
# LFLAGS += --specs=rdimon.specs
LFLAGS += --specs=nosys.specs
LFLAGS += -fno-exceptions
LFLAGS += -Wl,--gc-sections
LFLAGS += -Wl,-Map=$(BUILDDIR)/$(TARGET).map
CXX = arm-none-eabi-g++
SRCS += main.cpp
SRCS += deps/system_stm32f7xx.cpp
SRCS += startup_stm32f767xx.s
OBJS = $(addsuffix .o,$(addprefix $(BUILDDIR)/,$(SRCS)))
DEPS = $(OBJS:.o=.d)
$(BUILDDIR)/$(TARGET).elf: $(OBJS)
$(CXX) $(CXXFLAGS) $^ $(LFLAGS) -o $@
$(BUILDDIR)/%.cpp.o : %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
$(BUILDDIR)/%.s.o : %.s
$(CXX) $(CXXFLAGS) -c $< -o $@
$(OBJS): | $(BUILDDIR)
$(BUILDDIR):
mkdir -p $@
mkdir -p $(sort $(dir $(OBJS)))
.PHONY: clean
clean:
rm -rf $(BUILDDIR)
-include $(DEPS)