#
#  This is a very primitive makefile for installing xhzview.
#
#  Set up the following three directories according to your local configuration

BINDIR = /usr/home/how/bin
# where you put the executable

FONTDIR = /usr/home/how/lib/font
# where you put the X11 fonts

DEFAULT_HANZI_FONT = \"hku-ch16\"
DEFAULT_ASCII_FONT = \"8x16\"
# default fonts.
# if you want the default to use GB font codes, set the above two
# variables to:
# DEFAULT_HANZI_FONT = \"beijing24\"
# DEFAULT_ASCII_FONT = \"12x24\"
# if you don't have 12x24, vg-20 is fine.

# CFLAGS = -O


all: exec install

exec: xhzview hku-ch16.snf


xhzview:	xhzview.o wsimple.o
	$(CC) -o xhzview xhzview.o wsimple.o -lX11

hku-ch16.snf:	HKU-Ch16.bdf
	bdftosnf HKU-Ch16.bdf > hku-ch16.snf

xhzview.o:	xhzview.c
	$(CC) -c $(CFLAGS) -DDEFAULT_HANZI_FONT=$(DEFAULT_HANZI_FONT) \
		-DDEFAULT_ASCII_FONT=$(DEFAULT_ASCII_FONT) xhzview.c

# comment out the last two lines (mkfontdir, xset fp rehash) if you
# are using X11 R2
install:	xhzview hku-ch16.snf 
	cp xhzview $(BINDIR)
	cp hku-ch16.snf $(FONTDIR)
	xset +fp $(FONTDIR)
	mkfontdir $(FONTDIR)
	xset fp rehash

clean:
	rm -f core *.o *.snf xhzview
