-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (49 loc) · 1.63 KB
/
Makefile
File metadata and controls
62 lines (49 loc) · 1.63 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
CC = gcc
CFLAGS = -O2 -Wall
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
TARGET = adaptive-scroll
LDLIBS = -framework ApplicationServices -framework IOKit -framework CoreFoundation
.PHONY: all build install uninstall run start stop restart status clean release
all: build
build: clean
@echo "Building $(TARGET)..."
@$(CC) $(CFLAGS) -o $(TARGET) *.c $(LDLIBS)
install: build
@echo "Installing $(TARGET) to $(DESTDIR)$(BINDIR)..."
@mkdir -p $(DESTDIR)$(BINDIR)
@cp $(TARGET) $(DESTDIR)$(BINDIR)/
@chmod 755 $(DESTDIR)$(BINDIR)/$(TARGET)
uninstall:
@echo "Uninstalling $(TARGET) from $(DESTDIR)$(BINDIR)..."
@rm -f $(DESTDIR)$(BINDIR)/$(TARGET)
run:
@echo "Running $(TARGET)..."
@./$(TARGET)
start:
@echo "Starting $(TARGET) via systemd..."
@sudo systemctl start adaptive-scroll
stop:
@echo "Stopping $(TARGET) via systemd..."
@sudo systemctl stop adaptive-scroll
restart:
@echo "Restarting $(TARGET) via systemd..."
@sudo systemctl restart adaptive-scroll
status:
@sudo systemctl status adaptive-scroll --no-pager
clean:
@echo "Cleaning up..."
@rm -f $(TARGET)
release:
@if [ -z "$(VERSION)" ]; then \
echo "Error: VERSION is not set. Use: make release VERSION=v0.0.1"; \
exit 1; \
fi
@echo "Releasing version $(VERSION)..."
git tag $(VERSION)
git push origin $(VERSION)
# manual daemon control examples (commented out):
# to manually start/stop without systemd:
# start: setsid ./adaptive-scroll > /tmp/adaptive-scroll.log 2>&1 & echo $$! > /tmp/adaptive-scroll.pid
# stop: kill `cat /tmp/adaptive-scroll.pid` && rm /tmp/adaptive-scroll.pid
# status: kill -0 `cat /tmp/adaptive-scroll.pid` && echo running || echo not running