-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
179 lines (130 loc) · 4.16 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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
PROGRAM = hoofbook
PKGNAME = hoofbook
TEXIFLAGS = #--force
ALL_COMPRESS = #.gz
PDF_COMPRESS = $(ALL_COMPRESS)
PS_COMPRESS = $(ALL_COMPRESS)
DVI_COMPRESS = $(ALL_COMPRESS)
INFO_COMPRESS = $(ALL_COMPRESS)
PREFIX = /usr
DATA = /share
MANE_SRC = $(PROGRAM).texinfo
INCLUDED_SRC = $(shell find chap | grep '\.texinfo$$') $(shell find appx | grep '\.texinfo$$')
# basic invokable rules
.PHONY: all
all:
.PHONY: install
install:
.PHONY: uninstall
uninstall:
.PHONY: clean
clean:
-rm -r -- bin obj
# compressions
%.gz: %
gzip -9c < "$<" > "$@"
%.bz2: %
bzip2 -9c < "$<" > "$@"
%.xz: %
xz -e9 < "$<" > "$@"
## Texinfo manual section
.PHONY: doc
all: doc
doc: info$(INFO_COMPRESS) pdf$(PDF_COMPRESS) ps$(PS_COMPRESS) dvi$(DVI_COMPRESS)
# invokable rules for specific files
.PHONY: info info.gz
info: $(PROGRAM).info
info.gz: $(PROGRAM).info.gz
info.bz2: $(PROGRAM).info.bz2
info.xz: $(PROGRAM).info.xz
.PHONY: pdf pdf.gz pdf.bz2 pdf.xz
pdf: $(PROGRAM).pdf
pdf.gz: $(PROGRAM).pdf.gz
pdf.bz2: $(PROGRAM).pdf.bz2
pdf.xz: $(PROGRAM).pdf.xz
.PHONY: ps ps.gz ps.bz2 ps.xz
ps: $(PROGRAM).ps
ps.gz: $(PROGRAM).ps.gz
ps.bz2: $(PROGRAM).ps.bz2
ps.xz: $(PROGRAM).ps.xz
.PHONY: dvi dvi.gz dvi.bz2 dvi.xz
dvi: $(PROGRAM).dvi
dvi.gz: $(PROGRAM).dvi.gz
dvi.bz2: $(PROGRAM).dvi.bz2
dvi.xz: $(PROGRAM).dvi.xz
# rules for creating the logo
obj/logo.pdf: logo.svg
mkdir -p obj
rsvg-convert --format=pdf "$<" > "$@"
obj/logo.eps: obj/logo.ps
ps2eps "$<"
obj/logo.ps: logo.svg
mkdir -p obj
rsvg-convert --format=ps "$<" > "$@"
# rules for compile the manual to diffent formats
$(PROGRAM).info: $(MANE_SRC) $(INCLUDED_SRC)
@mkdir -p obj/info
cd obj/info && $(MAKEINFO) $(TEXIFLAGS) "../../$<" && mv "$@" ../..
$(PROGRAM).pdf: $(MANE_SRC) $(INCLUDED_SRC) obj/logo.pdf
@mkdir -p obj/pdf
cd obj/pdf && texi2pdf $(TEXIFLAGS) "../../$<" && \
texi2pdf $(TEXIFLAGS) "../../$<" && mv "$@" ../..
$(PROGRAM).dvi: $(MANE_SRC) $(INCLUDED_SRC) obj/logo.eps
@mkdir -p obj/dvi
cd obj/dvi && $(TEXI2DVI) $(TEXIFLAGS) "../../$<" && \
$(TEXI2DVI) $(TEXIFLAGS) "../../$<" && mv "$@" ../..
$(PROGRAM).ps: $(MANE_SRC) $(INCLUDED_SRC) obj/logo.eps
@mkdir -p obj/ps
cd obj/ps && texi2pdf $(TEXIFLAGS) --ps "../../$<" && \
texi2pdf $(TEXIFLAGS) --ps "../../$<" && mv "$@" ../..
# rules for installing the manual
.PHONY: install-info
install: install-info
install-info: $(PROGRAM).info$(INFO_COMPRESS)
install -Dm644 "$<" -- "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info$(INFO_COMPRESS)"
.PHONY: install-pdf
install: install-pdf
install-pdf: $(PROGRAM).pdf$(PDF_COMPRESS)
install -Dm644 "$<" -- "$(DESTDIR)$(PREFIX)$(DATA)/doc/$(PKGNAME).pdf$(PDF_COMPRESS)"
.PHONY: install-dvi
install: install-dvi
install-dvi: $(PROGRAM).dvi$(DVI_COMPRESS)
install -Dm644 "$<" -- "$(DESTDIR)$(PREFIX)$(DATA)/doc/$(PKGNAME).dvi$(DVI_COMPRESS)"
.PHONY: install-ps
install: install-ps
install-ps: $(PROGRAM).ps$(PS_COMPRESS)
install -Dm644 "$<" -- "$(DESTDIR)$(PREFIX)$(DATA)/doc/$(PKGNAME).ps$(PS_COMPRESS)"
# rules for uninstalling the manual
.PHONY: uninstall-info
uninstall: uninstall-info
uninstall-info:
-rm -- "$(DESTDIR)$(PREFIX)$(DATA)/doc/$(PKGNAME).info$(PDF_COMPRESS)"
.PHONY: uninstall-pdf
uninstall: uninstall-pdf
uninstall-pdf:
-rm -- "$(DESTDIR)$(PREFIX)$(DATA)/doc/$(PKGNAME).pdf$(PDF_COMPRESS)"
.PHONY: uninstall-dvi
uninstall: uninstall-dvi
uninstall-dvi:
-rm -- "$(DESTDIR)$(PREFIX)$(DATA)/doc/$(PKGNAME).dvi$(DVI_COMPRESS)"
.PHONY: uninstall-ps
uninstall: uninstall-ps
uninstall-ps:
-rm -- "$(DESTDIR)$(PREFIX)$(DATA)/doc/$(PKGNAME).ps$(PS_COMPRESS)"
# rules for clean
.PHONY: clean-texinfo
clean: clean-texinfo
clean-texinfo:
-rm -- *.{info,pdf,ps,dvi}{,.gz,.bz2,.xz} 2>/dev/null
-rm -- *.{aux,cp,cps,fn,ky,log,pg,pgs,toc,tp,vr,vrs,eps,op,ops} 2>/dev/null
## License section
.PHONY: install-license
install: install-license
install-license:
install -d -- "$(DESTDIR)$(PREFIX)$(DATA)/licenses/$(PKGNAME)"
install -m644 LICENSE -- "$(DESTDIR)$(PREFIX)$(DATA)/licenses/$(PKGNAME)"
.PHONY: uninstall-license
uninstall: uninstall-license
uninstall-license:
-rm -- "$(DESTDIR)$(PREFIX)$(DATA)/licenses/$(PKGNAME)/LICENSE"
-rmdir -- "$(DESTDIR)$(PREFIX)$(DATA)/licenses/$(PKGNAME)"