* bump version to 2.31
[dejavu.git] / dejavu-fonts / Makefile
blob91f3847bc678d496b980674eb04bd7ba77d5487e
1 .PHONY: all check munge full sans lgc ttf full-ttf sans-ttf lgc-ttf status dist src-dist full-dist sans-dist lgc-dist norm check-harder pre-patch clean
3 # Release version
4 VERSION = 2.31
5 # Snapshot version
6 SNAPSHOT =
7 # Initial source directory, assumed read-only
8 SRCDIR = src
9 # Directory where temporary files live
10 TMPDIR = tmp
11 # Directory where final files are created
12 BUILDDIR = build
13 # Directory where final archives are created
14 DISTDIR = dist
16 # Release layout
17 FONTCONFDIR = fontconfig
18 DOCDIR = .
19 SCRIPTSDIR = scripts
20 TTFDIR = ttf
21 RESOURCEDIR = resources
23 ifeq "$(SNAPSHOT)" ""
24 ARCHIVEVER = $(VERSION)
25 else
26 ARCHIVEVER = $(VERSION)-$(SNAPSHOT)
27 endif
29 SRCARCHIVE = dejavu-fonts-$(ARCHIVEVER)
30 FULLARCHIVE = dejavu-fonts-ttf-$(ARCHIVEVER)
31 SANSARCHIVE = dejavu-sans-ttf-$(ARCHIVEVER)
32 LGCARCHIVE = dejavu-lgc-fonts-ttf-$(ARCHIVEVER)
34 ARCHIVEEXT = .zip .tar.bz2
35 SUMEXT = .zip.md5 .tar.bz2.md5 .tar.bz2.sha512
37 OLDSTATUS = $(DOCDIR)/status.txt
38 BLOCKS = $(RESOURCEDIR)/Blocks.txt
39 UNICODEDATA = $(RESOURCEDIR)/UnicodeData.txt
40 FC-LANG = $(RESOURCEDIR)/fc-lang
42 GENERATE = $(SCRIPTSDIR)/generate.pe
43 TTPOSTPROC = $(SCRIPTSDIR)/ttpostproc.pl
44 LGC = $(SCRIPTSDIR)/lgc.pe
45 UNICOVER = $(SCRIPTSDIR)/unicover.pl
46 LANGCOVER = $(SCRIPTSDIR)/langcover.pl
47 STATUS = $(SCRIPTSDIR)/status.pl
48 PROBLEMS = $(SCRIPTSDIR)/problems.pl
49 NORMALIZE = $(SCRIPTSDIR)/sfdnormalize.pl
50 NARROW = $(SCRIPTSDIR)/narrow.pe
52 SRC := $(wildcard $(SRCDIR)/*.sfd)
53 SFDFILES := $(patsubst $(SRCDIR)/%, %, $(SRC))
54 FULLSFD := $(patsubst $(SRCDIR)/%.sfd, $(TMPDIR)/%.sfd, $(SRC))
55 NORMSFD := $(patsubst %, %.norm, $(FULLSFD))
56 LGCSFD := $(patsubst $(SRCDIR)/DejaVu%.sfd, $(TMPDIR)/DejaVuLGC%.sfd, $(SRC))
57 FULLTTF := $(patsubst $(TMPDIR)/%.sfd, $(BUILDDIR)/%.ttf, $(FULLSFD))
58 LGCTTF := $(patsubst $(TMPDIR)/%.sfd, $(BUILDDIR)/%.ttf, $(LGCSFD))
60 FONTCONF := $(wildcard $(FONTCONFDIR)/*.conf)
61 FONTCONFLGC := $(wildcard $(FONTCONFDIR)/*lgc*.conf)
62 FONTCONFFULL := $(filter-out $(FONTCONFLGC), $(FONTCONF))
64 STATICDOC := $(addprefix $(DOCDIR)/, AUTHORS BUGS LICENSE NEWS README)
65 STATICSRCDOC := $(addprefix $(DOCDIR)/, BUILDING)
66 GENDOCFULL = unicover.txt langcover.txt status.txt
67 GENDOCSANS = unicover-sans.txt langcover-sans.txt
68 GENDOCLGC = unicover-lgc.txt langcover-lgc.txt
70 all : full sans lgc
72 $(TMPDIR)/%.sfd: $(SRCDIR)/%.sfd
73 @echo "[1] $< => $@"
74 install -d $(dir $@)
75 sed "s@\(Version:\? \)\(0\.[0-9]\+\.[0-9]\+\|[1-9][0-9]*\.[0-9]\+\)@\1$(VERSION)@" $< > $@
76 touch -r $< $@
78 $(TMPDIR)/DejaVuLGC%.sfd: $(TMPDIR)/DejaVu%.sfd
79 @echo "[2] $< => $@"
80 sed -e 's,FontName: DejaVu,FontName: DejaVuLGC,'\
81 -e 's,FullName: DejaVu,FullName: DejaVu LGC,'\
82 -e 's,FamilyName: DejaVu,FamilyName: DejaVu LGC,'\
83 -e 's,"DejaVu \(\(Sans\|Serif\)*\( Condensed\| Mono\)*\( Bold\)*\( Oblique\|Italic\)*\)","DejaVu LGC \1",g' < $< > $@
84 @echo "Stripping unwanted glyphs from $@"
85 $(LGC) $@
86 touch -r $< $@
88 $(BUILDDIR)/%.ttf: $(TMPDIR)/%.sfd
89 @echo "[3] $< => $@"
90 install -d $(dir $@)
91 $(GENERATE) $<
92 mv $<.ttf $@
93 $(TTPOSTPROC) $@
94 $(RM) $@~
95 touch -r $< $@
97 $(BUILDDIR)/status.txt: $(FULLSFD)
98 @echo "[4] => $@"
99 install -d $(dir $@)
100 $(STATUS) $(VERSION) $(OLDSTATUS) $(FULLSFD) > $@
102 $(BUILDDIR)/unicover.txt: $(patsubst %, $(TMPDIR)/%.sfd, DejaVuSans DejaVuSerif DejaVuSansMono)
103 @echo "[5] => $@"
104 install -d $(dir $@)
105 $(UNICOVER) $(UNICODEDATA) $(BLOCKS) \
106 $(TMPDIR)/DejaVuSans.sfd "Sans" \
107 $(TMPDIR)/DejaVuSerif.sfd "Serif" \
108 $(TMPDIR)/DejaVuSansMono.sfd "Sans Mono" > $@
110 $(BUILDDIR)/unicover-sans.txt: $(TMPDIR)/DejaVuSans.sfd
111 @echo "[5] => $@"
112 install -d $(dir $@)
113 $(UNICOVER) $(UNICODEDATA) $(BLOCKS) \
114 $(TMPDIR)/DejaVuSans.sfd "Sans" > $@
116 $(BUILDDIR)/unicover-lgc.txt: $(patsubst %, $(TMPDIR)/%.sfd, DejaVuLGCSans DejaVuLGCSerif DejaVuLGCSansMono)
117 @echo "[5] => $@"
118 install -d $(dir $@)
119 $(UNICOVER) $(UNICODEDATA) $(BLOCKS) \
120 $(TMPDIR)/DejaVuLGCSans.sfd "Sans" \
121 $(TMPDIR)/DejaVuLGCSerif.sfd "Serif" \
122 $(TMPDIR)/DejaVuLGCSansMono.sfd "Sans Mono" > $@
124 $(BUILDDIR)/langcover.txt: $(patsubst %, $(TMPDIR)/%.sfd, DejaVuSans DejaVuSerif DejaVuSansMono)
125 @echo "[6] => $@"
126 install -d $(dir $@)
127 ifeq "$(FC-LANG)" ""
128 touch $@
129 else
130 $(LANGCOVER) $(FC-LANG) \
131 $(TMPDIR)/DejaVuSans.sfd "Sans" \
132 $(TMPDIR)/DejaVuSerif.sfd "Serif" \
133 $(TMPDIR)/DejaVuSansMono.sfd "Sans Mono" > $@
134 endif
136 $(BUILDDIR)/langcover-sans.txt: $(TMPDIR)/DejaVuSans.sfd
137 @echo "[6] => $@"
138 install -d $(dir $@)
139 ifeq "$(FC-LANG)" ""
140 touch $@
141 else
142 $(LANGCOVER) $(FC-LANG) \
143 $(TMPDIR)/DejaVuSans.sfd "Sans" > $@
144 endif
146 $(BUILDDIR)/langcover-lgc.txt: $(patsubst %, $(TMPDIR)/%.sfd, DejaVuLGCSans DejaVuLGCSerif DejaVuLGCSansMono)
147 @echo "[6] => $@"
148 install -d $(dir $@)
149 ifeq "$(FC-LANG)" ""
150 touch $@
151 else
152 $(LANGCOVER) $(FC-LANG) \
153 $(TMPDIR)/DejaVuLGCSans.sfd "Sans" \
154 $(TMPDIR)/DejaVuLGCSerif.sfd "Serif" \
155 $(TMPDIR)/DejaVuLGCSansMono.sfd "Sans Mono" > $@
156 endif
158 $(BUILDDIR)/Makefile: Makefile
159 @echo "[7] => $@"
160 install -d $(dir $@)
161 sed -e "s+^VERSION\([[:space:]]*\)=\(.*\)+VERSION = $(VERSION)+g"\
162 -e "s+^SNAPSHOT\([[:space:]]*\)=\(.*\)+SNAPSHOT = $(SNAPSHOT)+g" < $< > $@
163 touch -r $< $@
165 $(TMPDIR)/$(SRCARCHIVE): $(addprefix $(BUILDDIR)/, $(GENDOCFULL) Makefile) $(FULLSFD)
166 @echo "[8] => $@"
167 install -d -m 0755 $@/$(SCRIPTSDIR)
168 install -d -m 0755 $@/$(SRCDIR)
169 install -d -m 0755 $@/$(FONTCONFDIR)
170 install -d -m 0755 $@/$(DOCDIR)
171 install -p -m 0644 $(BUILDDIR)/Makefile $@
172 install -p -m 0755 $(GENERATE) $(TTPOSTPROC) $(LGC) $(NORMALIZE) \
173 $(UNICOVER) $(LANGCOVER) $(STATUS) $(PROBLEMS) \
174 $@/$(SCRIPTSDIR)
175 install -p -m 0644 $(FULLSFD) $@/$(SRCDIR)
176 install -p -m 0644 $(FONTCONF) $@/$(FONTCONFDIR)
177 install -p -m 0644 $(addprefix $(BUILDDIR)/, $(GENDOCFULL)) \
178 $(STATICDOC) $(STATICSRCDOC) $@/$(DOCDIR)
180 $(TMPDIR)/$(FULLARCHIVE): full
181 @echo "[8] => $@"
182 install -d -m 0755 $@/$(TTFDIR)
183 install -d -m 0755 $@/$(FONTCONFDIR)
184 install -d -m 0755 $@/$(DOCDIR)
185 install -p -m 0644 $(FULLTTF) $@/$(TTFDIR)
186 install -p -m 0644 $(FONTCONFFULL) $@/$(FONTCONFDIR)
187 install -p -m 0644 $(addprefix $(BUILDDIR)/, $(GENDOCFULL)) \
188 $(STATICDOC) $@/$(DOCDIR)
190 $(TMPDIR)/$(SANSARCHIVE): sans
191 @echo "[8] => $@"
192 install -d -m 0755 $@/$(TTFDIR)
193 install -d -m 0755 $@/$(DOCDIR)
194 install -p -m 0644 $(BUILDDIR)/DejaVuSans.ttf $@/$(TTFDIR)
195 install -p -m 0644 $(addprefix $(BUILDDIR)/, $(GENDOCSANS)) \
196 $(STATICDOC) $@/$(DOCDIR)
198 $(TMPDIR)/$(LGCARCHIVE): lgc
199 @echo "[8] => $@"
200 install -d -m 0755 $@/$(TTFDIR)
201 install -d -m 0755 $@/$(FONTCONFDIR)
202 install -d -m 0755 $@/$(DOCDIR)
203 install -p -m 0644 $(LGCTTF) $@/$(TTFDIR)
204 install -p -m 0644 $(FONTCONFLGC) $@/$(FONTCONFDIR)
205 install -p -m 0644 $(addprefix $(BUILDDIR)/, $(GENDOCLGC)) \
206 $(STATICDOC) $@/$(DOCDIR)
208 $(DISTDIR)/%.zip: $(TMPDIR)/%
209 @echo "[9] => $@"
210 install -d $(dir $@)
211 (cd $(TMPDIR); zip -rv $(abspath $@) $(notdir $<))
213 $(DISTDIR)/%.tar.bz2: $(TMPDIR)/%
214 @echo "[9] => $@"
215 install -d $(dir $@)
216 (cd $(TMPDIR); tar cjvf $(abspath $@) $(notdir $<))
218 %.md5: %
219 @echo "[10] => $@"
220 (cd $(dir $<); md5sum -b $(notdir $<) > $(abspath $@))
222 %.sha512: %
223 @echo "[10] => $@"
224 (cd $(dir $<); sha512sum -b $(notdir $<) > $(abspath $@))
226 %.sfd.norm: %.sfd
227 @echo "[11] $< => $@"
228 $(NORMALIZE) $<
229 touch -r $< $@
231 check : $(NORMSFD)
232 for sfd in $^ ; do \
233 echo "[12] Checking $$sfd" ;\
234 $(PROBLEMS) $$sfd ;\
235 done
237 munge: $(NORMSFD)
238 for sfd in $(SFDFILES) ; do \
239 echo "[13] $(TMPDIR)/$$sfd.norm => $(SRCDIR)/$$sfd" ;\
240 cp $(TMPDIR)/$$sfd.norm $(SRCDIR)/$$sfd ;\
241 done
243 full : $(FULLTTF) $(addprefix $(BUILDDIR)/, $(GENDOCFULL))
245 sans : $(addprefix $(BUILDDIR)/, DejaVuSans.ttf $(GENDOCSANS))
247 lgc : $(LGCTTF) $(addprefix $(BUILDDIR)/, $(GENDOCLGC))
249 ttf : full-ttf sans-ttf lgc-ttf
251 full-ttf : $(FULLTTF)
253 sans-ttf: $(BUILDDIR)/DejaVuSans.ttf
255 lgc-ttf : $(LGCTTF)
257 status : $(addprefix $(BUILDDIR)/, $(GENDOCFULL))
259 dist : src-dist full-dist sans-dist lgc-dist
261 src-dist : $(addprefix $(DISTDIR)/$(SRCARCHIVE), $(ARCHIVEEXT) $(SUMEXT))
263 full-dist : $(addprefix $(DISTDIR)/$(FULLARCHIVE), $(ARCHIVEEXT) $(SUMEXT))
265 sans-dist : $(addprefix $(DISTDIR)/$(SANSARCHIVE), $(ARCHIVEEXT) $(SUMEXT))
267 lgc-dist : $(addprefix $(DISTDIR)/$(LGCARCHIVE), $(ARCHIVEEXT) $(SUMEXT))
269 norm : $(NORMSFD)
271 check-harder : clean check
273 pre-patch : munge clean
275 clean :
276 $(RM) -r $(TMPDIR) $(BUILDDIR) $(DISTDIR)
278 condensed: $(NORMSFD)
279 $(NARROW) 90 $(TMPDIR)/DejaVuSans.sfd.norm
280 $(NARROW) 90 $(TMPDIR)/DejaVuSans-Bold.sfd.norm
281 $(NARROW) 90 $(TMPDIR)/DejaVuSans-Oblique.sfd.norm
282 $(NARROW) 90 $(TMPDIR)/DejaVuSans-BoldOblique.sfd.norm
283 $(NARROW) 90 $(TMPDIR)/DejaVuSerif.sfd.norm
284 $(NARROW) 90 $(TMPDIR)/DejaVuSerif-Bold.sfd.norm
285 $(NARROW) 90 $(TMPDIR)/DejaVuSerif-Italic.sfd.norm
286 $(NARROW) 90 $(TMPDIR)/DejaVuSerif-BoldItalic.sfd.norm
287 $(NORMALIZE) $(TMPDIR)/DejaVuSans.sfd.norm.narrow
288 $(NORMALIZE) $(TMPDIR)/DejaVuSans-Bold.sfd.norm.narrow
289 $(NORMALIZE) $(TMPDIR)/DejaVuSans-Oblique.sfd.norm.narrow
290 $(NORMALIZE) $(TMPDIR)/DejaVuSans-BoldOblique.sfd.norm.narrow
291 $(NORMALIZE) $(TMPDIR)/DejaVuSerif.sfd.norm.narrow
292 $(NORMALIZE) $(TMPDIR)/DejaVuSerif-Bold.sfd.norm.narrow
293 $(NORMALIZE) $(TMPDIR)/DejaVuSerif-Italic.sfd.norm.narrow
294 $(NORMALIZE) $(TMPDIR)/DejaVuSerif-BoldItalic.sfd.norm.narrow
295 cp $(TMPDIR)/DejaVuSans.sfd.norm.narrow.norm $(TMPDIR)/DejaVuSansCondensed.sfd.norm
296 cp $(TMPDIR)/DejaVuSans-Bold.sfd.norm.narrow.norm $(TMPDIR)/DejaVuSansCondensed-Bold.sfd.norm
297 cp $(TMPDIR)/DejaVuSans-Oblique.sfd.norm.narrow.norm $(TMPDIR)/DejaVuSansCondensed-Oblique.sfd.norm
298 cp $(TMPDIR)/DejaVuSans-BoldOblique.sfd.norm.narrow.norm $(TMPDIR)/DejaVuSansCondensed-BoldOblique.sfd.norm
299 cp $(TMPDIR)/DejaVuSerif.sfd.norm.narrow.norm $(TMPDIR)/DejaVuSerifCondensed.sfd.norm
300 cp $(TMPDIR)/DejaVuSerif-Bold.sfd.norm.narrow.norm $(TMPDIR)/DejaVuSerifCondensed-Bold.sfd.norm
301 cp $(TMPDIR)/DejaVuSerif-Italic.sfd.norm.narrow.norm $(TMPDIR)/DejaVuSerifCondensed-Italic.sfd.norm
302 cp $(TMPDIR)/DejaVuSerif-BoldItalic.sfd.norm.narrow.norm $(TMPDIR)/DejaVuSerifCondensed-BoldItalic.sfd.norm