#
#  Makefile for the Essence prototype source directory
#
#  INSTALLDIR is where everything is installed.
#  MANDIR is where manual pages are installed.
#
INSTALLDIR 	= /usr/local/bin
MANDIR 		= /usr/local/man
SUBDIRS		= file detex ps2txt pstext dvi2tty skim essence
WAIS		= wais-8-b5.1

all:
	for dir in $(SUBDIRS); do \
		(cd $$dir; $(MAKE) INSTALLDIR=$(INSTALLDIR) all); \
	done
	(cd $(WAIS); $(MAKE) config.h)
	(cd $(WAIS); $(MAKE) lib)
	(cd $(WAIS)/ir; $(MAKE) ../bin/waisindex)
	(cd $(WAIS)/ir; $(MAKE) ../bin/waisserver)

install:
	for dir in $(SUBDIRS); do \
		(cd $$dir; $(MAKE) INSTALLDIR=$(INSTALLDIR) MANDIR=$(MANDIR) \
		 install); \
	done
	install -s -c -m 755 $(WAIS)/bin/waisindex $(INSTALLDIR)
	install -s -c -m 755 $(WAIS)/bin/waisserver $(INSTALLDIR)

clean:
	for dir in $(SUBDIRS); do \
		(cd $$dir; $(MAKE) INSTALLDIR=$(INSTALLDIR) clean); \
	done
	-(cd $(WAIS); $(MAKE) INSTALLDIR=$(INSTALLDIR) clean)
