2 # Makefile to build a version of GNU Unifont with the
3 # unifoundry.com GNU Unifont utilities. This Makefile
4 # converts unifont-$(VERSION).hex and related files into a final
5 # GNU Unifont font file.
7 # This software is released under version 2.0 of the GNU Public License,
8 # or (at your option) a later version of the GPL.
10 # Paul Hardy, 7 July 2008
12 # commands will be interpreted with the Bourne Shell
18 # assembly date of this version
22 VERSION = $(MAJORVERSION).$(DATE)
24 COPYRIGHT = "Copyright (C) 2014 Roman Czyborra, Paul Hardy, Qianqian Fang, \
25 Andrew Miller, et al. \
26 Licensed under the GNU General Public License; either version 2, or \
27 (at your option) a later version, with the GNU Font Embedding Exception."
30 # Path to local unifont-bin utilities. If your system doesn't
31 # use GNU's version of "make", use the first BINDIR definition.
32 # If using GNU's "make", use the second BINDIR definition.
35 BINDIR = $(CURDIR)/../bin
37 # The top-level directory for installing fonts on the system,
38 # and the installation directories for PCF and TrueType fonts.
40 CONSOLEDEST = $(DESTDIR)/usr/share/consolefonts
41 FONTDEST = $(DESTDIR)/usr/share/fonts
42 PCFDEST = $(FONTDEST)/X11/misc
43 TTFDEST = $(FONTDEST)/truetype/unifont
45 # destination directory for compiled fonts
47 COMPILED_DIR = compiled
49 # destination directory for .bmp representation of font
51 BMPDIR = $(COMPILED_DIR)/bmp
53 # Directory with original unifont-$(VERSION).hex files
57 # These are the files for building GNU Unifont with the Qianqian Fang's
58 # Wen Quan Yi CJK ideographs. This version provides complete coverage
59 # of the Unicode Basic Multilingual Plane.
61 # If you want don't want to inlcude blank glyphs in unassigned code points,
62 # uncomment the UNASSIGNED definition or override from the make command line.
64 # Likewise, uncomment the PUA definiation if you want to use Private
67 UNASSIGNED = $(HEXDIR)/unassigned.hex
71 # Non-printing glyphs. There are only about 100 of these, and many end
72 # users do want to print representations of these glyphs, so they are
73 # included as an optional assignment.
75 NONPRINTING = $(HEXDIR)/nonprinting.hex
79 # Private Use Area glyphs. Uncomment to include four-digit hexadecimal glyphs
80 # or override from the make command line.
82 # PUA = $(HEXDIR)/pua.hex
85 # The remaining .hex files will be constant unless a customized font
87 UNIFONTBASE = $(HEXDIR)/unifont-base.hex
88 CJK = $(HEXDIR)/wqy.hex
89 HANGUL = $(HEXDIR)/hangul-syllables.hex
90 SPACES = $(HEXDIR)/spaces.hex
92 UNIFILES = $(UNIFONTBASE) $(CJK) $(HANGUL) $(SPACES) $(UNASSIGNED) \
96 # Planes 1 through 14 (0x0E) are ordinary;
97 # Planes 15 (0x0F) and 16 (0x10) are Private Use Area
99 UPPER_FILES = plane0[1-E]/*.hex
102 # Location of the file containing a list of Unicode combining characters.
104 COMBINING = plane00/bmp-combining.txt
106 UPPER_COMBINING = plane0[0-E]/*combining*.txt
108 VPATH = plane00 ttfsrc
111 # Location of TTF source directory, where TTF font is built.
118 compiled: $(UNIFILES) $(COMBINING) $(UPPER_FILES) $(UPPER_COMBINING)
121 compiled-files: pcf psf bmp ttf csurttf upperttf uppercsurttf bigpic coverage
122 install -p index.html $(COMPILED_DIR)/index.html
125 # Build the aggregate .hex font files
128 if [ ! -d $(COMPILED_DIR) ] ; then \
129 mkdir -p $(COMPILED_DIR) ; \
131 sort $(UNIFILES) > $(COMPILED_DIR)/unifont-$(VERSION).hex
132 (cd $(HEXDIR) ; sort *.hex) | \
133 egrep -v "^FFF[EF]" | \
134 $(BINDIR)/unigencircles $(COMBINING) plane00/nonprinting.hex \
135 > $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
136 sort plane00csur/*.hex $(UNIFILES) \
137 > $(COMPILED_DIR)/unifont_csur-$(VERSION).hex
138 sort $(UPPER_FILES) \
139 > $(COMPILED_DIR)/unifont_upper-$(VERSION).hex
140 sort plane0[1-F]/*.hex \
141 > $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex
144 # Build a BDF font file from the final .hex file.
147 # First make the default BDF font. The font name will be "unifont".
148 $(BINDIR)/hex2bdf --version "$(VERSION)" --copyright $(COPYRIGHT) \
149 $(COMPILED_DIR)/unifont-$(VERSION).hex \
150 >$(COMPILED_DIR)/unifont-$(VERSION).bdf
151 gzip -f -9 <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
152 >$(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
153 # Now make a version with combining circles. The font name
154 # will be "unifont_sample" instead of "unifont" to distinguish
155 # it from the default font.
156 $(BINDIR)/hex2bdf --font "Unifont Sample" \
157 --version "$(VERSION)" --copyright $(COPYRIGHT) \
158 $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
159 > $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf
160 gzip -f -9 <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
161 >$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz
162 $(BINDIR)/hex2bdf --font "Unifont CSUR" \
163 --version "$(VERSION)" --copyright $(COPYRIGHT) \
164 $(COMPILED_DIR)/unifont_csur-$(VERSION).hex \
165 > $(COMPILED_DIR)/unifont_csur-$(VERSION).bdf
166 gzip -f -9 <$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf \
167 >$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf.gz
168 $(BINDIR)/hex2bdf --font "Unifont Upper" \
169 --version "$(VERSION)" --copyright $(COPYRIGHT) \
170 $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
171 > $(COMPILED_DIR)/unifont_upper-$(VERSION).bdf
172 gzip -f -9 <$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf \
173 >$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf.gz
174 $(BINDIR)/hex2bdf --font "Unifont Upper CSUR" \
175 --version "$(VERSION)" --copyright $(COPYRIGHT) \
176 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
177 > $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf
178 gzip -f -9 <$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf \
179 >$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf.gz
182 # Build a PCF font file from the final .hex file.
185 bdftopcf <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
186 >$(COMPILED_DIR)/unifont-$(VERSION).pcf
187 gzip -f -9 $(COMPILED_DIR)/unifont-$(VERSION).pcf
188 bdftopcf <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
189 >$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
190 gzip -f -9 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
191 bdftopcf <$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf \
192 >$(COMPILED_DIR)/unifont_csur-$(VERSION).pcf
193 gzip -f -9 $(COMPILED_DIR)/unifont_csur-$(VERSION).pcf
194 bdftopcf <$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf \
195 >$(COMPILED_DIR)/unifont_upper-$(VERSION).pcf
196 gzip -f -9 $(COMPILED_DIR)/unifont_upper-$(VERSION).pcf
197 bdftopcf <$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf \
198 >$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf
199 gzip -f -9 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf
202 # Make the PSF (console) font for APL (A Programming Language).
206 $(COMPILED_DIR)/unifont-$(VERSION).bdf \
207 psf/apl-equivalents.txt \
208 psf/unifont-apl.txt \
210 $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf
211 gzip -f -9 $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf
214 # Print coverage of scripts in Basic Multilingual Plane in .txt file.
216 # Note: can't use this older version unless unassigned.hex is merged
217 # with the rest of the built unifont-$(VERSION).hex final file.
219 # coverage: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unicoverage
220 # $(BINDIR)/unicoverage < $(COMPILED_DIR)/unifont-$(VERSION).hex \
221 # > $(COMPILED_DIR)/coverage.txt
223 # Use this version because "unassigned.hex" isn't part of the final
224 # .hex font by default now:
227 sort $(HEXDIR)/*.hex | \
228 $(BINDIR)/unicoverage > $(COMPILED_DIR)/coverage.txt
231 # Print HTML page coverage in Basic Multilingual Plane in .txt file.
233 pagecount: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unipagecount
234 $(BINDIR)/unipagecount -l < $(COMPILED_DIR)/unifont-$(VERSION).hex \
235 > $(COMPILED_DIR)/pagecount.html
238 # Create the .bmp (Windows Bitmap) graphics versions of the glyphs.
240 bmp: hex $(BINDIR)/unihex2bmp
241 if [ ! -d $(BMPDIR) ] ; then \
242 mkdir -p $(BMPDIR) ; \
244 for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
245 for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
246 $(BINDIR)/unihex2bmp -p$$i$$j \
247 -i$(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
248 -o$(BMPDIR)/uni$$i$$j.bmp ; \
251 echo "Done creating $(BMPDIR)"
254 # Build one bitmap of the entire Unifont as a 4096 x 16 grid.
255 # Use all the .hex files in $(HEXDIR) so we add the contents of
256 # omit.hex (FFFE & FFFF). Those two glyphs aren't included in the
257 # unifont_sample font because they cause problems with MS Windows,
258 # but we can put them in the picture.
260 bigpic: $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
261 sort -u $(HEXDIR)/*.hex | \
262 $(BINDIR)/unifontpic -d120 > $(COMPILED_DIR)/unifont-$(VERSION).bmp
265 # Note that $(TTFSRC) must exist, because it contains some source files
266 # Perform a "make && make clean" because ALL of the files would consume
267 # over 200 Megabytes if left around. The .sfd file is about 100 Megabytes,
268 # and it is created from merging "[0-F].sfd", which take up another 100 MB.
272 # First copy the ordinary version, to make a TrueType font.
274 $(COMPILED_DIR)/unifont-$(VERSION).hex \
275 $(TTFSRC)/unifont.hex
277 $(HEXDIR)/bmp-combining.txt \
278 $(TTFSRC)/combining.txt
280 make FONTFILE="unifont" COMBINING="combining" \
281 FONTNAME="Unifont" PSNAME="Unifont"
282 mv $(TTFSRC)/unifont.sfd $(COMPILED_DIR)/unifont-$(VERSION).sfd
283 mv $(TTFSRC)/unifont.ttf \
284 $(COMPILED_DIR)/unifont-$(VERSION).ttf
285 # Second copy unifont_sample.bdf, to make an SBIT font.
287 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
288 $(TTFSRC)/unifont_sample.bdf
290 make sbit FONTFILE="unifont_sample" COMBINING="" \
291 FONTNAME="Unifont Sample" PSNAME="UnifontSample"
292 mv $(TTFSRC)/unifont_sample.ttf \
293 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf
294 gzip -f -9 $(COMPILED_DIR)/unifont-$(VERSION).sfd
297 # Now build the ConScript Unicode Registry PUA font.
301 $(COMPILED_DIR)/unifont_csur-$(VERSION).hex \
302 $(TTFSRC)/unifont_csur.hex
303 sort -u plane00csur/csur-combining.txt $(HEXDIR)/bmp-combining.txt \
304 > $(TTFSRC)/combining_csur.txt
306 make outline FONTFILE="unifont_csur" COMBINING="combining_csur" \
307 FONTNAME="Unifont CSUR" PSNAME="UnifontCSUR"
308 mv $(TTFSRC)/unifont_csur.sfd \
309 $(COMPILED_DIR)/unifont_csur-$(VERSION).sfd
310 mv $(TTFSRC)/unifont_csur.ttf \
311 $(COMPILED_DIR)/unifont_csur-$(VERSION).ttf
312 gzip -f -9 $(COMPILED_DIR)/unifont_csur-$(VERSION).sfd
315 # Now build the ConScript Unicode Registry PUA font.
319 $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
320 $(TTFSRC)/unifont_upper.hex
321 sort -u $(UPPER_COMBINING) > $(TTFSRC)/combining_upper.txt
323 make outline FONTFILE="unifont_upper" COMBINING="combining_upper" \
324 FONTNAME="Unifont Upper" PSNAME="UnifontUpper"
325 mv $(TTFSRC)/unifont_upper.sfd \
326 $(COMPILED_DIR)/unifont_upper-$(VERSION).sfd
327 mv $(TTFSRC)/unifont_upper.ttf \
328 $(COMPILED_DIR)/unifont_upper-$(VERSION).ttf
329 gzip -f -9 $(COMPILED_DIR)/unifont_upper-$(VERSION).sfd
333 # ConScript Unicode Registry PUA font beyond Plane 0.
337 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
338 $(TTFSRC)/unifont_upper_csur.hex
339 sort -u plane0[1-F]csur/*combining*.txt \
340 > $(TTFSRC)/combining_upper_csur.txt
342 make outline FONTFILE="unifont_upper_csur" COMBINING="combining_upper_csur" \
343 FONTNAME="Unifont Upper CSUR" PSNAME="UnifontUpperCSUR"
344 mv $(TTFSRC)/unifont_upper_csur.sfd \
345 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).sfd
346 mv $(TTFSRC)/unifont_upper_csur.ttf \
347 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf
348 gzip -f -9 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).sfd
352 # Copy the newly created files from $(COMPILED_DIR) to the precompiled/
353 # directory. This has to be called manually, because the precompiled/
354 # directory usually remains untouched.
358 install -m0755 -d precompiled
359 install -m0644 -p $(COMPILED_DIR)/unifont-$(VERSION).hex \
360 $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz \
361 $(COMPILED_DIR)/unifont-$(VERSION).pcf.gz \
362 $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf.gz \
363 $(COMPILED_DIR)/unifont-$(VERSION).ttf \
364 $(COMPILED_DIR)/unifont_csur-$(VERSION).pcf.gz \
365 $(COMPILED_DIR)/unifont_csur-$(VERSION).ttf \
366 $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
367 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz \
368 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz \
369 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf \
370 $(COMPILED_DIR)/coverage.txt \
371 $(COMPILED_DIR)/unifont-$(VERSION).bmp \
372 $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
373 $(COMPILED_DIR)/unifont_upper-$(VERSION).bdf.gz \
374 $(COMPILED_DIR)/unifont_upper-$(VERSION).pcf.gz \
375 $(COMPILED_DIR)/unifont_upper-$(VERSION).ttf \
376 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
377 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf.gz \
378 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf.gz \
379 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf \
383 # This is set up for Debian. Solaris places fonts in
384 # "/usr/share/fonts/TrueType". Other unices use other directories.
385 # The original font format was BDF, but Debian doesn't use that and
386 # xfs should only need TrueType, so the BDF font isn't installed.
388 # The TrueType font is about 16 Megabytes. To avoid duplication,
389 # the fonts are installed as symbolic links back to the original package.
390 # Alternatively, the fonts can be copied to the destination directory
391 # with "install -m0644" or moved there (but "mv" is a destructive
392 # one-time operation).
394 # After installing the new fonts, register them with X Window System using:
399 if [ x$(CURDIR) = x ] ; \
401 echo "Fatal Error: CURDIR not defined -- define in Makefile." ; \
404 $(INSTALL) -m0755 -d $(CONSOLEDEST)
405 $(INSTALL) -m0755 -d $(PCFDEST)
406 $(INSTALL) -m0755 -d $(TTFDEST)
407 if [ ! -d $(COMPILED_DIR) ] ; then \
408 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/Unifont-APL8x16-$(VERSION).psf.gz $(CONSOLEDEST)/Unifont-APL8x16.psf.gz ; \
409 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
410 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
411 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_csur-$(VERSION).pcf.gz $(PCFDEST)/unifont_csur.pcf.gz ; \
412 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).ttf $(TTFDEST)/unifont.ttf ; \
413 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).ttf $(TTFDEST)/unifont_sample.ttf ; \
414 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_csur-$(VERSION).ttf $(TTFDEST)/unifont_csur.ttf ; \
415 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_upper-$(VERSION).ttf $(TTFDEST)/unifont_upper.ttf ; \
416 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_upper_csur-$(VERSION).ttf $(TTFDEST)/unifont_upper_csur.ttf ; \
418 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf.gz $(CONSOLEDEST)/Unifont-APL8x16.psf.gz ; \
419 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
420 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
421 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_csur-$(VERSION).pcf.gz $(PCFDEST)/unifont_csur.pcf.gz ; \
422 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).ttf $(TTFDEST)/unifont.ttf ; \
423 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).ttf $(TTFDEST)/unifont_sample.ttf ; \
424 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_csur-$(VERSION).ttf $(TTFDEST)/unifont_csur.ttf ; \
425 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_upper-$(VERSION).ttf $(TTFDEST)/unifont_upper.ttf ; \
426 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf $(TTFDEST)/unifont_upper_csur.ttf ; \
430 \rm -rf $(COMPILED_DIR)/bmp
431 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).hex
432 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf
433 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
437 # Note that distclean leaves precompiled/ alone. This is intentional.
438 # The .DS files are created under Mac OS X.
441 \rm -rf $(COMPILED_DIR)
442 $(MAKE) -C ttfsrc distclean
446 .PHONY: all hex bdf pcf coverage pagecount bmp bigpic csurttf upper ttf \
447 precompiled install clean distclean