subdirs=makeindex-2.12 texinfo-3.1 kpse-2.4

# This is the root directory of the installation. Sometimes, I use the
# notation $TETEXDIR for it:

tetexdir=/usr/local/tex

PWD	=$(shell echo $$PWD)
PATH	:=$(PATH):$(PWD)/makeindex-2.12/src:$(PWD)/texinfo-3.1/makeinfo:$(PWD)/texinfo-3.1/util:$(tetexdir)/web2c-6.1/bin

# Targets:
all:
	for d in $(subdirs); do \
	  if test -d $$d; then (cd $$d; TETEXDIR=$(tetexdir) $(MAKE) $@ tetexdir=$(tetexdir)); \
	  else true; fi; done

clean:
	for d in $(subdirs); do \
	  if test -d $$d; then (cd $$d; $(MAKE) $@); \
	  else true; fi; done
	find . -name \*.info\* | xargs rm -f

realclean:
	for d in $(subdirs); do \
	  if test -d $$d; then (cd $$d; $(MAKE) $@); \
	  else true; fi; done

install:
	for d in $(subdirs); do \
	  if test -d $$d; then (cd $$d; TETEXDIR=$(tetexdir) $(MAKE) $@ tetexdir=$(tetexdir)); \
	  else true; fi; done

config:
	for d in $(subdirs); do \
	  if test -f $$d/configure; then (cd $$d; ./configure --prefix=$(tetexdir)/$$d); \
	  else true; fi; done
