-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (52 loc) · 2.25 KB
/
Makefile
File metadata and controls
63 lines (52 loc) · 2.25 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
C := gcc
CFLAGS := -O2 -fstrict-aliasing -flto -fuse-ld=gold -ffunction-sections -fdata-sections -fno-stack-protector -fno-ident -fno-builtin -fno-plt -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-exceptions -fomit-frame-pointer -fvisibility=hidden -fno-math-errno -fmerge-all-constants -D_GNU_SOURCE
LDFLAGS := -Wl,-O1,-z,norelro,--gc-sections,--build-id=none,--as-needed,--icf=all,--hash-style=gnu,--discard-all,--strip-all
LIBS := -lX11 -lXinerama -lXfixes -lXtst -lm
TARGET := xakard
SRC := xakar.c
CONFIG := config.py
PREFIX := /usr/local
BINDIR := $(PREFIX)/bin
AUTOSTART_DIR := $(HOME)/.trinity/Autostart
AUTOSTART_XAKAR := $(AUTOSTART_DIR)/xakar-daemon.desktop
AUTOSTART_XCAPE := $(AUTOSTART_DIR)/xcape-daemon.desktop
KHOTKEYSRC := $(HOME)/.trinity/share/config/khotkeysrc
KHOTKEYS_DIR := $(HOME)/.trinity/share/apps/khotkeys
.PHONY: all clean install uninstall install-deps
ifeq ($(shell id -u),0)
$(error [xakar] Do NOT run make with sudo! Just run 'make' as a normal user.)
endif
all: $(TARGET)
$(TARGET): $(SRC)
@echo "[xakar] Compiling $^ -> $@"
@$(C) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
install: $(TARGET)
@if [ -x "$(BINDIR)/$(TARGET)" ]; then \
echo "[xakar] $(TARGET) already installed at $(BINDIR)/$(TARGET), skipping"; \
else \
echo "[xakar] Installing $(TARGET) to $(BINDIR)"; \
sudo install -m 755 $(TARGET) $(BINDIR)/$(TARGET); \
echo "[xakar] Ensuring khotkeys directory exists"; \
mkdir -p $(KHOTKEYS_DIR); \
echo "[xakar] Running config.py to set up shortcuts and autostart"; \
python3 $(CONFIG) --install; \
chmod +x $(AUTOSTART_XAKAR) || true; \
echo "[xakar] Updating Trinity khotkeys (setuzuna_xakar)"; \
fi
uninstall:
@if [ -x "$(BINDIR)/$(TARGET)" ]; then \
killall xakard; \
echo "[xakar] Removing $(TARGET) from $(BINDIR)"; \
sudo rm -f $(BINDIR)/$(TARGET); \
echo "[xakar] Removing autostart entries (if present)"; \
rm -f $(AUTOSTART_XAKAR); \
else \
echo "[xakar] $(TARGET) is not installed in $(BINDIR), skipping"; \
fi
clean:
@echo "[xakar] Cleaning build artifacts"
@rm -f $(TARGET)
install-deps:
@echo "[xakar] Installing required development libraries (if missing)..."
sudo apt update
sudo apt install -y build-essential libx11-dev libxinerama-dev libxfixes-dev binutils-gold libxtst-dev libxi-dev