EMACS = mule

LISPDIR = /usr/local/lib/mule/site-lisp

RM = rm -f

INSTALL = cp

PROGRAMS_SIRUP = ndtp.elc sirup.elc sirup-doc.elc

PROGRAMS = $(PROGRAMS_SIRUP) diclookup-mule.elc 

MAKE = make

SUBDIRS = aux lib

.PHONY: all install clean sirup install-sirup

all: $(PROGRAMS)
	@for i in $(SUBDIRS) ;\
	do \
	(cd $$i ; echo "making" all "in $$i..."; \
	$(MAKE) EMACS="$(EMACS)" all);\
	done

install: $(PROGRAMS)
	@for i in $(SUBDIRS) ;\
	do \
	(cd $$i ; echo "installing" "in $$i..."; \
	$(MAKE) INSTALL="$(INSTALL)" LISPDIR="$(LISPDIR)" install);\
	done
	$(INSTALL) $(PROGRAMS) $(LISPDIR)

clean:
	@for i in $(SUBDIRS) ;\
	do \
	(cd $$i ; echo "cleaning" "in $$i..."; \
	$(MAKE) RM="$(RM)" clean);\
	done
	$(RM) $(PROGRAMS)

sirup: $(PROGRAMS_SIRUP)

install-sirup: $(PROGRAMS_SIRUP)
	$(INSTALL) $(PROGRAMS_SIRUP) $(LISPDIR)

ndtp.elc: ndtp.el
	$(EMACS) -batch -f batch-byte-compile ndtp.el

sirup.elc: sirup.el ndtp.elc
	$(EMACS) -batch -l ./ndtp.elc -f batch-byte-compile sirup.el

sirup-doc.elc: sirup-doc.el sirup.elc ndtp.elc
	$(EMACS) -batch -l ./ndtp.elc -l ./sirup.elc -f batch-byte-compile sirup-doc.el

diclookup-mule.elc: diclookup-mule.el ndtp.elc
	$(EMACS) -batch -l ./ndtp.elc -f batch-byte-compile diclookup-mule.el

sync:
	make sync -f Makefile.sync
