blob: 0cc9ec02cc53f4e505c4db68edb6ae091037fa27 (
plain) (
blame)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
.POSIX:
PREFIX = /usr
BIN = /bin
DATA = /share
BINDIR = $(PREFIX)$(BIN)
DATADIR = $(PREFIX)$(DATA)
LICENSEDIR = $(DATADIR)/licenses
LOCALEDIR = $(DATADIR)/locale
ICONDIR = $(DATADIR)/icons
SHEBANG = /usr/bin/env python2
COMMAND = blueshift-tray
PKGNAME = blueshift-tray
ICONS = blueshift blueshift-on blueshift-off
all: command shell
command: bin/blueshift-tray
shell: bash zsh fish
bash: bin/blueshift-tray.bash
zsh: bin/blueshift-tray.zsh
fish: bin/blueshift-tray.fish
bin/blueshift-tray: src/blueshift-tray.py
@mkdir -p bin
cp $< $@
sed '/^LOCALEDIR *= /s#^.*$$#LOCALEDIR = '\''$(LOCALEDIR)'\''#' $@ > $@.tmp && mv -- $@.tmp $@
sed 's:^#!/usr/bin/env python2$$:#!$(SHEBANG):' $@ > $@.tmp && mv -- $@.tmp $@
bin/blueshift-tray.bash: src/completion
@mkdir -p bin
auto-auto-complete bash --output $@ --source $<
bin/blueshift-tray.zsh: src/completion
@mkdir -p bin
auto-auto-complete zsh --output $@ --source $<
bin/blueshift-tray.fish: src/completion
@mkdir -p bin
auto-auto-complete fish --output $@ --source $<
install: install-base install-shell
install-base: install-command install-license
install-command: bin/blueshift-tray $(foreach I,$(ICONS),icons/$(I).svg)
install -dm755 -- "$(DESTDIR)$(BINDIR)"
install -m755 bin/blueshift-tray -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
install -dm755 -- "$(DESTDIR)$(ICONDIR)/hicolor/scalable/apps"
install -m644 $(foreach I,$(ICONS),icons/$(I).svg) -- "$(DESTDIR)$(ICONDIR)/hicolor/scalable/apps"
install-license:
install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
install -m644 COPYING LICENSE -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
install-shell: install-bash install-zsh install-fish
install-bash: bin/blueshift-tray.bash
install -dm755 -- "$(DESTDIR)$(DATADIR)/bash-completion/completions"
install -m644 $< -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)"
install-zsh: bin/blueshift-tray.zsh
install -dm755 -- "$(DESTDIR)$(DATADIR)/zsh/site-functions"
install -m644 $< -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)"
install-fish: bin/blueshift-tray.fish
install -dm755 -- "$(DESTDIR)$(DATADIR)/fish/completions"
install -m644 $< -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish"
uninstall:
-rm -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
-rm -- $(foreach I,$(ICONS),"$(DESTDIR)$(ICONDIR)/hicolor/scalable/apps/$(I).svg")
-rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING"
-rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
-rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
-rm -- "$(DESTDIR)$(DATADIR)/fish/completions/$(COMMAND).fish"
-rmdir -- "$(DESTDIR)$(DATADIR)/fish/completions"
-rmdir -- "$(DESTDIR)$(DATADIR)/fish"
-rm -- "$(DESTDIR)$(DATADIR)/zsh/site-functions/_$(COMMAND)"
-rmdir -- "$(DESTDIR)$(DATADIR)/zsh/site-functions"
-rmdir -- "$(DESTDIR)$(DATADIR)/zsh"
-rm -- "$(DESTDIR)$(DATADIR)/bash-completion/completions/$(COMMAND)"
-rmdir -- "$(DESTDIR)$(DATADIR)/bash-completion/completions"
-rmdir -- "$(DESTDIR)$(DATADIR)/bash-completion"
clean:
-rm -r bin
.PHONY: all command shell bash zsh fish install install-base install-command install-license install-shell install-bash install-zsh install-fish uninstall clean
|