blob: 8d3913159bdf5e463822b9287d3efa09acc5ed3f (
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# 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.
PREFIX =
SYSCONF = /etc
DEV = /dev
BIN = /bin
SBIN = /sbin
DATA = /usr/share
LICENSES = $(DATA)/licenses
COMMAND = got
PKGNAME = gates-of-tartaros
SSH = ssh
SH = bash
SH_SHEBANG = /usr/bin/env $(SH)
ECHO = /usr/bin/echo
EXAMPLES = README lower-left-ponysay allow-uppercase issue-file \
commands no-empty-user baudrate cerberus hide-username \
readline revoke-access
.PHONY: default
default: cmd info
.PHONY: all
all: cmd doc
.PHONY: doc
doc: info pdf ps dvi
obj/gates-of-tartaros.texinfo: info/gates-of-tartaros.texinfo
mkdir -p obj
cp "$<" "$@"
sed -i 's:^@set BIN /bin:@set BIN $(PREFIX)$(BIN):g' "$@"
sed -i 's:^@set SBIN /sbin:@set SBIN $(PREFIX)$(SBIN):g' "$@"
sed -i 's:^@set DEV /dev:@set DEV $(DEV):g' "$@"
sed -i 's:^@set ETC /etc:@set ETC $(SYSCONF):g' "$@"
sed -i 's:^@set GOT got:@set GOT $(COMMAND):g' "$@"
sed -i 's:^@set SSH ssh:@set SSH $(SSH):g' "$@"
obj/fdl.texinfo: info/fdl.texinfo
mkdir -p obj
cp "$<" "$@"
.PHONY: info
info: gates-of-tartaros.info
%.info: obj/%.texinfo obj/fdl.texinfo
makeinfo "$<"
.PHONY: pdf
pdf: gates-of-tartaros.pdf
%.pdf: obj/%.texinfo obj/fdl.texinfo
@mkdir -p obj/pdf
cd obj/pdf && yes X | texi2pdf "../../$<"
mv "obj/pdf/$@" "$@"
.PHONY: dvi
dvi: gates-of-tartaros.dvi
%.dvi: obj/%.texinfo obj/fdl.texinfo
@mkdir -p obj/dvi
cd obj/dvi && yes X | $(TEXI2DVI) "../../$<"
mv "obj/dvi/$@" "$@"
.PHONY: ps
ps: gates-of-tartaros.ps
%.ps: obj/%.texinfo obj/fdl.texinfo
@mkdir -p obj/ps
cd obj/ps && yes X | texi2pdf --ps "../../$<"
mv "obj/ps/$@" "$@"
.PHONY: cmd
cmd: got.install
got.install: got
cp "$<" "$@"
sed -i 's:#!/usr/bin/env bash:#!$(SH_SHEBANG):g' "$@"
sed -i 's:@prefix@:$(PREFIX):g' "$@"
sed -i 's:@dev@:$(DEV):g' "$@"
sed -i 's:@etc@:$(SYSCONF):g' "$@"
sed -i 's:@command@:$(COMMAND):g' "$@"
sed -i 's:@ssh@:$(SSH):g' "$@"
sed -i 's:@echo@:$(ECHO):g' "$@"
.PHONY: install
install: install-cmd install-info
.PHONY: install
install-all: install-cmd install-doc
.PHONY: install-cmd
install-cmd: install-core install-examples
.PHONY: install-core
install-core: got.install
install -Dm755 -- "got.install" "$(DESTDIR)$(PREFIX)$(SBIN)/got"
install -d -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
install -m644 -- COPYING LICENSE "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
.PHONY: install-examples
install-examples: $(foreach EXAMPLE, $(EXAMPLES), gotrc-examples/$(EXAMPLE))
install -d -- "$(DESTDIR)$(SYSCONF)/gotrc.examples"
install -m644 -- $^ "$(DESTDIR)$(SYSCONF)/gotrc.examples"
.PHONY: install-doc
install-doc: install-info install-pdf install-ps install-dvi
.PHONY: install-info
install-info: gates-of-tartaros.info
install -Dm644 -- "$<" "$(DESTDIR)$(DATA)/info/$(PKGNAME).info"
.PHONY: install-pdf
install-pdf: gates-of-tartaros.pdf
install -Dm644 -- "$<" "$(DESTDIR)$(DATA)/doc/$(PKGNAME).pdf"
.PHONY: install-ps
install-ps: gates-of-tartaros.ps
install -Dm644 -- "$<" "$(DESTDIR)$(DATA)/doc/$(PKGNAME).ps"
.PHONY: install-dvi
install-dvi: gates-of-tartaros.dvi
install -Dm644 -- "$<" "$(DESTDIR)$(DATA)/doc/$(PKGNAME).dvi"
.PHONY: uninstall
uninstall:
-rm -- "$(DESTDIR)$(PREFIX)$(SBIN)/got"
-rm -r -- "$(DESTDIR)$(SYSCONF)/gotrc.examples"
-rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/COPYING"
-rm -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)/LICENSE"
-rm -d -- "$(DESTDIR)$(LICENSES)/$(PKGNAME)"
-rm -- "$(DESTDIR)$(DATA)/info/$(PKGNAME).info"
-rm -- "$(DESTDIR)$(DATA)/doc/$(PKGNAME).pdf"
-rm -- "$(DESTDIR)$(DATA)/doc/$(PKGNAME).ps"
-rm -- "$(DESTDIR)$(DATA)/doc/$(PKGNAME).dvi"
.PHONY: clean
clean:
-rm -fr *.install *.{info,pdf,ps,dvi} obj
|