-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (43 loc) · 1.33 KB
/
Makefile
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
CC=g++
CFLAGS =
LDFLAGS = -lX11 -lXtst
src = $(wildcard src/*.cpp)
obj = $(src:.cpp=.o)
deps = $(obj:.o=.d) #one dependency file for each source
PREFIX = /usr/include/keyboard-shortcuts
.DEFAULT_GOAL := compile
install:
@echo "Installing dependencies..."
sudo apt install libxtst-dev -y
.PHONY: install_service
# $< is first prerequisite, in this case: snippets
install_service: snippets
mkdir -p $(DESTDIR)$(PREFIX)
cp $< $(DESTDIR)$(PREFIX)/
cp -R config/ $(DESTDIR)$(PREFIX)/
rm $(DESTDIR)$(PREFIX)/config/kbd-shortcuts.service
xhost +
scripts/enable_xhost
cp config/kbd-shortcuts.service /etc/systemd/system/
cp scripts/kbd-shortcuts /usr/bin/kbd-shortcuts
systemctl daemon-reload
systemctl start kbd-shortcuts.service
systemctl enable kbd-shortcuts.service
# @ variable containing target of rule
# ^ variable containing all deps of the rule
compile: $(obj)
@echo "Compiling project..."
$(CC) -o snippets $^ $(CFLAGS) $(LDFLAGS)
ls /dev/input/by-path | grep kbd > config/kbd_name.txt
-include $(deps) #include all dep files in the makefile
# rule to generate a dep file from object file
%.d: %.cpp
@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
.PHONY: clean
clean:
rm -f $(obj) snippets
.PHONY: cleandeps
cleandeps:
rm -f $(deps)
# This make file was made with the great help of
# http://nuclear.mutantstargoat.com/articles/make/