FONT=$(GISBASE)/fonts

RAWFONT = \
	../fonts/hersh.oc1 \
	../fonts/hersh.oc2 \
	../fonts/hersh.oc3 \
	../fonts/hersh.oc4

FONTS = \
	$(FONT)/cyrilc		\
	$(FONT)/gothgbt		\
	$(FONT)/gothgrt		\
	$(FONT)/gothitt		\
	$(FONT)/greekc		\
	$(FONT)/greekcs		\
	$(FONT)/greekp		\
	$(FONT)/greeks		\
	$(FONT)/italicc		\
	$(FONT)/italiccs	\
	$(FONT)/italict		\
	$(FONT)/romanc		\
	$(FONT)/romancs		\
	$(FONT)/romand		\
	$(FONT)/romans		\
	$(FONT)/romant		\
	$(FONT)/scriptc		\
	$(FONT)/scripts

FONT_BIN = $(GISBASE)/etc/font.bin

all: $(FONTS)

$(FONTS): $(FONT) $(FONT_BIN) $(GISBASE)/etc/splitfont
	$(GISBASE)/etc/splitfont $(FONT) < $(FONT_BIN)

$(FONT):
	-mkdir $(FONT)

$(FONT_BIN): $(RAWFONT) $(GISBASE)/etc/font_2_bin
	cat $(RAWFONT) | $(GISBASE)/etc/font_2_bin > $@

$(GISBASE)/etc/font_2_bin: font_2_bin.o
	$(CC) $(LDFLAGS) font_2_bin.o -o $@

$(GISBASE)/etc/splitfont: splitfont.o fontmap.o
	$(CC) $(LDFLAGS) splitfont.o fontmap.o -o $@

try: try.o showchar.o font.o
	$(CC) $(LDFLAGS) try.o showchar.o font.o -o try $(CURSES)
