From daa92410a756d492bd1a443f2f7e0231f84501a1 Mon Sep 17 00:00:00 2001 From: speckitor Date: Fri, 8 May 2026 19:15:07 +0700 Subject: [PATCH] config.mk and bsd-compatable make --- Makefile | 13 +++++-------- config.mk | 29 +++++++++++++++++++++++++++++ include/types.h | 5 ++++- 3 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 config.mk diff --git a/Makefile b/Makefile index 887b9d1..c418a9a 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,13 @@ +include config.mk + all: compile proto: - wayland-scanner server-header $(shell pkg-config --variable=pkgdatadir wayland-protocols)/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.h - wayland-scanner server-header ./protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h + $(WAYLAND_SCANNER) server-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml xdg-shell-protocol.h + $(WAYLAND_SCANNER) server-header ./protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h compile: proto - gcc -o absinthe src/* \ - -Wall -Wextra -Wpedantic \ - -DXWAYLAND \ - -I./ -I./include -DWLR_USE_UNSTABLE $(shell pkg-config wlroots-0.20 --libs --cflags) -lwayland-server -lxkbcommon \ - -O3 \ - -g + cc -o absinthe src/* $(CFLAGS) $(LDFLAGS) format: find src/ -type f -print0 | xargs -0 clang-format -i diff --git a/config.mk b/config.mk new file mode 100644 index 0000000..1d6268e --- /dev/null +++ b/config.mk @@ -0,0 +1,29 @@ +XWAYLAND = -DXWAYLAND +XLIBS = xcb xcb-icccm + +# tools +PKG_CONFIG ?= pkg-config +CC ?= clang +CLANG_FORMAT=clang-format22 + +PKGS = wayland-server xkbcommon libinput $(XLIBS) + +PKG_CFLAGS != $(PKG_CONFIG) --cflags $(PKGS) +PKG_LDFLAGS != $(PKG_CONFIG) --libs $(PKGS) + +WAYLAND_SCANNER != $(PKG_CONFIG) --variable=wayland_scanner wayland-scanner +WAYLAND_PROTOCOLS != $(PKG_CONFIG) --variable=pkgdatadir wayland-protocols + +WLR_CFLAGS != $(PKG_CONFIG) --cflags wlroots-0.20 +WLR_LDFLAGS != $(PKG_CONFIG) --libs wlroots-0.20 + +DEVFLAGS = -g + +CPPFLAGS += $(XWAYLAND) -DWLR_USE_UNSTABLE -I. -I./include + +CFLAGS += -O2 -march=native -Wall -Wextra -Wpedantic +CFLAGS += $(PKG_CFLAGS) $(WLR_CFLAGS) +CFLAGS += $(CPPFLAGS) +CFLAGS += $(DEVFLAGS) + +LDFLAGS += $(PKG_LDFLAGS) $(WLR_LDFLAGS) diff --git a/include/types.h b/include/types.h index facf0f5..e492a55 100644 --- a/include/types.h +++ b/include/types.h @@ -1,7 +1,6 @@ #ifndef __TYPES_H_ #define __TYPES_H_ -#include #include #include #include @@ -22,6 +21,10 @@ #include #endif +#define BTN_LEFT 0x110 +#define BTN_RIGHT 0x111 +#define BTN_MIDDLE 0x112 + #define MAX(A, B) (A) > (B) ? (A) : (B) #define MIN(A, B) (A) < (B) ? (A) : (B) /* macro for adding listener for event */