
DESTDIR = /home/local/pd

BINDIR = $(DESTDIR)/bin
MANDIR = /home/local/man/pd

REV=`rrev < lacheck.lex`

FTPDIR = /home/priv/iesd/ftp/pub/latex

# Use `cc -bsd' on a next
CC = gcc -traditional

#
CFLAGS = -O # -DNEED_STRSTR 
LEX = flex -8 

lacheck:	lacheck.o
	$(CC) $(CFLAGS) -o $@ lacheck.o -ll

lacheck.c:	lacheck.lex  
	$(LEX) lacheck.lex
	mv lex.yy.c $@

lacheck.1: 	lacheck.man  
	sed -e "s!%%LACHECKREV%%!Release $(REV)!" lacheck.man |\
	sed -e "s!%%LACHECKDATE%%!`date +%D`!" |\
	sed -e "s!%%LACHECKPATH%%!$(BINDIR)/lacheck!" > lacheck.1

install: 	lacheck lacheck.1
	install -c -s lacheck $(BINDIR)
	install -c lacheck.1 $(MANDIR)/man1

clean:
	rm -f lacheck lacheck.c *.o *.1 *.Z dist

dist:	lacheck.lex lacheck.man Makefile
	tar -cf lacheck.$(REV).tar lacheck.lex lacheck.man Makefile rrev
	compress -fv lacheck.$(REV).tar
	touch dist

ftp:	dist
	cp lacheck.$(REV).tar.Z $(FTPDIR)

