2024-05-13 15:31:58 +00:00
|
|
|
# Makefile
|
|
|
|
#
|
|
|
|
# Copyright (C) 2020 Michel Pollet <buserror@gmail.com>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: MIT
|
2024-01-20 12:05:26 +00:00
|
|
|
|
|
|
|
CC = gcc
|
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
LIBMUI =
|
|
|
|
MUI_SRC := $(wildcard $(LIBMUI)src/*.c)
|
2024-01-20 12:05:26 +00:00
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
vpath %.c $(LIBMUI)src $(LIBMUI)mui_shell
|
2024-01-20 12:05:26 +00:00
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
# this is just so we compile the tests if not a submodule
|
|
|
|
IS_SUBMODULE := ${wildcard ../ui_gl/mii_mui.h}
|
2024-01-20 12:05:26 +00:00
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
all : static mui_shell
|
2024-01-20 12:05:26 +00:00
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
include $(LIBMUI)Makefile.common
|
|
|
|
|
|
|
|
ifeq ($(IS_SUBMODULE),)
|
|
|
|
all : tests
|
2024-01-20 12:05:26 +00:00
|
|
|
endif
|
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
MUI_OBJ := ${patsubst %, $(OBJ)/%, ${notdir ${MUI_SRC:.c=.o}}}
|
|
|
|
TARGET_LIB := $(LIB)/libmui.a
|
|
|
|
|
|
|
|
.PHONY : mui_shell static tests
|
|
|
|
mui_shell : $(BIN)/mui_shell
|
|
|
|
static : $(TARGET_LIB)
|
|
|
|
tests : | $(TARGET_LIB)
|
|
|
|
$(MAKE) -j -C tests
|
|
|
|
@echo " ** To launch the demo, run "
|
|
|
|
@echo " $(BIN)/mui_shell -f $(LIB)/mui_widgets_demo.so"
|
|
|
|
|
2024-01-20 12:05:26 +00:00
|
|
|
$(TARGET_LIB) : $(MUI_OBJ) | $(LIB)
|
|
|
|
@echo " AR $@"
|
|
|
|
$(Q)$(AR) rcs $@ $^
|
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
#
|
|
|
|
# The shell program is used to test the UI library using plugins
|
|
|
|
# It is made using XCB and XKB libraries to have a minimal dependency
|
|
|
|
# on X11. Also, allows partial updates to be tested properly
|
|
|
|
#
|
|
|
|
$(OBJ)/mui_shell.o : CPPFLAGS += -DUI_HAS_XCB=1 -DUI_HAS_XKB=1
|
|
|
|
ifeq ($(shell uname),NetBSD)
|
|
|
|
# NetBSD requirements
|
|
|
|
$(OBJ)/mui_shell.o : CPPFLAGS += $(shell pkg-config --cflags xorg-server xkbcommon)
|
|
|
|
$(BIN)/mui_shell : LDLIBS += $(shell pkg-config --libs xorg-server)
|
|
|
|
endif
|
2024-01-20 12:05:26 +00:00
|
|
|
|
2024-05-13 15:31:58 +00:00
|
|
|
$(BIN)/mui_shell : LDLIBS += $(shell pkg-config --libs \
|
|
|
|
xcb xcb-shm xcb-image \
|
|
|
|
xkbcommon xkbcommon-x11)
|
|
|
|
$(BIN)/mui_shell : LDLIBS += -lm
|
|
|
|
ifeq ($(shell uname),Linux)
|
|
|
|
$(BIN)/mui_shell : LDLIBS += -ldl
|
|
|
|
endif
|
|
|
|
$(BIN)/mui_shell : $(OBJ)/mui_shell.o $(LIB)/libmui.a
|
2024-01-20 12:05:26 +00:00
|
|
|
|
|
|
|
clean :
|
|
|
|
rm -rf $(O)
|
|
|
|
|
|
|
|
# This is for development purpose. This will recompile the project
|
|
|
|
# everytime a file is modified.
|
|
|
|
watch :
|
|
|
|
while true; do \
|
2024-05-13 15:31:58 +00:00
|
|
|
clear; $(MAKE) -j all tests; \
|
|
|
|
inotifywait -qre close_write src mui_shell tests/* ../ui_gl; \
|
2024-01-20 12:05:26 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
compile_commands.json: lsp
|
|
|
|
lsp:
|
2024-05-13 15:31:58 +00:00
|
|
|
{ $$(which gmake) CC=gcc V=1 --always-make --dry-run all tests ; } | \
|
2024-01-20 12:05:26 +00:00
|
|
|
sh ../utils/clangd_gen.sh >compile_commands.json
|
|
|
|
|
|
|
|
-include $(OBJ)/*.d
|