-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
83 lines (70 loc) · 2.08 KB
/
Copy pathMakefile
File metadata and controls
83 lines (70 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Makefile for axctl -- Universal IPC daemon for Wayland compositors
#
# Dependencies:
# - libjson-c-dev (JSON parsing)
# - libwayland-dev (Wayland client for Mango backend + idle manager)
#
# Usage:
# make -- Build axctl binary
# make clean -- Remove build artifacts
# make install -- Install to /usr/local/bin
CC ?= gcc
CFLAGS := -Wall -Wextra -Wno-unused-parameter -std=c11 -D_GNU_SOURCE \
-Iinclude \
$(shell pkg-config --cflags json-c wayland-client 2>/dev/null)
LDFLAGS := $(shell pkg-config --libs json-c wayland-client 2>/dev/null) \
-lpthread
# Source files
SRCS := \
src/main.c \
src/utils/log.c \
src/utils/strutil.c \
src/utils/json_helpers.c \
src/ipc/errors.c \
src/ipc/types.c \
src/ipc/colors.c \
src/ipc/cache.c \
src/ipc/config_types.c \
src/ipc/compositor.c \
src/ipc/hyprland/client.c \
src/ipc/hyprland/generator.c \
src/ipc/niri/client.c \
src/ipc/niri/generator.c \
src/ipc/mango/client.c \
src/ipc/mango/generator.c \
src/ipc/wayland/wayland_client.c \
src/protocols/ext-idle-notify-v1-protocol.c \
src/protocols/idle-inhibit-unstable-v1-protocol.c \
src/server/server.c \
src/server/idle.c \
src/server/config_handler.c \
src/config/config.c
OBJDIR := build
OBJS := $(patsubst src/%.c,$(OBJDIR)/%.o,$(SRCS))
TARGET := axctl
.PHONY: all clean install test
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(LDFLAGS)
@echo "Build complete: $(TARGET)"
$(OBJDIR)/%.o: src/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c -o $@ $<
TEST_SRCS := test/test_axctl.c
TEST_OBJS := \
src/utils/strutil.o \
src/utils/json_helpers.o \
src/ipc/types.o \
src/ipc/errors.o \
src/ipc/cache.o
$(OBJDIR)/test_axctl: $(TEST_SRCS) $(TEST_OBJS)
@mkdir -p $(OBJDIR)
$(CC) -o $@ $(TEST_SRCS) $(TEST_OBJS) $(LDFLAGS) -Iinclude
test: $(OBJDIR)/test_axctl
@echo "Running tests..."
@./$(OBJDIR)/test_axctl
clean:
rm -rf $(OBJDIR) $(TARGET)
install: $(TARGET)
install -Dm755 $(TARGET) /usr/local/bin/$(TARGET)
@echo "Installed to /usr/local/bin/$(TARGET)"