# makefile for random EOLCR stuff...

.SUFFIXES: .el .elc
.PRECIOUS: olcr.elc

# declarations

E19=	/mit/emacs19/bin/emacs19
ETAGS=	/mit/emacs19/bin/etags

RM=	- rm -f
ATTACH=	attach

# files

CORE=	olcr.el autoloads.el definitions.el main.el misc.el\
	commands.el
HACKS=	hacks.el
CMDS=	olc-commands.el other-commands.el special-commands.el\
	zclient.el help.el
MODES=	collapse-mode.el description-mode.el fix-bs-mode.el\
	follow-mode.el indent-mode.el input-mode.el list-mode.el\
	nail-mode.el replay-mode.el short-mode.el status-mode.el\
	temporary-mode.el
JUNK=	fortunes.el

EXTRA=	../toolbox.el ../defstruct.el

SRC=	$(CORE) $(HACKS) $(CMDS) $(MODES) $(JUNK) $(EXTRA)


CCORE=	olcr.elc autoloads.elc definitions.elc main.elc misc.elc\
	commands.elc
CHACKS=	hacks.elc
CCMDS=	olc-commands.elc other-commands.elc special-commands.elc\
	zclient.elc help.elc
CMODES=	collapse-mode.elc description-mode.elc fix-bs-mode.elc\
	follow-mode.elc indent-mode.elc input-mode.elc list-mode.elc\
	nail-mode.elc replay-mode.elc short-mode.elc status-mode.elc\
	temporary-mode.elc
CJUNK=	fortunes.elc

CEXTRA=	../toolbox.elc ../defstruct.elc

TARGETS= TAGS $(CCORE) $(CHACKS) $(CCMDS) $(CMODES) $(CJUNK) $(CEXTRA)

# rules

compile: $(TARGETS)

rebuild: clean TAGS
	$(E19) -batch -l ./olcr.el -f batch-byte-compile $(SRC)

clean:
	$(RM) $(TARGETS)

$(E19) $(ETAGS):
	$(ATTACH) e19

tags:
	$(RM) TAGS
	$(MAKE) TAGS

TAGS: $(ETAGS)
	$(ETAGS) $(SRC)

olcr.elc:
	if [ -f olcr.elc ] ; then \
	  $(E19) -batch -l ./olcr.elc -f batch-byte-compile $<; \
	else \
	  $(MAKE) rebuild ; \
	fi

.el.elc: olcr.elc
	$(E19) -batch -l ./olcr.elc -f batch-byte-compile $<
