the x11 driver has been added to the lv_library repository. Now both variants (SDL/X11) can be selected in the Makefile. Additional fixes here have been applied. select X11 by default
71 lines
2.4 KiB
Makefile
71 lines
2.4 KiB
Makefile
#
|
|
# Makefile
|
|
# WARNING: relies on invocation setting current working directory to Makefile location
|
|
# This is done in .vscode/task.json
|
|
#
|
|
|
|
# select underlaying LCGL display driver (SDL2 || X11)
|
|
LV_DRIVER := X11
|
|
#LV_DRIVER := SDL2
|
|
|
|
PROJECT ?= lvgl-demo
|
|
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)
|
|
|
|
# simulator library define
|
|
ifeq "$(LV_DRIVER)" "SDL2"
|
|
LV_DRIVER_USE := USE_SDL
|
|
else
|
|
LV_DRIVER_USE := USE_$(LV_DRIVER)
|
|
endif
|
|
|
|
# Add simulator defines to allow modification of source
|
|
DEFINES := -D SIMULATOR=1 -D LV_BUILD_TEST=0 -D $(LV_DRIVER_USE)
|
|
|
|
# Include simulator inc folder first so lv_conf.h from custom UI can be used instead
|
|
INC := -I./ui/simulator/inc/ -I./ -I./lvgl/ #-I/usr/include/freetype2 -L/usr/local/lib
|
|
LDLIBS := -l$(LV_DRIVER) -lpthread -lm #-lfreetype -lavformat -lavcodec -lavutil -lswscale -lm -lz
|
|
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: $(BIN)
|
|
|
|
$(BUILD_DIR)/%.$(OBJ_EXT): $(SRC_DIR)/%.$(SRC_EXT) lv_demo_conf.h lv_conf.h Makefile
|
|
@echo 'Building project file: $<'
|
|
@mkdir -p $(dir $@)
|
|
@$(COMPILE) -c -o "$@" "$<"
|
|
|
|
$(BIN): $(OBJECTS)
|
|
@mkdir -p $(BIN_DIR)
|
|
$(CC) -o $(BIN) $(OBJECTS) $(LDFLAGS) ${LDLIBS}
|
|
|
|
clean:
|
|
rm -rf $(WORKING_DIR)
|
|
|
|
install: ${BIN}
|
|
install -d ${DESTDIR}/usr/lib/${PROJECT}/bin
|
|
install $< ${DESTDIR}/usr/lib/${PROJECT}/bin/
|