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, Andrew Miller, et al. \
25 Licensed under the GNU General Public License; either version 2, or \
26 (at your option) a later version, with the GNU Font Embedding Exception."
29 # Path to local unifont-bin utilities. If your system doesn't
30 # use GNU's version of "make", use the first BINDIR definition.
31 # If using GNU's "make", use the second BINDIR definition.
34 BINDIR = $(CURDIR)/../bin
36 # The top-level directory for installing fonts on the system,
37 # and the installation directories for PCF and TrueType fonts.
39 CONSOLEDEST = $(DESTDIR)/usr/share/consolefonts
40 FONTDEST = $(DESTDIR)/usr/share/fonts
41 PCFDEST = $(FONTDEST)/X11/misc
42 TTFDEST = $(FONTDEST)/truetype/unifont
44 # destination directory for compiled fonts
46 COMPILED_DIR = compiled
48 # destination directory for .bmp representation of font
50 BMPDIR = $(COMPILED_DIR)/bmp
52 # Directory with original unifont-$(VERSION).hex files
56 # These are the files for building GNU Unifont with the Qianqian Fang's
57 # Wen Quan Yi CJK ideographs. This version provides complete coverage
58 # of the Unicode Basic Multilingual Plane.
60 # If you want don't want to inlcude blank glyphs in unassigned code points,
61 # uncomment the UNASSIGNED definition or override from the make command line.
63 # Likewise, uncomment the PUA definiation if you want to use Private
66 UNASSIGNED = $(HEXDIR)/unassigned.hex
70 # Non-printing glyphs. There are only about 100 of these, and many end
71 # users do want to print representations of these glyphs, so they are
72 # included as an optional assignment.
74 NONPRINTING = $(HEXDIR)/nonprinting.hex
78 # Private Use Area glyphs. Uncomment to include four-digit hexadecimal glyphs
79 # or override from the make command line.
81 # PUA = $(HEXDIR)/pua.hex
84 # The remaining .hex files will be constant unless a customized font
86 UNIFONTBASE = $(HEXDIR)/unifont-base.hex
87 CJK = $(HEXDIR)/wqy.hex
88 HANGUL = $(HEXDIR)/hangul-syllables.hex
89 SPACES = $(HEXDIR)/spaces.hex
91 UNIFILES = $(UNIFONTBASE) $(CJK) $(HANGUL) $(SPACES) $(UNASSIGNED) \
95 # Planes 1 through 14 (0x0E) are ordinary;
96 # Planes 15 (0x0F) and 16 (0x10) are Private Use Area
98 UPPER_FILES = plane0[1-E]/*.hex
101 # Location of the file containing a list of Unicode combining characters.
103 COMBINING = plane00/bmp-combining.txt
105 UPPER_COMBINING = plane0[0-E]/*combining*.txt
107 VPATH = plane00 ttfsrc
110 # Location of TTF source directory, where TTF font is built.
117 compiled: $(UNIFILES) $(COMBINING) $(UPPER_FILES) $(UPPER_COMBINING)
120 compiled-files: pcf psf bmp ttf csurttf upperttf uppercsurttf bigpic coverage
121 install -p index.html $(COMPILED_DIR)/index.html
124 # Build the aggregate .hex font files
127 if [ ! -d $(COMPILED_DIR) ] ; then \
128 mkdir -p $(COMPILED_DIR) ; \
130 sort $(UNIFILES) > $(COMPILED_DIR)/unifont-$(VERSION).hex
131 (cd $(HEXDIR) ; sort *.hex) | \
132 egrep -v "^FFF[EF]" | \
133 $(BINDIR)/unigencircles $(COMBINING) plane00/nonprinting.hex \
134 > $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
135 sort plane00csur/*.hex $(UNIFILES) \
136 > $(COMPILED_DIR)/unifont_csur-$(VERSION).hex
137 sort $(UPPER_FILES) \
138 > $(COMPILED_DIR)/unifont_upper-$(VERSION).hex
139 sort plane0[1-F]/*.hex \
140 > $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex
143 # Build a BDF font file from the final .hex file.
146 # First make the default BDF font. The font name will be "unifont".
147 $(BINDIR)/hex2bdf --version "$(VERSION)" --copyright $(COPYRIGHT) \
148 $(COMPILED_DIR)/unifont-$(VERSION).hex \
149 >$(COMPILED_DIR)/unifont-$(VERSION).bdf
150 gzip -f -9 <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
151 >$(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
152 # Now make a version with combining circles. The font name
153 # will be "unifont_sample" instead of "unifont" to distinguish
154 # it from the default font.
155 $(BINDIR)/hex2bdf --font "Unifont Sample" \
156 --version "$(VERSION)" --copyright $(COPYRIGHT) \
157 $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
158 > $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf
159 gzip -f -9 <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
160 >$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz
161 $(BINDIR)/hex2bdf --font "Unifont CSUR" \
162 --version "$(VERSION)" --copyright $(COPYRIGHT) \
163 $(COMPILED_DIR)/unifont_csur-$(VERSION).hex \
164 > $(COMPILED_DIR)/unifont_csur-$(VERSION).bdf
165 gzip -f -9 <$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf \
166 >$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf.gz
167 $(BINDIR)/hex2bdf --font "Unifont Upper" \
168 --version "$(VERSION)" --copyright $(COPYRIGHT) \
169 $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
170 > $(COMPILED_DIR)/unifont_upper-$(VERSION).bdf
171 gzip -f -9 <$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf \
172 >$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf.gz
173 $(BINDIR)/hex2bdf --font "Unifont Upper CSUR" \
174 --version "$(VERSION)" --copyright $(COPYRIGHT) \
175 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
176 > $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf
177 gzip -f -9 <$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf \
178 >$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf.gz
181 # Build a PCF font file from the final .hex file.
184 bdftopcf <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
185 >$(COMPILED_DIR)/unifont-$(VERSION).pcf
186 gzip -f -9 $(COMPILED_DIR)/unifont-$(VERSION).pcf
187 bdftopcf <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
188 >$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
189 gzip -f -9 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
190 bdftopcf <$(COMPILED_DIR)/unifont_csur-$(VERSION).bdf \
191 >$(COMPILED_DIR)/unifont_csur-$(VERSION).pcf
192 gzip -f -9 $(COMPILED_DIR)/unifont_csur-$(VERSION).pcf
193 bdftopcf <$(COMPILED_DIR)/unifont_upper-$(VERSION).bdf \
194 >$(COMPILED_DIR)/unifont_upper-$(VERSION).pcf
195 gzip -f -9 $(COMPILED_DIR)/unifont_upper-$(VERSION).pcf
196 bdftopcf <$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf \
197 >$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf
198 gzip -f -9 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf
201 # Make the PSF (console) font for APL (A Programming Language).
205 $(COMPILED_DIR)/unifont-$(VERSION).bdf \
206 psf/apl-equivalents.txt \
207 psf/unifont-apl.txt \
209 $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf
210 gzip -f -9 $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf
213 # Print coverage of scripts in Basic Multilingual Plane in .txt file.
215 # Note: can't use this older version unless unassigned.hex is merged
216 # with the rest of the built unifont-$(VERSION).hex final file.
218 # coverage: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unicoverage
219 # $(BINDIR)/unicoverage < $(COMPILED_DIR)/unifont-$(VERSION).hex \
220 # > $(COMPILED_DIR)/coverage.txt
222 # Use this version because "unassigned.hex" isn't part of the final
223 # .hex font by default now:
226 sort $(HEXDIR)/*.hex | \
227 $(BINDIR)/unicoverage > $(COMPILED_DIR)/coverage.txt
230 # Print HTML page coverage in Basic Multilingual Plane in .txt file.
232 pagecount: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unipagecount
233 $(BINDIR)/unipagecount -l < $(COMPILED_DIR)/unifont-$(VERSION).hex \
234 > $(COMPILED_DIR)/pagecount.html
237 # Create the .bmp (Windows Bitmap) graphics versions of the glyphs.
239 bmp: hex $(BINDIR)/unihex2bmp
240 if [ ! -d $(BMPDIR) ] ; then \
241 mkdir -p $(BMPDIR) ; \
243 for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
244 for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
245 $(BINDIR)/unihex2bmp -p$$i$$j \
246 -i$(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
247 -o$(BMPDIR)/uni$$i$$j.bmp ; \
250 echo "Done creating $(BMPDIR)"
253 # Build one bitmap of the entire Unifont as a 4096 x 16 grid.
254 # Use all the .hex files in $(HEXDIR) so we add the contents of
255 # omit.hex (FFFE & FFFF). Those two glyphs aren't included in the
256 # unifont_sample font because they cause problems with MS Windows,
257 # but we can put them in the picture.
259 bigpic: $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
260 sort -u $(HEXDIR)/*.hex | \
261 $(BINDIR)/unifontpic -d120 > $(COMPILED_DIR)/unifont-$(VERSION).bmp
264 # Note that $(TTFSRC) must exist, because it contains some source files
265 # Perform a "make && make clean" because ALL of the files would consume
266 # over 200 Megabytes if left around. The .sfd file is about 100 Megabytes,
267 # and it is created from merging "[0-F].sfd", which take up another 100 MB.
271 # First copy the ordinary version, to make a TrueType font.
273 $(COMPILED_DIR)/unifont-$(VERSION).hex \
274 $(TTFSRC)/unifont.hex
276 $(HEXDIR)/bmp-combining.txt \
277 $(TTFSRC)/combining.txt
279 make FONTFILE="unifont" COMBINING="combining" \
280 FONTNAME="Unifont" PSNAME="Unifont"
281 mv $(TTFSRC)/unifont.sfd $(COMPILED_DIR)/unifont-$(VERSION).sfd
282 mv $(TTFSRC)/unifont.ttf \
283 $(COMPILED_DIR)/unifont-$(VERSION).ttf
284 # Second copy unifont_sample.bdf, to make an SBIT font.
286 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
287 $(TTFSRC)/unifont_sample.bdf
289 make sbit FONTFILE="unifont_sample" COMBINING="" \
290 FONTNAME="Unifont Sample" PSNAME="UnifontSample"
291 mv $(TTFSRC)/unifont_sample.ttf \
292 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf
293 gzip -f -9 $(COMPILED_DIR)/unifont-$(VERSION).sfd
296 # Now build the ConScript Unicode Registry PUA font.
300 $(COMPILED_DIR)/unifont_csur-$(VERSION).hex \
301 $(TTFSRC)/unifont_csur.hex
302 sort -u plane00csur/csur-combining.txt $(HEXDIR)/bmp-combining.txt \
303 > $(TTFSRC)/combining_csur.txt
305 make outline FONTFILE="unifont_csur" COMBINING="combining_csur" \
306 FONTNAME="Unifont CSUR" PSNAME="UnifontCSUR"
307 mv $(TTFSRC)/unifont_csur.sfd \
308 $(COMPILED_DIR)/unifont_csur-$(VERSION).sfd
309 mv $(TTFSRC)/unifont_csur.ttf \
310 $(COMPILED_DIR)/unifont_csur-$(VERSION).ttf
311 gzip -f -9 $(COMPILED_DIR)/unifont_csur-$(VERSION).sfd
314 # Now build the ConScript Unicode Registry PUA font.
318 $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
319 $(TTFSRC)/unifont_upper.hex
320 sort -u $(UPPER_COMBINING) > $(TTFSRC)/combining_upper.txt
322 make outline FONTFILE="unifont_upper" COMBINING="combining_upper" \
323 FONTNAME="Unifont Upper" PSNAME="UnifontUpper"
324 mv $(TTFSRC)/unifont_upper.sfd \
325 $(COMPILED_DIR)/unifont_upper-$(VERSION).sfd
326 mv $(TTFSRC)/unifont_upper.ttf \
327 $(COMPILED_DIR)/unifont_upper-$(VERSION).ttf
328 gzip -f -9 $(COMPILED_DIR)/unifont_upper-$(VERSION).sfd
332 # ConScript Unicode Registry PUA font beyond Plane 0.
336 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
337 $(TTFSRC)/unifont_upper_csur.hex
338 sort -u plane0[1-F]csur/*combining*.txt \
339 > $(TTFSRC)/combining_upper_csur.txt
341 make outline FONTFILE="unifont_upper_csur" COMBINING="combining_upper_csur" \
342 FONTNAME="Unifont Upper CSUR" PSNAME="UnifontUpperCSUR"
343 mv $(TTFSRC)/unifont_upper_csur.sfd \
344 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).sfd
345 mv $(TTFSRC)/unifont_upper_csur.ttf \
346 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf
347 gzip -f -9 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).sfd
351 # Copy the newly created files from $(COMPILED_DIR) to the precompiled/
352 # directory. This has to be called manually, because the precompiled/
353 # directory usually remains untouched.
357 install -m0755 -d precompiled
358 install -m0644 -p $(COMPILED_DIR)/unifont-$(VERSION).hex \
359 $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz \
360 $(COMPILED_DIR)/unifont-$(VERSION).pcf.gz \
361 $(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf.gz \
362 $(COMPILED_DIR)/unifont-$(VERSION).ttf \
363 $(COMPILED_DIR)/unifont_csur-$(VERSION).pcf.gz \
364 $(COMPILED_DIR)/unifont_csur-$(VERSION).ttf \
365 $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
366 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz \
367 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz \
368 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf \
369 $(COMPILED_DIR)/coverage.txt \
370 $(COMPILED_DIR)/unifont-$(VERSION).bmp \
371 $(COMPILED_DIR)/unifont_upper-$(VERSION).hex \
372 $(COMPILED_DIR)/unifont_upper-$(VERSION).bdf.gz \
373 $(COMPILED_DIR)/unifont_upper-$(VERSION).pcf.gz \
374 $(COMPILED_DIR)/unifont_upper-$(VERSION).ttf \
375 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).hex \
376 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).bdf.gz \
377 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).pcf.gz \
378 $(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf \
382 # This is set up for Debian. Solaris places fonts in
383 # "/usr/share/fonts/TrueType". Other unices use other directories.
384 # The original font format was BDF, but Debian doesn't use that and
385 # xfs should only need TrueType, so the BDF font isn't installed.
387 # The TrueType font is about 16 Megabytes. To avoid duplication,
388 # the fonts are installed as symbolic links back to the original package.
389 # Alternatively, the fonts can be copied to the destination directory
390 # with "install -m0644" or moved there (but "mv" is a destructive
391 # one-time operation).
393 # After installing the new fonts, register them with X Window System using:
398 if [ x$(CURDIR) = x ] ; \
400 echo "Fatal Error: CURDIR not defined -- define in Makefile." ; \
403 $(INSTALL) -m0755 -d $(CONSOLEDEST)
404 $(INSTALL) -m0755 -d $(PCFDEST)
405 $(INSTALL) -m0755 -d $(TTFDEST)
406 if [ ! -d $(COMPILED_DIR) ] ; then \
407 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/Unifont-APL8x16-$(VERSION).psf.gz $(CONSOLEDEST)/Unifont-APL8x16.psf.gz ; \
408 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
409 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
410 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_csur-$(VERSION).pcf.gz $(PCFDEST)/unifont_csur.pcf.gz ; \
411 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).ttf $(TTFDEST)/unifont.ttf ; \
412 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).ttf $(TTFDEST)/unifont_sample.ttf ; \
413 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_csur-$(VERSION).ttf $(TTFDEST)/unifont_csur.ttf ; \
414 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_upper-$(VERSION).ttf $(TTFDEST)/unifont_upper.ttf ; \
415 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_upper_csur-$(VERSION).ttf $(TTFDEST)/unifont_upper_csur.ttf ; \
417 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/Unifont-APL8x16-$(VERSION).psf.gz $(CONSOLEDEST)/Unifont-APL8x16.psf.gz ; \
418 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
419 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
420 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_csur-$(VERSION).pcf.gz $(PCFDEST)/unifont_csur.pcf.gz ; \
421 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).ttf $(TTFDEST)/unifont.ttf ; \
422 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).ttf $(TTFDEST)/unifont_sample.ttf ; \
423 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_csur-$(VERSION).ttf $(TTFDEST)/unifont_csur.ttf ; \
424 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_upper-$(VERSION).ttf $(TTFDEST)/unifont_upper.ttf ; \
425 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_upper_csur-$(VERSION).ttf $(TTFDEST)/unifont_upper_csur.ttf ; \
429 \rm -rf $(COMPILED_DIR)/bmp
430 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).hex
431 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf
432 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
436 # Note that distclean leaves precompiled/ alone. This is intentional.
437 # The .DS files are created under Mac OS X.
440 \rm -rf $(COMPILED_DIR)
441 $(MAKE) -C ttfsrc distclean
445 .PHONY: all hex bdf pcf coverage pagecount bmp bigpic csurttf upper ttf \
446 precompiled install clean distclean