forked from lvgl/lv_port_linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (60 loc) · 2.61 KB
/
Makefile
File metadata and controls
79 lines (60 loc) · 2.61 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
75
76
77
78
#
# Makefile
#
CROSS_COMPILE ?= arm-none-linux-gnueabihf-
SYSROOT ?= /home/parallels/lukkey_aarch64_sysroot
CC := $(CROSS_COMPILE)gcc
CXX := $(CROSS_COMPILE)g++
LVGL_DIR_NAME ?= lvgl
LVGL_DIR ?= .
WARNINGS := -Wall -Wshadow -Wundef -Wmissing-prototypes -Wno-discarded-qualifiers -Wextra -Wno-unused-function -Wno-error=strict-prototypes -Wpointer-arith \
-fno-strict-aliasing -Wno-error=cpp -Wuninitialized -Wmaybe-uninitialized -Wno-unused-parameter -Wno-missing-field-initializers -Wtype-limits \
-Wsizeof-pointer-memaccess -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 -Wno-unused-value -std=gnu99
CFLAGS ?= -O3 -g0 -I$(LVGL_DIR)/ $(WARNINGS)
CFLAGS += --sysroot=$(SYSROOT) -I$(SYSROOT)/usr/include -I$(SYSROOT)/usr/include/drm \
-mcpu=cortex-a7 -mfpu=neon -mfloat-abi=hard -ffast-math
LDFLAGS ?= -lm
LDFLAGS += --sysroot=$(SYSROOT) -L$(SYSROOT)/usr/lib -ldrm -lpthread
BIN = lvgl_v95
BUILD_DIR = ./build
BUILD_OBJ_DIR = $(BUILD_DIR)/obj
BUILD_BIN_DIR = $(BUILD_DIR)/bin
prefix ?= /usr
bindir ?= $(prefix)/bin
# Collect source files recursively
CSRCS := $(shell find src -type f -name '*.c')
CXXSRCS := $(shell find src -type f -name '*.cpp')
# Include LVGL sources
include $(LVGL_DIR)/lvgl/lvgl.mk
OBJEXT ?= .o
COBJS = $(CSRCS:.c=$(OBJEXT))
CXXOBJS = $(CXXSRCS:.cpp=$(OBJEXT))
AOBJS = $(ASRCS:.S=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
TARGET = $(addprefix $(BUILD_OBJ_DIR)/, $(patsubst ./%, %, $(OBJS)))
all: default
$(BUILD_OBJ_DIR)/%.o: %.c lv_conf.h
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c $< -o $@
@echo "CC $<"
$(BUILD_OBJ_DIR)/%.o: %.cpp lv_conf.h
@mkdir -p $(dir $@)
@$(CXX) $(CFLAGS) -c $< -o $@
@echo "CXX $<"
$(BUILD_OBJ_DIR)/%.o: %.S lv_conf.h
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c $< -o $@
@echo "AS $<"
default: $(TARGET)
@mkdir -p $(dir $(BUILD_BIN_DIR)/)
$(CXX) -o $(BUILD_BIN_DIR)/$(BIN) $(TARGET) $(LDFLAGS)
clean:
rm -rf $(BUILD_DIR)
install:
install -d $(DESTDIR)$(bindir)
install $(BUILD_BIN_DIR)/$(BIN) $(DESTDIR)$(bindir)
uninstall:
$(RM) -r $(addprefix $(DESTDIR)$(bindir)/,$(BIN))