config.mk and bsd-compatable make

This commit is contained in:
2026-05-08 19:15:07 +07:00
parent 0971ee551e
commit daa92410a7
3 changed files with 38 additions and 9 deletions
+5 -8
View File
@@ -1,16 +1,13 @@
include config.mk
all: compile all: compile
proto: 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 $(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 ./protocols/wlr-layer-shell-unstable-v1.xml wlr-layer-shell-unstable-v1-protocol.h
compile: proto compile: proto
gcc -o absinthe src/* \ cc -o absinthe src/* $(CFLAGS) $(LDFLAGS)
-Wall -Wextra -Wpedantic \
-DXWAYLAND \
-I./ -I./include -DWLR_USE_UNSTABLE $(shell pkg-config wlroots-0.20 --libs --cflags) -lwayland-server -lxkbcommon \
-O3 \
-g
format: format:
find src/ -type f -print0 | xargs -0 clang-format -i find src/ -type f -print0 | xargs -0 clang-format -i
+29
View File
@@ -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)
+4 -1
View File
@@ -1,7 +1,6 @@
#ifndef __TYPES_H_ #ifndef __TYPES_H_
#define __TYPES_H_ #define __TYPES_H_
#include <linux/input-event-codes.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/render/allocator.h> #include <wlr/render/allocator.h>
@@ -22,6 +21,10 @@
#include <xcb/xcb_icccm.h> #include <xcb/xcb_icccm.h>
#endif #endif
#define BTN_LEFT 0x110
#define BTN_RIGHT 0x111
#define BTN_MIDDLE 0x112
#define MAX(A, B) (A) > (B) ? (A) : (B) #define MAX(A, B) (A) > (B) ? (A) : (B)
#define MIN(A, B) (A) < (B) ? (A) : (B) #define MIN(A, B) (A) < (B) ? (A) : (B)
/* macro for adding listener for event */ /* macro for adding listener for event */