# # Makefile # CC ?= gcc 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) LDFLAGS ?= -lm BIN = main BUILD_DIR = ./build BUILD_OBJ_DIR = $(BUILD_DIR)/obj BUILD_BIN_DIR = $(BUILD_DIR)/bin prefix ?= /usr bindir ?= $(prefix)/bin #Collect the files to compile MAINSRC = ./main.c include $(LVGL_DIR)/lvgl/lvgl.mk CSRCS +=$(LVGL_DIR)/mouse_cursor_icon.c OBJEXT ?= .o AOBJS = $(ASRCS:.S=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT)) MAINOBJ = $(MAINSRC:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(MAINSRC) OBJS = $(AOBJS) $(COBJS) $(MAINOBJ) TARGET = $(addprefix $(BUILD_OBJ_DIR)/, $(patsubst ./%, %, $(OBJS))) ## MAINOBJ -> OBJFILES all: default $(BUILD_OBJ_DIR)/%.o: %.c @mkdir -p $(dir $@) @$(CC) $(CFLAGS) -c $< -o $@ @echo "CC $<" $(BUILD_OBJ_DIR)/%.o: %.S @mkdir -p $(dir $@) @$(CC) $(CFLAGS) -c $< -o $@ @echo "CC $<" default: $(TARGET) @mkdir -p $(dir $(BUILD_BIN_DIR)/) $(CC) -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))