-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
261 lines (212 loc) · 7.57 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
.PHONY: all check munge full lgc ttf full-ttf lgc-ttf status dist src-dist full-dist lgc-dist norm check-harder pre-patch clean
# Release version
VERSION = 1.2.2
# Snapshot version
SNAPSHOT =
# Initial source directory, assumed read-only
SRCDIR = src
# Directory where temporary files live
TMPDIR = tmp
# Directory where final files are created
BUILDDIR = build
# Directory where final archives are created
DISTDIR = dist
# Release layout
FONTCONFDIR = fontconfig
DOCDIR = .
SCRIPTSDIR = scripts
TTFDIR = ttf
RESOURCEDIR = resources
ifeq "$(SNAPSHOT)" ""
ARCHIVEVER = $(VERSION)
else
ARCHIVEVER = $(VERSION)-$(SNAPSHOT)
endif
SRCARCHIVE = dejavu-code-$(ARCHIVEVER)
FULLARCHIVE = dejavu-code-ttf-$(ARCHIVEVER)
LGCARCHIVE = dejavu-code-lgc-ttf-$(ARCHIVEVER)
ARCHIVEEXT = .zip .tar.bz2
SUMEXT = .zip.md5 .tar.bz2.md5 .tar.bz2.sha512
OLDSTATUS = $(DOCDIR)/status.txt
BLOCKS = $(RESOURCEDIR)/Blocks.txt
UNICODEDATA = $(RESOURCEDIR)/UnicodeData.txt
FC-LANG = $(RESOURCEDIR)/fc-lang
GENERATE = $(SCRIPTSDIR)/generate.pe
TTPOSTPROC = $(SCRIPTSDIR)/ttpostproc.pl
LGC = $(SCRIPTSDIR)/lgc.pe
UNICOVER = $(SCRIPTSDIR)/unicover.pl
LANGCOVER = $(SCRIPTSDIR)/langcover.pl
STATUS = $(SCRIPTSDIR)/status.pl
PROBLEMS = $(SCRIPTSDIR)/problems.pl
NORMALIZE = $(SCRIPTSDIR)/sfdnormalize.pl
NARROW = $(SCRIPTSDIR)/narrow.pe
SRC := $(wildcard $(SRCDIR)/*.sfd)
SFDFILES := $(patsubst $(SRCDIR)/%, %, $(SRC))
FULLSFD := $(patsubst $(SRCDIR)/%.sfd, $(TMPDIR)/%.sfd, $(SRC))
NORMSFD := $(patsubst %, %.norm, $(FULLSFD))
MATSHSFD := $(wildcard $(SRCDIR)/*Math*.sfd)
LGCSRC := $(filter-out $(MATSHSFD),$(SRC))
LGCSFD := $(patsubst $(SRCDIR)/DejaVu%.sfd, $(TMPDIR)/DejaVuLGC%.sfd, $(LGCSRC))
FULLTTF := $(patsubst $(TMPDIR)/%.sfd, $(BUILDDIR)/%.ttf, $(FULLSFD))
LGCTTF := $(patsubst $(TMPDIR)/%.sfd, $(BUILDDIR)/%.ttf, $(LGCSFD))
FONTCONF := $(wildcard $(FONTCONFDIR)/*.conf)
FONTCONFLGC := $(wildcard $(FONTCONFDIR)/*lgc*.conf)
FONTCONFFULL := $(filter-out $(FONTCONFLGC), $(FONTCONF))
STATICDOC := $(addprefix $(DOCDIR)/, AUTHORS BUGS LICENSE NEWS README.md sample.png)
STATICSRCDOC := $(addprefix $(DOCDIR)/, BUILDING)
GENDOCFULL = unicover.txt langcover.txt status.txt
GENDOCLGC = unicover-lgc.txt langcover-lgc.txt
all : full lgc
$(TMPDIR)/%.sfd: $(SRCDIR)/%.sfd
@echo "[1] $< => $@"
install -d $(dir $@)
sed "s@\(Version:\? \)\(0\.[0-9]\+\.[0-9]\+\|[1-9][0-9]*\.[0-9]\+\)@\1$(VERSION)@" $< > $@
touch -r $< $@
$(TMPDIR)/DejaVuLGCMathTeXGyre.sfd: $(TMPDIR)/DejaVuMathTeXGyre.sfd
@echo "[2] skipping $<"
$(TMPDIR)/DejaVuLGC%.sfd: $(TMPDIR)/DejaVu%.sfd
@echo "[2] $< => $@"
sed -e 's,FontName: DejaVu,FontName: DejaVuLGC,'\
-e 's,FullName: DejaVu,FullName: DejaVu LGC,'\
-e 's,FamilyName: DejaVu,FamilyName: DejaVu LGC,'\
-e 's,"DejaVu \(\(Sans\|Serif\)*\( Condensed\| Code\)*\( Bold\)*\( Oblique\|Italic\)*\)","DejaVu LGC \1",g' < $< > $@
@echo "Stripping unwanted glyphs from $@"
$(LGC) $@
touch -r $< $@
$(BUILDDIR)/DejaVuLGCMathTeXGyre.ttf: $(TMPDIR)/DejaVuLGCMathTeXGyre.sfd
@echo "[3] skipping $<"
$(BUILDDIR)/%.ttf: $(TMPDIR)/%.sfd
@echo "[3] $< => $@"
install -d $(dir $@)
$(GENERATE) $<
mv $<.ttf $@
$(TTPOSTPROC) $@
$(RM) $@~
touch -r $< $@
$(BUILDDIR)/status.txt: $(FULLSFD)
@echo "[4] => $@"
install -d $(dir $@)
$(STATUS) $(VERSION) $(OLDSTATUS) $(FULLSFD) > $@
$(BUILDDIR)/unicover.txt: $(patsubst %, $(TMPDIR)/%.sfd, DejaVuSansCode)
@echo "[5] => $@"
install -d $(dir $@)
$(UNICOVER) $(UNICODEDATA) $(BLOCKS) \
$(TMPDIR)/DejaVuSansCode.sfd "Sans Code" > $@
$(BUILDDIR)/unicover-sans.txt: $(TMPDIR)/DejaVuSans.sfd
@echo "[5] => $@"
install -d $(dir $@)
$(UNICOVER) $(UNICODEDATA) $(BLOCKS) \
$(TMPDIR)/DejaVuSans.sfd "Sans" > $@
$(BUILDDIR)/unicover-lgc.txt: $(patsubst %, $(TMPDIR)/%.sfd, DejaVuLGCSansCode)
@echo "[5] => $@"
install -d $(dir $@)
$(UNICOVER) $(UNICODEDATA) $(BLOCKS) \
$(TMPDIR)/DejaVuLGCSansCode.sfd "Sans Code" > $@
$(BUILDDIR)/langcover.txt: $(patsubst %, $(TMPDIR)/%.sfd, DejaVuSansCode)
@echo "[6] => $@"
install -d $(dir $@)
ifeq "$(FC-LANG)" ""
touch $@
else
$(LANGCOVER) $(FC-LANG) \
$(TMPDIR)/DejaVuSansCode.sfd "Sans Code" > $@
endif
$(BUILDDIR)/langcover-sans.txt: $(TMPDIR)/DejaVuSans.sfd
@echo "[6] => $@"
install -d $(dir $@)
ifeq "$(FC-LANG)" ""
touch $@
else
$(LANGCOVER) $(FC-LANG) \
$(TMPDIR)/DejaVuSans.sfd "Sans" > $@
endif
$(BUILDDIR)/langcover-lgc.txt: $(patsubst %, $(TMPDIR)/%.sfd, DejaVuLGCSansCode)
@echo "[6] => $@"
install -d $(dir $@)
ifeq "$(FC-LANG)" ""
touch $@
else
$(LANGCOVER) $(FC-LANG) \
$(TMPDIR)/DejaVuLGCSansCode.sfd "Sans Code" > $@
endif
$(BUILDDIR)/Makefile: Makefile
@echo "[7] => $@"
install -d $(dir $@)
sed -e "s+^VERSION\([[:space:]]*\)=\(.*\)+VERSION = $(VERSION)+g"\
-e "s+^SNAPSHOT\([[:space:]]*\)=\(.*\)+SNAPSHOT = $(SNAPSHOT)+g" < $< > $@
touch -r $< $@
$(TMPDIR)/$(SRCARCHIVE): $(addprefix $(BUILDDIR)/, $(GENDOCFULL) Makefile) $(FULLSFD)
@echo "[8] => $@"
install -d -m 0755 $@/$(SCRIPTSDIR)
install -d -m 0755 $@/$(SRCDIR)
install -d -m 0755 $@/$(FONTCONFDIR)
install -d -m 0755 $@/$(DOCDIR)
install -p -m 0644 $(BUILDDIR)/Makefile $@
install -p -m 0755 $(GENERATE) $(TTPOSTPROC) $(LGC) $(NORMALIZE) \
$(UNICOVER) $(LANGCOVER) $(STATUS) $(PROBLEMS) \
$@/$(SCRIPTSDIR)
install -p -m 0644 $(FULLSFD) $@/$(SRCDIR)
install -p -m 0644 $(FONTCONF) $@/$(FONTCONFDIR)
install -p -m 0644 $(addprefix $(BUILDDIR)/, $(GENDOCFULL)) \
$(STATICDOC) $(STATICSRCDOC) $@/$(DOCDIR)
$(TMPDIR)/$(FULLARCHIVE): full
@echo "[8] => $@"
install -d -m 0755 $@/$(TTFDIR)
install -d -m 0755 $@/$(FONTCONFDIR)
install -d -m 0755 $@/$(DOCDIR)
install -p -m 0644 $(FULLTTF) $@/$(TTFDIR)
install -p -m 0644 $(FONTCONFFULL) $@/$(FONTCONFDIR)
install -p -m 0644 $(addprefix $(BUILDDIR)/, $(GENDOCFULL)) \
$(STATICDOC) $@/$(DOCDIR)
$(TMPDIR)/$(LGCARCHIVE): lgc
@echo "[8] => $@"
install -d -m 0755 $@/$(TTFDIR)
install -d -m 0755 $@/$(FONTCONFDIR)
install -d -m 0755 $@/$(DOCDIR)
install -p -m 0644 $(LGCTTF) $@/$(TTFDIR)
install -p -m 0644 $(FONTCONFLGC) $@/$(FONTCONFDIR)
install -p -m 0644 $(addprefix $(BUILDDIR)/, $(GENDOCLGC)) \
$(STATICDOC) $@/$(DOCDIR)
$(DISTDIR)/%.zip: $(TMPDIR)/%
@echo "[9] => $@"
install -d $(dir $@)
(cd $(TMPDIR); zip -rv $(abspath $@) $(notdir $<))
$(DISTDIR)/%.tar.bz2: $(TMPDIR)/%
@echo "[9] => $@"
install -d $(dir $@)
(cd $(TMPDIR); tar cjvf $(abspath $@) $(notdir $<))
%.md5: %
@echo "[10] => $@"
(cd $(dir $<); md5sum -b $(notdir $<) > $(abspath $@))
%.sha512: %
@echo "[10] => $@"
(cd $(dir $<); sha512sum -b $(notdir $<) > $(abspath $@))
%.sfd.norm: %.sfd
@echo "[11] $< => $@"
$(NORMALIZE) $<
touch -r $< $@
check : $(NORMSFD)
for sfd in $^ ; do \
echo "[12] Checking $$sfd" ;\
$(PROBLEMS) $$sfd ;\
done
munge: $(NORMSFD)
for sfd in $(SFDFILES) ; do \
echo "[13] $(TMPDIR)/$$sfd.norm => $(SRCDIR)/$$sfd" ;\
cp $(TMPDIR)/$$sfd.norm $(SRCDIR)/$$sfd ;\
done
full : $(FULLTTF) $(addprefix $(BUILDDIR)/, $(GENDOCFULL))
lgc : $(LGCTTF) $(addprefix $(BUILDDIR)/, $(GENDOCLGC))
ttf : full-ttf lgc-ttf
full-ttf : $(FULLTTF)
lgc-ttf : $(LGCTTF)
status : $(addprefix $(BUILDDIR)/, $(GENDOCFULL))
dist : src-dist full-dist lgc-dist
src-dist : $(addprefix $(DISTDIR)/$(SRCARCHIVE), $(ARCHIVEEXT) $(SUMEXT))
full-dist : $(addprefix $(DISTDIR)/$(FULLARCHIVE), $(ARCHIVEEXT) $(SUMEXT))
lgc-dist : $(addprefix $(DISTDIR)/$(LGCARCHIVE), $(ARCHIVEEXT) $(SUMEXT))
norm : $(NORMSFD)
check-harder : clean check
pre-patch : munge clean
clean :
$(RM) -r $(TMPDIR) $(BUILDDIR) $(DISTDIR)