-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
59 lines (50 loc) · 1.92 KB
/
Makefile
File metadata and controls
59 lines (50 loc) · 1.92 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
.PHONY: test deps version
DESTDIR?=
PREFIX?=
VERSION:=$(shell git rev-list --count HEAD) (git)
LIBDIR:=$(DESTDIR)$(PREFIX)/lib/ws-session
BINDIR:=$(DESTDIR)$(PREFIX)/bin
ETCDIR:=$(DESTDIR)/etc/xdg/ws-session
ZSHDIR:=$(DESTDIR)$(PREFIX)/share/zsh/site-functions
BASHDIR:=$(DESTDIR)$(PREFIX)/share/bash-completion/completions
MAN1DIR:=$(DESTDIR)$(PREFIX)/share/man/man1
MAN7DIR:=$(DESTDIR)$(PREFIX)/share/man/man7
# target: help - Display this help
help:
@echo "Makefile for ws-session"
@echo
@echo "There is no need to compile, this are some install routines:"
@egrep "^# target:" [Mm]akefile | cut -d":" -f2
# target: test - Run the (automatic) core tests (data,wm)
test:
@bash test/test-core-data.sh
@bash test/test-core-wm.sh
# target: version - Show version
version:
@echo "$(VERSION)"
# target: deps - Check for missing dependencies
.ONESHELL:
deps:
@r=0
for p in wmctrl xprop xdotool; do
if ! which $$p >/dev/null 2>&1; then r=1; echo $$p not found; fi
done
test $$r -eq 1 && echo "You need to install all dependencies to use ws-session."
@p=jq
if ! which $$p >/dev/null 2>&1; then r=1; echo $$p not found, you need $$p for i3-wm; fi
exit $$r
# target: install - Install to $(DESTDIR)$(PREFIX)
install:
install -d $(LIBDIR)/core $(LIBDIR)/app $(LIBDIR)/wm $(BINDIR) $(ETCDIR) $(ZSHDIR) $(BASHDIR) $(MAN1DIR) $(MAN7DIR)
install -m755 bin/* $(BINDIR)/
install -m644 conf/* $(ETCDIR)/
install -m644 app/* $(LIBDIR)/app/
install -m644 core/* $(LIBDIR)/core/
install -m644 wm/* $(LIBDIR)/wm/
install -m644 completion/zsh/_ws-session $(ZSHDIR)/
install -m644 completion/bash/ws-session $(BASHDIR)/
install -m644 man/ws-session.1 $(MAN1DIR)/
install -m644 man/ws-session.7 $(MAN7DIR)/
@sed -i "/VERSION/s/VERSION=/VERSION=\"$(VERSION)\"/" "$(BINDIR)/ws-session"
@sed -i "/VERSION/s/VERSION/$(VERSION)/" "$(MAN1DIR)/ws-session.1"
@sed -i "/VERSION/s/VERSION/$(VERSION)/" "$(MAN7DIR)/ws-session.7"