SHELL=	/bin/sh
CC=	@CC@
INSTALL=@INSTALL@
YACC=	@YACC@

DEFS=	@DEFS@
LIBS=	@LIBS@

KLIBS=	@KLIBS@
ETLIB=	../et/libcom_err.a
SSLIB=	../ss/libss.a

INCLUDES= -I../include
CFLAGS=	-O
LFLAGS=	-uhv ${INCLUDES}

OBJS=	discuss.o output.o trn_expr.o list.o trn_select.o \
	status.o new_trans.o print.o lsm.o addmtg.o list_acl.o \
	interrupt.o goto.o reply.o ckm.o anm.o \
	time.o data.o \
	cmds.o discuss_err.o rn.o randrp.o catchup.o set.o

SRCS=	discuss.c output.c trn_expr.c list.c trn_select.c \
	status.c new_trans.c print.c lsm.c addmtg.c list_acl.c \
	interrupt.c goto.c reply.c ckm.c anm.c \
	time.c data.c rn.c randrp.c catchup.c set.c cmds.c

# defaults for options that should come from above.
DESTDIR= /usr/local

INFODIR= /usr/lib/discuss/info

.SUFFIXES:	.h

.y.o:	
	-rm -f $*.o y.tab.c y.tab.o
	${YACC} $(YFLAGS) $<
	${CC} $(CFLAGS) -c y.tab.c
	mv y.tab.o $@

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

#

all:	discuss
	

discuss: $(OBJS) ../server/acl.o ../libds/libds.a ../usp/libusp.a ${SSLIB} ${ETLIB}
	-rm -f discuss
	${CC} $(CFLAGS) -o discuss $(OBJS) ../server/acl.o ../libds/libds.a ${KLIBS} ../usp/libusp.a ${SSLIB} ${ETLIB} ${LIBS}

cmds.o : cmds.c

cmds.c : cmds.ct
	../ss/mk_cmds cmds.ct

discuss_err.c: ../ets/discuss_err.et
	../et/compile_et ../ets/discuss_err.et; rm discuss_err.h

tags:	TAGS

TAGS:	$(SRCS)
	-etags $(SRCS)

install: all
	install -c discuss $(DESTDIR)/discuss
	cd info;	$(MAKE) $(MFLAGS) install

clean:
	rm -f *.o *~ \#* *.bak
	rm -f discuss trn_expr.c y.tab.c TAGS info.tar

dist:	$(SRCS) Makefile.in trn_expr.y cmds.ct
	-mkdir ../../dist/source/client
	cp -p $(SRCS) ../../dist/source/client/
	cp -p Makefile.in ../../dist/source/client/
	cp -p trn_expr.y cmds.ct ../../dist/source/client/
	cd info;	$(MAKE) $(MFLAGS) dist

discuss.o : discuss.c ../include/ss.h \
  ../include/ss_err.h \
  ../include/discuss/discuss.h \
  ../include/discuss/types.h ../include/discuss/tfile.h \
  ../include/discuss/dsc_et.h ../include/discuss/acl.h \
  ../include/discuss/interface.h ../include/discuss/dsname.h \
  ../include/config.h ../include/globals.h ../include/discuss_err.h 
output.o : output.c  ../include/ss.h \
   ../include/ss_err.h \
  ../include/discuss/discuss.h  \
  ../include/discuss/types.h ../include/discuss/tfile.h \
  ../include/discuss/dsc_et.h ../include/discuss/acl.h \
  ../include/discuss/interface.h ../include/discuss/dsname.h \
  ../include/config.h ../include/globals.h ../include/discuss_err.h 
trn_expr.o : trn_expr.c ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h 
list.o : list.c  ../include/ss.h \
   ../include/ss_err.h \
  ../include/config.h ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h 
trn_select.o : trn_select.c \
  ../include/discuss/discuss.h  \
  ../include/discuss/types.h ../include/discuss/tfile.h \
  ../include/discuss/dsc_et.h ../include/discuss/acl.h \
  ../include/discuss/interface.h ../include/discuss/dsname.h \
  ../include/globals.h ../include/discuss_err.h 
status.o : status.c ../include/ss.h  \
  ../include/ss_err.h ../include/discuss/discuss.h \
  ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/config.h ../include/globals.h \
  ../include/discuss_err.h
new_trans.o : new_trans.c ../include/ss.h \
  ../include/ss_err.h \
  ../include/discuss/discuss.h  \
  ../include/discuss/types.h ../include/discuss/tfile.h \
  ../include/discuss/dsc_et.h ../include/discuss/acl.h \
  ../include/discuss/interface.h ../include/discuss/dsname.h \
  ../include/config.h ../include/globals.h ../include/discuss_err.h 
print.o : print.c \
  ../include/discuss/discuss.h  \
  ../include/discuss/types.h ../include/discuss/tfile.h \
  ../include/discuss/dsc_et.h ../include/discuss/acl.h \
  ../include/discuss/interface.h ../include/discuss/dsname.h ../include/ss.h \
   ../include/ss_err.h \
  ../include/config.h ../include/globals.h ../include/discuss_err.h
lsm.o : lsm.c ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h \
  ../include/ss.h  \
  ../include/ss_err.h 
addmtg.o : addmtg.c ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h \
  ../include/ss.h  ../include/ss_err.h 
list_acl.o : list_acl.c ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h 
interrupt.o : interrupt.c
goto.o : goto.c ../include/ss.h  \
  ../include/ss_err.h ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h 
reply.o : reply.c ../include/ss.h  \
  ../include/ss_err.h ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/config.h ../include/globals.h \
  ../include/discuss_err.h 
ckm.o : ckm.c ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h 
anm.o : anm.c ../include/ss.h \
   ../include/ss_err.h \
  ../include/discuss/discuss.h  \
  ../include/discuss/types.h ../include/discuss/tfile.h \
  ../include/discuss/dsc_et.h ../include/discuss/acl.h \
  ../include/discuss/interface.h ../include/discuss/dsname.h \
  ../include/config.h ../include/globals.h ../include/discuss_err.h 
time.o : time.c
data.o : data.c \
  ../include/discuss/discuss.h  \
  ../include/discuss/types.h ../include/discuss/tfile.h \
  ../include/discuss/dsc_et.h ../include/discuss/acl.h \
  ../include/discuss/interface.h ../include/discuss/dsname.h ../include/ss.h \
   ../include/ss_err.h \
  ../include/globals.h ../include/discuss_err.h 
rn.o : rn.c ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h
randrp.o : randrp.c ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/globals.h ../include/discuss_err.h
catchup.o : catchup.c ../include/discuss/discuss.h \
   ../include/discuss/types.h \
  ../include/discuss/tfile.h ../include/discuss/dsc_et.h \
  ../include/discuss/acl.h ../include/discuss/interface.h \
  ../include/discuss/dsname.h ../include/ss.h \
   ../include/ss_err.h \
  ../include/config.h ../include/globals.h ../include/discuss_err.h 
set.o : set.c
