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) 2013 Roman Czyborra, Paul Hardy, 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 FONTDEST = $(DESTDIR)/usr/share/fonts
40 PCFDEST = $(FONTDEST)/X11/misc
41 TTFDEST = $(FONTDEST)/truetype/unifont
43 # destination directory for compiled fonts
45 COMPILED_DIR = compiled
47 # destination directory for .bmp representation of font
49 BMPDIR = $(COMPILED_DIR)/bmp
51 # Directory with original unifont-$(VERSION).hex files
55 # These are the files for building GNU Unifont with the Qianqian Fang's
56 # Wen Quan Yi CJK ideographs. This version provides complete coverage
57 # of the Unicode Basic Multilingual Plane.
59 # If you want don't want to inlcude blank glyphs in unassigned code points,
60 # uncomment the UNASSIGNED definition or override from the make command line.
62 # Likewise, uncomment the PUA definiation if you want to use Private
65 UNASSIGNED = $(HEXDIR)/unassigned.hex
69 # Non-printing glyphs. There are only about 100 of these, and many end
70 # users do want to print representations of these glyphs, so they are
71 # included as an optional assignment.
73 NONPRINTING = $(HEXDIR)/nonprinting.hex
77 # Private Use Area glyphs. Uncomment to include four-digit hexadecimal glyphs
78 # or override from the make command line.
80 # PUA = $(HEXDIR)/pua.hex
83 # The remaining .hex files will be constant unless a customized font
85 UNIFONTBASE = $(HEXDIR)/unifont-base.hex
86 CJK = $(HEXDIR)/wqy.hex
87 HANGUL = $(HEXDIR)/hangul-syllables.hex
88 SPACES = $(HEXDIR)/spaces.hex
90 UNIFILES = $(UNIFONTBASE) $(CJK) $(HANGUL) $(SPACES) $(UNASSIGNED) \
94 # Location of the file containing a list of Unicode combining characters.
96 COMBINING = ttfsrc/combining.txt
101 # Location of TTF source directory, where TTF font is built.
108 compiled: $(UNIFILES) $(COMBINING)
111 compiled-files: pcf bmp ttf bigpic coverage
112 install -p index.html $(COMPILED_DIR)/index.html
115 # Build the aggregate .hex font files
118 if [ ! -d $(COMPILED_DIR) ] ; then \
119 mkdir -p $(COMPILED_DIR) ; \
121 sort $(UNIFILES) >$(COMPILED_DIR)/unifont-$(VERSION).hex
122 (cd $(HEXDIR) ; sort *.hex) | \
123 $(BINDIR)/unigencircles ttfsrc/combining.txt hexsrc/nonprinting.hex \
124 > $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
127 # Build a BDF font file from the final .hex file.
130 # First make the default BDF font. The font name will be "unifont".
131 $(BINDIR)/hex2bdf --version "$(VERSION)" --copyright $(COPYRIGHT) \
132 $(COMPILED_DIR)/unifont-$(VERSION).hex \
133 >$(COMPILED_DIR)/unifont-$(VERSION).bdf
134 gzip -f -9 <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
135 >$(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
136 # Now make a version with combining circles. The font name
137 # will be "unifont_sample" instead of "unifont" to distinguish
138 # it from the default font.
139 $(BINDIR)/hex2bdf --font "Unifont Sample" \
140 --version "$(VERSION)" --copyright $(COPYRIGHT) \
141 $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
142 > $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf
143 gzip -f -9 <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
144 >$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz
147 # Build a PCF font file from the final .hex file.
150 bdftopcf <$(COMPILED_DIR)/unifont-$(VERSION).bdf \
151 >$(COMPILED_DIR)/unifont-$(VERSION).pcf
152 gzip -f -9 $(COMPILED_DIR)/unifont-$(VERSION).pcf
153 bdftopcf <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
154 >$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
155 gzip -f -9 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
158 # Print coverage of scripts in Basic Multilingual Plane in .txt file.
160 # Note: can't use this older version unless unassigned.hex is merged
161 # with the rest of the built unifont-$(VERSION).hex final file.
163 # coverage: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unicoverage
164 # $(BINDIR)/unicoverage < $(COMPILED_DIR)/unifont-$(VERSION).hex \
165 # > $(COMPILED_DIR)/coverage.txt
167 # Use this version because "unassigned.hex" isn't part of the final
168 # .hex font by default now:
171 sort $(HEXDIR)/*.hex | \
172 $(BINDIR)/unicoverage > $(COMPILED_DIR)/coverage.txt
175 # Print HTML page coverage in Basic Multilingual Plane in .txt file.
177 pagecount: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unipagecount
178 $(BINDIR)/unipagecount -l < $(COMPILED_DIR)/unifont-$(VERSION).hex \
179 > $(COMPILED_DIR)/pagecount.html
182 # Create the .bmp (Windows Bitmap) graphics versions of the glyphs.
184 bmp: hex $(BINDIR)/unihex2bmp
185 if [ ! -d $(BMPDIR) ] ; then \
186 mkdir -p $(BMPDIR) ; \
188 for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
189 for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
190 $(BINDIR)/unihex2bmp -p$$i$$j \
191 -i$(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
192 -o$(BMPDIR)/uni$$i$$j.bmp ; \
195 echo "Done creating $(BMPDIR)"
198 # Build one bitmap of the entire Unifont as a 4096 x 16 grid.
200 bigpic: $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
201 cat $(COMPILED_DIR)/unifont_sample-$(VERSION).hex | \
202 $(BINDIR)/unifontpic -d120 > $(COMPILED_DIR)/unifont-$(VERSION).bmp
205 # Note that $(TTFSRC) must exist, because it contains some source files
206 # Perform a "make && make clean" because ALL of the files would consume
207 # over 200 Megabytes if left around. The .sfd file is about 100 Megabytes,
208 # and it is created from merging "[0-F].sfd", which take up another 100 MB.
212 # First copy the ordinary version, to make a TrueType font.
214 $(COMPILED_DIR)/unifont-$(VERSION).hex \
215 $(TTFSRC)/unifont.hex
216 # Second copy unifont_sample.bdf, to make an SBIT font.
218 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
219 $(TTFSRC)/unifont_sample.bdf
220 cd $(TTFSRC) ; make && make clean
221 mv $(TTFSRC)/unifont.sfd $(COMPILED_DIR)/unifont-$(VERSION).sfd
222 mv $(TTFSRC)/unifont.ttf \
223 $(COMPILED_DIR)/unifont-$(VERSION).ttf
224 mv $(TTFSRC)/unifont_sample.ttf \
225 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf
226 gzip -f -9 $(COMPILED_DIR)/unifont-$(VERSION).sfd
229 # Copy the newly created files from $(COMPILED_DIR) to the precompiled/
230 # directory. This has to be called manually, because the precompiled/
231 # directory usually remains untouched.
235 install -m0755 -d precompiled
236 install -m0644 -p $(COMPILED_DIR)/unifont-$(VERSION).hex \
237 $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz \
238 $(COMPILED_DIR)/unifont-$(VERSION).pcf.gz \
239 $(COMPILED_DIR)/unifont-$(VERSION).ttf \
240 $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
241 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz \
242 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz \
243 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf \
244 $(COMPILED_DIR)/coverage.txt \
245 $(COMPILED_DIR)/unifont-$(VERSION).bmp \
249 # This is set up for Debian. Solaris places fonts in
250 # "/usr/share/fonts/TrueType". Other unices use other directories.
251 # The original font format was BDF, but Debian doesn't use that and
252 # xfs should only need TrueType, so the BDF font isn't installed.
254 # The TrueType font is about 16 Megabytes. To avoid duplication,
255 # the fonts are installed as symbolic links back to the original package.
256 # Alternatively, the fonts can be copied to the destination directory
257 # with "install -m0644" or moved there (but "mv" is a destructive
258 # one-time operation).
260 # After installing the new fonts, register them with X Window System using:
265 if [ x$(CURDIR) = x ] ; \
267 echo "Fatal Error: CURDIR not defined -- define in Makefile." ; \
270 $(INSTALL) -m0755 -d $(PCFDEST)
271 $(INSTALL) -m0755 -d $(TTFDEST)
272 if [ ! -d $(COMPILED_DIR) ] ; then \
273 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
274 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
275 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).ttf $(TTFDEST)/unifont.ttf ; \
276 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).ttf $(TTFDEST)/unifont_sample.ttf ; \
278 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
279 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
280 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).ttf $(TTFDEST)/unifont.ttf ; \
281 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).ttf $(TTFDEST)/unifont_sample.ttf ; \
285 \rm -rf $(COMPILED_DIR)/bmp
286 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).hex
287 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf
288 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
292 # Note that distclean leaves precompiled/ alone. This is intentional.
293 # The .DS files are created under Mac OS X.
296 \rm -rf $(COMPILED_DIR)
297 $(MAKE) -C ttfsrc distclean
301 .PHONY: all hex bdf pcf coverage pagecount bmp bigpic ttf precompiled install clean distclean