unifont-6.3.20131215.tar.gz
[unifont.git] / Makefile
index 58abae14a2f29776ed62ce5b9188dde7b332d1f3..e625de0b07b6fa7595e9dabc29452c1122ae1222 100644 (file)
--- a/Makefile
+++ b/Makefile
 # "cd font ; make"
 #
 SHELL = /bin/sh
+INSTALL = install
 
-DATE = 20131020
+DATE = 20131215
 MAJORVERSION = 6.3
 VERSION = $(MAJORVERSION).$(DATE)
+
 #
 # The settings below will install software, man pages, and documentation
 # in /usr/local.  To install in a different location, modify USRDIR to
 # your liking.
 #
-USRDIR = usr
-USRDIR = usr/local
+USRDIR = usr
+USRDIR = usr/local
 PREFIX = $(DESTDIR)/$(USRDIR)
 PKGDEST = $(PREFIX)/share/unifont
 
+VPATH = lib font/hexsrc font/ttfsrc
+
+HEXFILES = hangul-syllables.hex nonprinting.hex pua.hex spaces.hex \
+          unassigned.hex unifont-base.hex wqy.hex
+
+COMBINING = font/ttfsrc/combining.txt
+
+TEXTFILES = ChangeLog INSTALL NEWS README
+
+#
+# Whether to build the font or not (default is not).
+# Set to non-null value to build font.
+#
+BUILDFONT=
+
 #
 # Whether to install man pages uncompressed (COMPRESS = 0) or
 # compressed (COMPRESS != 0).
 #
 COMPRESS = 1
 
-DIRS = bin man font
-
-all: bindir fontdir libdir
+all: bindir libdir docdir buildfont
        echo "Make is done."
 
 bindir:
        set -e ; $(MAKE) -C src
 
-mandir:
-       set -e ; $(MAKE) -C man
+#
+# Conditionally build the font, depending on the value of BUILDFONT.
+# To build the font unconditionally, use the "fontdir" target below.
+#
+buildfont:
+       if [ x$(BUILDFONT) != x ] ; \
+        then \
+           set -e ; make -C font ; \
+        fi
 
+#
+# Not invoked automatically; the font files are taken from
+# font/precompiled by default.
+#
 fontdir:
        set -e ; $(MAKE) -C font
 
+libdir: lib/wchardata.c
+
+docdir:
+       set -e ; $(MAKE) -C doc
+
+mandir:
+       set -e ; $(MAKE) -C man
+
 precompiled:
        set -e ; $(MAKE) precompiled -C font
 
 #
 # Create lib/wchardata.c.  If you want to also build the object file
 # wchardata.o, uncomment the last line
-libdir:
-       install -m0755 -d lib
-       (cd font/hexsrc ; \
-               sort hangul-syllables.hex pua.hex spaces.hex \
-                       unassigned.hex unifont-base.hex wqy.hex \
-                       > ../../unifonttemp.hex)
-       bin/unigenwidth unifonttemp.hex font/ttfsrc/combining.txt \
-               > lib/wchardata.c
+#
+lib/wchardata.c: $(HEXFILES) combining.txt
+       $(INSTALL) -m0755 -d lib
+       (cd font/hexsrc && sort $(HEXFILES) > ../../unifonttemp.hex)
+       bin/unigenwidth unifonttemp.hex $(COMBINING) > lib/wchardata.c
        \rm -f unifonttemp.hex
-#      (cd lib ; $(CC) -c wchardata.c ; chmod 644 wchardata.o )
+#      (cd lib && $(CC) $(CFLAGS) -c wchardata.c && chmod 644 wchardata.o )
 
-install: bindir libdir
+install: bindir libdir docdir
        $(MAKE) -C src install PREFIX=$(PREFIX)
        $(MAKE) -C man install PREFIX=$(PREFIX) COMPRESS=$(COMPRESS)
        $(MAKE) -C font install PREFIX=$(PREFIX) DESTDIR=$(DESTDIR)
-       install -m0755 -d $(PKGDEST)
-       install -m0644 -p README TUTORIAL LICENSE $(PKGDEST)
-       gzip -f -9 $(PKGDEST)/README
-       gzip -f -9 $(PKGDEST)/TUTORIAL
-       gzip -f -9 $(PKGDEST)/LICENSE
-       install -m0644 -p lib/wchardata.c $(PKGDEST)
-       install -m0644 -p font/ttfsrc/combining.txt $(PKGDEST)
+       $(INSTALL) -m0755 -d $(PKGDEST)
+       $(INSTALL) -m0644 -p $(TEXTFILES) doc/unifont.txt doc/unifont.info $(PKGDEST)
+       for i in $(TEXTFILES) unifont.txt unifont.info ; do \
+          gzip -f -9 $(PKGDEST)/$$i ; \
+       done
+       $(INSTALL) -m0644 -p lib/wchardata.c $(PKGDEST)
+       $(INSTALL) -m0644 -p font/ttfsrc/combining.txt $(PKGDEST)
        # If "make" wasn't run before, font/compiled won't exist.
        if [ ! -d font/compiled ] ; then \
-          install -m0644 -p font/precompiled/unifont-$(VERSION).hex   $(PKGDEST)/unifont.hex ; \
-          install -m0644 -p font/precompiled/unifont-$(VERSION).bmp $(PKGDEST) ; \
+          $(INSTALL) -m0644 -p font/precompiled/unifont-$(VERSION).hex   $(PKGDEST)/unifont.hex ; \
+          $(INSTALL) -m0644 -p font/precompiled/unifont-$(VERSION).bmp $(PKGDEST)/unifont.bmp ; \
        else \
-          install -m0644 -p font/compiled/unifont-$(VERSION).hex   $(PKGDEST)/unifont.hex ; \
-          install -m0644 -p font/compiled/unifont-$(VERSION).bmp $(PKGDEST) ; \
+          $(INSTALL) -m0644 -p font/compiled/unifont-$(VERSION).hex   $(PKGDEST)/unifont.hex ; \
+          $(INSTALL) -m0644 -p font/compiled/unifont-$(VERSION).bmp $(PKGDEST)/unifont.bmp ; \
        fi
 
 clean:
-       $(MAKE) -C src clean
-       $(MAKE) -C man clean
+       $(MAKE) -C src  clean
+       $(MAKE) -C doc  clean
+       $(MAKE) -C man  clean
        $(MAKE) -C font clean
+       \rm -rf *~
 
 #
 # The .DS files are created under Mac OS X
-# The build-stamp file is created under Debian
 #
 distclean:
-       $(MAKE) -C src distclean
-       $(MAKE) -C man distclean
+       $(MAKE) -C src  distclean
+       $(MAKE) -C doc  distclean
+       $(MAKE) -C man  distclean
        $(MAKE) -C font distclean
        \rm -rf bin lib
        \rm -f unifonttemp.hex
+       \rm -rf *~
        \rm -rf .DS* ._.DS*
-       \rm -f build-stamp
 
-.PHONY: all bindir mandir fontdir precompiled install clean distclean
+.PHONY: all bindir docdir mandir fontdir precompiled install clean distclean