forked from stepb/urxvt-tabbedex
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small refactoring of Makefile plus add documentation installation
Makefile’s install target now copies documentation (AUTHORS, LICENSE and HTML files) to /usr/share/doc/urxvt-tabbedex (in addition to all the other things the target did). This can be disabled by making DOCDIR variable empty, e.g.: make DESTDIR=/tmp/urxvt-tabbedex-package DOCDIR= install Similarly, installing man pages can now be disabled by setting MANDIR to empty value. Apart from the two, there’s now also LIBDIR variable (but this one has to always be non-empty). All of the variables are relative to PREFIX. Makefile has also been refactored slightly such that there’s less renaming going on and templates can be used more efficiently.
- Loading branch information
Showing
2 changed files
with
66 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
urxvt-tabbedex.* | ||
*.1 | ||
*.1.gz | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,87 @@ | ||
DESTDIR = | ||
PREFIX = /usr | ||
p = $(DESTDIR)$(PREFIX) | ||
MANPAGES := urxvt-tabbedex.1.gz command-runner.1.gz | ||
DIST := tabbedex command-runner.sample $(MANPAGES) | ||
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 | ||
|
||
all: $(MANPAGES) | ||
L = $(DESTDIR)/$(PREFIX)/$(LIBDIR)/urxvt | ||
M = $(DESTDIR)/$(PREFIX)/$(MANDIR)/man1 | ||
D = $(DESTDIR)/$(PREFIX)/$(DOCDIR) | ||
|
||
.INTERMEDIATE: urxvt-tabbedex.1 command-runner.1 | ||
DIST = tabbedex command-runner.sample | ||
|
||
|
||
all: man html | ||
man: tabbedex.1.gz command-runner.sample.1.gz | ||
html: tabbedex.html command-runner.sample.html | ||
|
||
urxvt-tabbedex.1: tabbedex | ||
if ! pod2man $< >$@; then rm -- $@; exit 1; fi | ||
|
||
command-runner.1: command-runner.sample | ||
%.1: % | ||
if ! pod2man $< >$@; then rm -- $@; exit 1; fi | ||
|
||
%.1.gz: %.1 | ||
if ! gzip -9 <$< >$@; then rm -- $@; exit 1; fi | ||
|
||
urxvt-tabbedex.html: tabbedex | ||
%.html: % | ||
if ! pod2html $< >$@; then rm -- $@; exit 1; fi | ||
@rm -f -- pod2htmd.tmp | ||
|
||
install: $(DIST) | ||
install -D -m 644 tabbedex '$p/lib/urxvt/perl/tabbedex' | ||
install -D -m 644 command-runner.sample '$p/lib/urxvt/perl/tabbedex-command-runner.sample' | ||
install -D -m 644 urxvt-tabbedex.1.gz '$p/share/man/man1/urxvt-tabbedex.1.gz' | ||
install -D -m 644 command-runner.1.gz '$p/share/man/man1/tabbedex-command-runner.1.gz' | ||
|
||
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 | ||
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 | ||
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 | ||
endif | ||
|
||
uninstall: | ||
rm -f -- '$p/lib/urxvt/perl/tabbedex' \ | ||
'$p/lib/urxvt/perl/tabbedex-command-runner.sample' \ | ||
'$p/share/man/man1/urxvt-tabbedex.1.gz' \ | ||
'$p/share/man/man1/tabbedex-command-runner.1.gz' | ||
|
||
install-local: $(DIST) | ||
install -D -m 644 tabbedex ~/.urxvt/ext/tabbedex | ||
install -D -m 644 command-runner.sample ~/.urxvt/tabbedex-command-runner.sample | ||
rm -f -- $L/perl/tabbedex $L/tabbedex-command-runner.sample | ||
ifneq ($(MANDIR),) | ||
rm -f -- $M/urxvt-tabbedex.1.gz $M/tabbedex-command-runner.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 | ||
ifneq ($(MANDIR),) | ||
# TODO: This assumes user has ~/bin in their PATH: | ||
install -D -m 644 urxvt-tabbedex.1.gz ~/man/man1/urxvt-tabbedex.1.gz | ||
install -D -m 644 command-runner.1.gz ~/man/man1/tabbedex-command-runner.1.gz | ||
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 | ||
endif | ||
|
||
install-local-symlink: $(DIST) | ||
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 urxvt-tabbedex.1.gz)" ~/man/man1/ | ||
ln -sf -- "$$(realpath command-runner.1.gz)" ~/man/man1/ | ||
ln -sf -- "$$(realpath tabbedex)" ~/.urxvt/ext | ||
ln -sf -- "$$(realpath command-runner.sample)" ~/.urxvt/tabbedex-command-runner.sample | ||
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 | ||
endif | ||
|
||
uninstall-local: | ||
rm -f -- ~/.urxvt/ext/tabbedex \ | ||
~/.urxvt/tabbedex-command-runner.sample \ | ||
~/man/man1/urxvt-tabbedex.1.gz \ | ||
rm -f -- ~/.urxvt/ext/tabbedex ~/.urxvt/tabbedex-command-runner.sample | ||
ifneq ($(MANDIR),) | ||
rm -f -- ~/man/man1/urxvt-tabbedex.1.gz \ | ||
~/man/man1/tabbedex-command-runner.1.gz | ||
endif | ||
|
||
|
||
.PHONY: all man html clean | ||
.PHONY: install uninstall install-local install-local-symlink uninstall-local |