forked from stepb/urxvt-tabbedex
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
98 lines (79 loc) · 3.4 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
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
DESTDIR =
PREFIX = /usr
LIBDIR = lib
# Set to empty value to prevent man pages from being installed:
MANDIR = share/man
# Set to empty value to prevent documentation from being installed:
DOCDIR = share/doc/urxvt-tabbedex
L = $(DESTDIR)/$(PREFIX)/$(LIBDIR)/urxvt
M = $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1
D = $(DESTDIR)/$(PREFIX)/$(DOCDIR)
DIST = tabbedex command-runner.sample pgid-cd.pl
all: man html
man: tabbedex.1.gz command-runner.sample.1.gz pgid-cd.pl.1.gz
html: tabbedex.html command-runner.sample.html pgid-cd.pl.html
%.1: %
if ! pod2man $< >$@; then rm -- $@; exit 1; fi
%.1.gz: %.1
if ! gzip -9 <$< >$@; then rm -- $@; exit 1; fi
%.html: %
if ! pod2html $< >$@; then rm -- $@; exit 1; fi
@rm -f -- pod2htmd.tmp
clean:
rm -f -- *.1 *.1.gz *.html
install: AUTHORS LICENSE $(DIST) man html
install -D -m 644 tabbedex $L/perl/tabbedex
install -D -m 644 command-runner.sample $L/tabbedex-command-runner.sample
install -D -m 755 pgid-cd.pl $L/tabbedex-pgid-cd
ifneq ($(MANDIR),)
install -D -m 644 tabbedex.1.gz $M/urxvt-tabbedex.1.gz
install -D -m 644 command-runner.sample.1.gz $M/tabbedex-command-runner.1.gz
install -D -m 644 pgid-cd.pl.1.gz $M/tabbedex-pgid-cd.1.gz
endif
ifneq ($(DOCDIR),)
install -D -m 644 AUTHORS $D/AUTHORS
install -D -m 644 LICENSE $D/LICENSE
install -D -m 644 tabbedex.html $D/tabbedex.html
install -D -m 644 command-runner.sample.html $D/command-runner.html
install -D -m 644 pgid-cd.pl.html $D/pgid-cd.html
endif
uninstall:
rm -f -- $L/perl/tabbedex $L/tabbedex-command-runner.sample \
$L/tabbedex-pgid-cd
ifneq ($(MANDIR),)
rm -f -- $M/urxvt-tabbedex.1.gz $M/tabbedex-command-runner.1.gz \
$M/tabbedex-pgid-cd.1.gz
endif
ifneq ($(DOCDIR),)
rm -rf -- $D
endif
install-local: $(DIST) man
install -D -m 644 tabbedex ~/.urxvt/ext/tabbedex
install -D -m 644 command-runner.sample ~/.urxvt/tabbedex-command-runner.sample
install -D -m 755 pgid-cd.pl ~/.urxvt/tabbedex-pgid-cd
ifneq ($(MANDIR),)
# TODO: This assumes user has ~/bin in their PATH:
install -D -m 644 tabbedex.1.gz ~/man/man1/urxvt-tabbedex.1.gz
install -D -m 644 command-runner.sample.1.gz ~/man/man1/tabbedex-command-runner.1.gz
install -D -m 644 pgid-cd.pl.1.gz ~/man/man1/tabbedex-pgid-cd.1.gz
endif
install-local-symlink: $(DIST) man
mkdir -m 755 -p ~/.urxvt/ext ~/man/man1/
ln -sf -- "$$(realpath tabbedex)" ~/.urxvt/ext
ln -sf -- "$$(realpath command-runner.sample)" ~/.urxvt/tabbedex-command-runner.sample
ln -sf -- "$$(realpath pgid-cd.pl)" ~/.urxvt/pgid-cd
ifneq ($(MANDIR),)
ln -sf -- "$$(realpath tabbedex.1.gz)" ~/man/man1/urxvt-tabbedex.1.gz
ln -sf -- "$$(realpath command-runner.sample.1.gz)" ~/man/man1/tabbedex-command-runner.1.gz
ln -sf -- "$$(realpath pgid-cd.pl.1.gz)" ~/man/man1/tabbedex-pgid-cd.1.gz
endif
uninstall-local:
rm -f -- ~/.urxvt/ext/tabbedex ~/.urxvt/tabbedex-command-runner.sample \
~/.urxvt/tabbedex-pgid-cd
ifneq ($(MANDIR),)
rm -f -- ~/man/man1/urxvt-tabbedex.1.gz \
~/man/man1/tabbedex-command-runner.1.gz \
~/man/man1/tabbedex-pgid-cd.1.gz
endif
.PHONY: all man html clean
.PHONY: install uninstall install-local install-local-symlink uninstall-local