unifont-7.0.05.tar.gz
[unifont.git] / Makefile
1 #
2 # unifoundry.com utilities for the GNU Unifont
3 #
4 # Typing "make && make install" will make and
5 # install the binary programs and man pages.
6 # To build only the font from scratch, use
7 # "cd font ; make"
8 #
9 SHELL = /bin/sh
10 INSTALL = install
11
12 PACKAGE = "unifont"
13 UNICODE_VERSION = 7.0
14 PKG_REV = 05
15 VERSION = $(UNICODE_VERSION).$(PKG_REV)
16
17 #
18 # The settings below will install software, man pages, and documentation
19 # in /usr/local.  To install in a different location, modify USRDIR to
20 # your liking.
21 #
22 USRDIR = usr
23 # USRDIR = usr/local
24 PREFIX = $(DESTDIR)/$(USRDIR)
25 PKGDEST = $(PREFIX)/share/unifont
26
27 VPATH = lib font/plane00 font/ttfsrc
28
29 HEXFILES = hangul-syllables.hex nonprinting.hex pua.hex spaces.hex \
30            unassigned.hex unifont-base.hex wqy.hex
31
32 COMBINING = font/plane00/bmp-combining.txt
33
34 TEXTFILES = ChangeLog INSTALL NEWS README
35
36 #
37 # Whether to build the font or not (default is not).
38 # Set to non-null value to build font.
39 #
40 BUILDFONT=
41
42 #
43 # Whether to install man pages uncompressed (COMPRESS = 0) or
44 # compressed (COMPRESS != 0).
45 #
46 COMPRESS = 1
47
48 all: bindir libdir docdir buildfont
49         echo "Make is done."
50
51 #
52 # Build a distribution tarball.
53 #
54 dist: distclean
55         (cd .. ; tar cf $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION) && \
56                 gzip -f -9 $(PACKAGE)-$(VERSION).tar)
57
58 bindir:
59         set -e ; $(MAKE) -C src
60
61 #
62 # Conditionally build the font, depending on the value of BUILDFONT.
63 # To build the font unconditionally, use the "fontdir" target below.
64 #
65 buildfont:
66         if [ x$(BUILDFONT) != x ] ; \
67         then \
68            set -e ; $(MAKE) -C font ; \
69         fi
70
71 #
72 # Not invoked automatically; the font files are taken from
73 # font/precompiled by default.
74 #
75 fontdir:
76         set -e ; $(MAKE) -C font
77
78 libdir: lib/wchardata.c
79
80 docdir:
81         set -e ; $(MAKE) -C doc
82
83 mandir:
84         set -e ; $(MAKE) -C man
85
86 precompiled:
87         set -e ; $(MAKE) precompiled -C font
88
89 #
90 # Create lib/wchardata.c.  If you want to also build the object file
91 # wchardata.o, uncomment the last line
92 #
93 lib/wchardata.c: $(HEXFILES) $(COMBINING)
94         $(INSTALL) -m0755 -d lib
95         (cd font/plane00 && sort $(HEXFILES) > ../../unifonttemp.hex)
96         bin/unigenwidth unifonttemp.hex $(COMBINING) > lib/wchardata.c
97         \rm -f unifonttemp.hex
98 #       (cd lib && $(CC) $(CFLAGS) -c wchardata.c && chmod 644 wchardata.o )
99
100 install: bindir libdir docdir
101         $(MAKE) -C src install PREFIX=$(PREFIX)
102         $(MAKE) -C man install PREFIX=$(PREFIX) COMPRESS=$(COMPRESS)
103         $(MAKE) -C font install PREFIX=$(PREFIX) DESTDIR=$(DESTDIR)
104         $(INSTALL) -m0755 -d $(PKGDEST)
105         $(INSTALL) -m0644 -p $(TEXTFILES) doc/unifont.txt doc/unifont.info $(PKGDEST)
106         for i in $(TEXTFILES) unifont.txt unifont.info ; do \
107            gzip -f -9 $(PKGDEST)/$$i ; \
108         done
109         $(INSTALL) -m0644 -p lib/wchardata.c $(PKGDEST)
110         $(INSTALL) -m0644 -p font/plane00/bmp-combining.txt $(PKGDEST)
111         # If "make" wasn't run before, font/compiled won't exist.
112         if [ ! -d font/compiled ] ; then \
113            $(INSTALL) -m0644 -p font/precompiled/unifont-$(VERSION).hex   $(PKGDEST)/unifont.hex ; \
114            $(INSTALL) -m0644 -p font/precompiled/unifont-$(VERSION).bmp $(PKGDEST)/unifont.bmp ; \
115         else \
116            $(INSTALL) -m0644 -p font/compiled/unifont-$(VERSION).hex   $(PKGDEST)/unifont.hex ; \
117            $(INSTALL) -m0644 -p font/compiled/unifont-$(VERSION).bmp $(PKGDEST)/unifont.bmp ; \
118         fi
119
120 clean:
121         $(MAKE) -C src  clean
122         $(MAKE) -C doc  clean
123         $(MAKE) -C man  clean
124         $(MAKE) -C font clean
125         \rm -rf *~
126
127 #
128 # The .DS files are created under Mac OS X
129 #
130 distclean:
131         $(MAKE) -C src  distclean
132         $(MAKE) -C doc  distclean
133         $(MAKE) -C man  distclean
134         $(MAKE) -C font distclean
135         \rm -rf bin lib
136         \rm -f unifonttemp.hex
137         \rm -rf *~
138         \rm -rf .DS* ._.DS*
139
140 .PHONY: all bindir docdir mandir fontdir precompiled install clean distclean