-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (59 loc) · 1.66 KB
/
Makefile
File metadata and controls
75 lines (59 loc) · 1.66 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
TARGET=exec
BUILD_DIR ?= ./build
# -------------------------
FREERTOS_VERSION="V10.2.1"
FREERTOS_INCLUDE_DIRS := \
FreeRTOS/Source/include
FREERTOS_SOURCES := \
FreeRTOS/Source/croutine.c \
FreeRTOS/Source/event_groups.c\
FreeRTOS/Source/list.c\
FreeRTOS/Source/queue.c \
FreeRTOS/Source/stream_buffer.c \
FreeRTOS/Source/tasks.c \
FreeRTOS/Source/timers.c
# -------------------------
SRCS += $(FREERTOS_SOURCES)
INCLUDE_DIRS += $(FREERTOS_INCLUDE_DIRS)
# -------------------------
EXAMPLE_INCLUDE_DIRS := \
example
EXAMPLE_SOURCES := \
example/main.c
# -------------------------
SRCS += $(EXAMPLE_SOURCES)
INCLUDE_DIRS += $(EXAMPLE_INCLUDE_DIRS)
# -------------------------
PORT_INCLUDE_DIRS := \
portable/GCC/Linux/
PORT_SOURCES := \
portable/GCC/Linux/port.c\
portable/GCC/Linux/heap_4.c
# -------------------------
SRCS += $(PORT_SOURCES)
INCLUDE_DIRS += $(PORT_INCLUDE_DIRS)
LDFLAGS += -lrt -lpthread -lstdc++ -T freertos_linux.ld
CPPFLAGS += -ggdb -Wall -Wextra -Wundef -Wshadow
# Build files
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_FLAGS := $(addprefix -I,$(INCLUDE_DIRS))
$(info srcs [${INC_FLAGS}])
# Link
$(BUILD_DIR)/$(TARGET): $(OBJS)
$(CC) $(OBJS) -o $@ $(LDFLAGS)
# Build C sources
$(BUILD_DIR)/%.c.o: %.c
mkdir -p $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) $(INC_FLAGS) -c $< -o $@
# Build C++ sources
$(BUILD_DIR)/%.cpp.o: %.cpp
mkdir -p $(dir $@)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(INC_FLAGS) -c $< -o $@
.PHONY: get_freertos clean
# Checkout FreeRTOS from SVN Repository
get_freertos:
svn checkout https://svn.code.sf.net/p/freertos/code/tags/$(FREERTOS_VERSION)/FreeRTOS/Source FreeRTOS/Source
clean:
$(RM) -r $(BUILD_DIR)
-include $(DEPS)