forked from lvgl/lv_port_pc_vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (42 loc) · 1.87 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
#
# Makefile
# WARNING: relies on invocation setting current working directory to Makefile location
# This is done in .vscode/task.json
#
MAKEFLAGS := -j $(shell nproc)
SRC_EXT := c
OBJ_EXT := o
CC := gcc
SRC_DIR := ./
WORKING_DIR := ./build
BUILD_DIR := $(WORKING_DIR)/obj
BIN_DIR := $(WORKING_DIR)/bin
UI_DIR := ui
WARNINGS := -Wall -Wextra \
-Wshadow -Wundef -Wmaybe-uninitialized -Wmissing-prototypes -Wno-discarded-qualifiers \
-Wno-unused-function -Wno-error=strict-prototypes -Wpointer-arith -fno-strict-aliasing -Wno-error=cpp -Wuninitialized \
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-format-nonliteral -Wno-cast-qual -Wunreachable-code -Wno-switch-default \
-Wreturn-type -Wmultichar -Wformat-security -Wno-ignored-qualifiers -Wno-error=pedantic -Wno-sign-compare -Wno-error=missing-prototypes -Wdouble-promotion -Wclobbered -Wdeprecated \
-Wempty-body -Wshift-negative-value -Wstack-usage=2048 \
-Wtype-limits -Wsizeof-pointer-memaccess -Wpointer-arith
CFLAGS := -O0 -g $(WARNINGS)
# Add simulator define to allow modification of source
DEFINES := -D SIMULATOR=1 -D LV_BUILD_TEST=0
# Include simulator inc folder first so lv_conf.h from custom UI can be used instead
INC := -I./ui/simulator/inc/ -I./ -I./lvgl/
LDFLAGS := -lSDL2 -lm
BIN := $(BIN_DIR)/demo
COMPILE = $(CC) $(CFLAGS) $(INC) $(DEFINES)
# Automatically include all source files
SRCS := $(shell find $(SRC_DIR) -type f -name '*.c' -not -path '*/\.*')
OBJECTS := $(patsubst $(SRC_DIR)%,$(BUILD_DIR)/%,$(SRCS:.$(SRC_EXT)=.$(OBJ_EXT)))
all: default
$(BUILD_DIR)/%.$(OBJ_EXT): $(SRC_DIR)/%.$(SRC_EXT)
@echo 'Building project file: $<'
@mkdir -p $(dir $@)
@$(COMPILE) -c -o "$@" "$<"
default: $(OBJECTS)
@mkdir -p $(BIN_DIR)
$(CC) -o $(BIN) $(OBJECTS) $(LDFLAGS)
clean:
rm -rf $(WORKING_DIR)