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 $(FONTFORGE) -lang=ff -c \
154 SetFontNames("UnifontMedium", "GNU", "Unifont", "Medium", $(COPYRIGHT), "$(VERSION)"); \
156 $(COMPILED_DIR)/unifont-$(VERSION).pcf
157 gzip -f -9 $(COMPILED_DIR)/unifont-$(VERSION).pcf
158 bdftopcf <$(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
159 >$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
160 $(FONTFORGE) -lang=ff -c \
162 SetFontNames("UnifontSampleMedium", "GNU", "Unifont Sample", "Medium", $(COPYRIGHT), "$(VERSION)"); \
164 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
165 gzip -f -9 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf
168 # Print coverage of scripts in Basic Multilingual Plane in .txt file.
170 # Note: can't use this older version unless unassigned.hex is merged
171 # with the rest of the built unifont-$(VERSION).hex final file.
173 # coverage: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unicoverage
174 # $(BINDIR)/unicoverage < $(COMPILED_DIR)/unifont-$(VERSION).hex \
175 # > $(COMPILED_DIR)/coverage.txt
177 # Use this version because "unassigned.hex" isn't part of the final
178 # .hex font by default now:
181 sort $(HEXDIR)/*.hex | \
182 $(BINDIR)/unicoverage > $(COMPILED_DIR)/coverage.txt
185 # Print HTML page coverage in Basic Multilingual Plane in .txt file.
187 pagecount: $(COMPILED_DIR)/unifont-$(VERSION).hex $(BINDIR)/unipagecount
188 $(BINDIR)/unipagecount -l < $(COMPILED_DIR)/unifont-$(VERSION).hex \
189 > $(COMPILED_DIR)/pagecount.html
192 # Create the .bmp (Windows Bitmap) graphics versions of the glyphs.
194 bmp: hex $(BINDIR)/unihex2bmp
195 if [ ! -d $(BMPDIR) ] ; then \
196 mkdir -p $(BMPDIR) ; \
198 for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
199 for j in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do \
200 $(BINDIR)/unihex2bmp -p$$i$$j \
201 -i$(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
202 -o$(BMPDIR)/uni$$i$$j.bmp ; \
205 echo "Done creating $(BMPDIR)"
208 # Build one bitmap of the entire Unifont as a 4096 x 16 grid.
210 bigpic: $(COMPILED_DIR)/unifont_sample-$(VERSION).hex
211 cat $(COMPILED_DIR)/unifont_sample-$(VERSION).hex | \
212 $(BINDIR)/unifontpic -d120 > $(COMPILED_DIR)/unifont-$(VERSION).bmp
215 # Note that $(TTFSRC) must exist, because it contains some source files
216 # Perform a "make && make clean" because ALL of the files would consume
217 # over 200 Megabytes if left around. The .sfd file is about 100 Megabytes,
218 # and it is created from merging "[0-F].sfd", which take up another 100 MB.
222 # First copy the ordinary version, to make a TrueType font.
224 $(COMPILED_DIR)/unifont-$(VERSION).hex \
225 $(TTFSRC)/unifont.hex
226 # Second copy unifont_sample.bdf, to make an SBIT font.
228 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf \
229 $(TTFSRC)/unifont_sample.bdf
230 cd $(TTFSRC) ; make && make clean
231 mv $(TTFSRC)/unifont.sfd $(COMPILED_DIR)/unifont.sfd
232 mv $(TTFSRC)/unifont.ttf \
233 $(COMPILED_DIR)/unifont-$(VERSION).ttf
234 mv $(TTFSRC)/unifont_sample.ttf \
235 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf
236 gzip -f -9 $(COMPILED_DIR)/unifont.sfd
239 # Copy the newly created files from $(COMPILED_DIR) to the precompiled/
240 # directory. This has to be called manually, because the precompiled/
241 # directory usually remains untouched.
245 install -m0755 -d precompiled
246 install -m0644 -p $(COMPILED_DIR)/unifont-$(VERSION).hex \
247 $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz \
248 $(COMPILED_DIR)/unifont-$(VERSION).pcf.gz \
249 $(COMPILED_DIR)/unifont-$(VERSION).ttf \
250 $(COMPILED_DIR)/unifont_sample-$(VERSION).hex \
251 $(COMPILED_DIR)/unifont_sample-$(VERSION).bdf.gz \
252 $(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz \
253 $(COMPILED_DIR)/unifont_sample-$(VERSION).ttf \
254 $(COMPILED_DIR)/coverage.txt \
255 $(COMPILED_DIR)/unifont-$(VERSION).bmp \
259 # This is set up for Debian. Solaris places fonts in
260 # "/usr/share/fonts/TrueType". Other unices use other directories.
261 # The original font format was BDF, but Debian doesn't use that and
262 # xfs should only need TrueType, so the BDF font isn't installed.
264 # The TrueType font is about 16 Megabytes. To avoid duplication,
265 # the fonts are installed as symbolic links back to the original package.
266 # Alternatively, the fonts can be copied to the destination directory
267 # with "install -m0644" or moved there (but "mv" is a destructive
268 # one-time operation).
270 # After installing the new fonts, register them with X Window System using:
275 if [ x$(CURDIR) = x ] ; \
277 echo "Fatal Error: CURDIR not defined -- define in Makefile." ; \
280 $(INSTALL) -m0755 -d $(PCFDEST)
281 $(INSTALL) -m0755 -d $(TTFDEST)
282 if [ ! -d $(COMPILED_DIR) ] ; then \
283 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
284 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
285 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont-$(VERSION).ttf $(TTFDEST)/unifont.ttf ; \
286 $(INSTALL) -m0644 -p $(CURDIR)/precompiled/unifont_sample-$(VERSION).ttf $(TTFDEST)/unifont_sample.ttf ; \
288 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).pcf.gz $(PCFDEST)/unifont.pcf.gz ; \
289 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).pcf.gz $(PCFDEST)/unifont_sample.pcf.gz ; \
290 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont-$(VERSION).ttf $(TTFDEST)/unifont.ttf ; \
291 $(INSTALL) -m0644 -p $(CURDIR)/$(COMPILED_DIR)/unifont_sample-$(VERSION).ttf $(TTFDEST)/unifont_sample.ttf ; \
295 \rm -rf $(COMPILED_DIR)/bmp
296 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).hex
297 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf
298 \rm -f $(COMPILED_DIR)/unifont-$(VERSION).bdf.gz
302 # Note that distclean leaves precompiled/ alone. This is intentional.
303 # The .DS files are created under Mac OS X.
306 \rm -rf $(COMPILED_DIR)
307 $(MAKE) -C ttfsrc distclean
311 .PHONY: all hex bdf pcf coverage pagecount bmp bigpic ttf precompiled install clean distclean