#
# Imakefile for handbook utilities
# $Id: Imakefile 4382 1997-12-15 10:48:40Z duchier $
#

CC=gcc
CFLAGS=-O2
LEX=flex
BIN=raw2tex
C=raw2tex.c
DESTDIR=/usr/local/bin
STYDIR=/project/ps/tex/inputs
STY=ozbook.cls oz2tex.sty
L2H=ozbook.perl ozbook-fix.perl oz2tex.perl
L2HDIR=/project/ps/soft/latex2html/user/styles

# all:: $(BIN)
raw2tex: raw2tex.c
	$(CC) $(CFLAGS) -o raw2tex raw2tex.c
raw2tex.c: raw2tex.lex
	$(LEX) -oraw2tex.c raw2tex.lex
clean::
	-rm -f $(BIN) $(C) *.o core *~
install:: install.bin install.sty install.l2h
install.bin: $(BIN)
	$(INSTALL) -m 555 raw2tex $(DESTDIR)
	$(INSTALL) -m 555 raw2oz  $(DESTDIR)
install.sty: $(STY)
	$(INSTALL) -m 444 ozbook.cls $(STYDIR)
	$(INSTALL) -m 444 oz2tex.sty $(STYDIR)
install.l2h: $(L2H)
	$(INSTALL) -m 444 ozbook.perl      $(L2HDIR)
	$(INSTALL) -m 444 ozbook-fix.perl  $(L2HDIR)
	$(INSTALL) -m 444 oz2tex.perl      $(L2HDIR)
r2t.tex: r2t.nw
	noweave -latex -x r2t.nw > r2t.tex
r2t.dvi: r2t.tex
	latexit r2t.tex
test: raw2tex
	./raw2tex <test.raw >test.tex
	if diff test.out test.tex; then echo TEST SUCCEEDED; \
	else echo TEST FAILED; fi
