SHELL=	     /bin/sh
CC=	     @CC@
INSTALL=     @INSTALL@
prefix =     @prefix@
exec_prefix= @exec_prefix@
libexecdir=  @libexecdir@
datadir=     @datadir@
LISPDIR =    $(datadir)/emacs/site-lisp

DEFS=	@DEFS@
LIBS=	@LIBS@

KLIBS=	@KLIBS@
ETLIB=	-lcom_err

INCLUDES= -I../include -I$(prefix)/include
CFLAGS=	  -O
LDFLAGS=  -L$(prefix)/lib

SRCS=	edsc.c parse.c time.c do_trn.c do_mtg.c do_misc.c do_cache.c
OBJS=	edsc.o parse.o time.o do_trn.o do_mtg.o do_misc.o do_cache.o

# other files 
ELISP = discuss.el discuss-enter.el discuss-acl.el discuss-ls.el \
        discuss-misc.el discuss.el
OFILES= $(ELISP) doc

.SUFFIXES:	.h

all:	edsc

edsc: ${OBJS} ../libds/libds.a ../usp/libusp.a newvers.sh
	-rm -f edsc
	sh newvers.sh
	${CC} ${CFLAGS} -c version.c
	${CC} ${LDFLAGS} -o edsc ${OBJS} version.o \
	    ../libds/libds.a ../usp/libusp.a  ${KLIBS} ${ETLIB} ${LIBS}

.c.o:
	${CC} ${CFLAGS} ${INCLUDES} ${DEFS} -c $*.c

TAGS:	${SRCS}
	-etags ${SRCS}

install: all $(ELISP)
	$(INSTALL) -s edsc $(libexecdir)
	$(INSTALL) -d ${LISPDIR}
	for file in ${ELISP}; do \
		$(INSTALL) -m 644 $$file ${LISPDIR}/ ; done


clean:
	rm -f *.o *~ \#* *.bak version.h
	rm -f edsc TAGS

distclean: clean
	rm -f Makefile version.c

edsc.o: edsc.c
edsc.o: ../include/discuss/discuss.h
edsc.o: ../include/discuss/types.h
edsc.o: ../include/discuss/tfile.h
edsc.o: ../include/discuss/acl.h
edsc.o: ../include/discuss/interface.h
edsc.o: ../include/discuss/types.h
edsc.o: ../include/discuss/dsname.h
edsc.o: ../include/config.h
parse.o: parse.c
time.o: time.c
do_trn.o: do_trn.c
do_trn.o: ../include/discuss/discuss.h
do_trn.o: ../include/discuss/types.h
do_trn.o: ../include/discuss/tfile.h
do_trn.o: ../include/discuss/dsc_et.h
do_trn.o: ../include/discuss/acl.h
do_trn.o: ../include/discuss/interface.h
do_trn.o: ../include/discuss/types.h
do_trn.o: ../include/discuss/dsname.h
do_mtg.o: do_mtg.c
do_mtg.o: ../include/discuss/discuss.h
do_mtg.o: ../include/discuss/types.h
do_mtg.o: ../include/discuss/tfile.h
do_mtg.o: ../include/discuss/dsc_et.h
do_mtg.o: ../include/discuss/acl.h
do_mtg.o: ../include/discuss/interface.h
do_mtg.o: ../include/discuss/types.h
do_mtg.o: ../include/discuss/dsname.h
do_misc.o: do_misc.c
do_misc.o: ../include/discuss/discuss.h
do_misc.o: ../include/discuss/types.h
do_misc.o: ../include/discuss/tfile.h
do_misc.o: ../include/discuss/dsc_et.h
do_misc.o: ../include/discuss/acl.h
do_misc.o: ../include/discuss/interface.h
do_misc.o: ../include/discuss/types.h
do_misc.o: ../include/discuss/dsname.h
