thisconfigdir=.
myfulldir=util/ss
mydir=.
BUILDTOP=$(REL)..$(S)..
SED = sed

INSTALLLIB=cp
INSTALLFILE=cp

all::

TOP=$(BUILDTOP)

LIB=ss
LIBMAJOR=1
LIBMINOR=0
RELDIR=../util/ss

STOBJLISTS=OBJS.ST

clean-unix:: clean-liblinks clean-libs clean-libobjs
install-unix:: install-libs

# hard coded srcdir/.. is so that ss/ss.h works

# hard coded .. is so that ss/ss_err.h works
# hard coded ../et is so com_err.h works
# CFLAGS= -g
# CPPFLAGS= -I${INCDIR} -I. -I.. -I../et
LOCALINCLUDES= -I. -I$(srcdir)/

# with ss_err.o first, ss_err.h should get rebuilt first too.  should not
# be relying on this, though.
STLIBOBJS=\
	ss_err.o \
	std_rqs.o \
	invocation.o help.o \
	execute_cmd.o listen.o parse.o error.o prompt.o \
	request_tbl.o list_rqs.o pager.o requests.o \
	data.o

SRCS=	$(srcdir)/invocation.c $(srcdir)/help.c \
	$(srcdir)/execute_cmd.c $(srcdir)/listen.c $(srcdir)/parse.c \
	$(srcdir)/error.c $(srcdir)/prompt.c \
	$(srcdir)/request_tbl.c $(srcdir)/list_rqs.c $(srcdir)/pager.c \
	$(srcdir)/requests.c $(srcdir)/data.c
depend-dependencies: ss_err.h includes

std_rqs.o: std_rqs.c ss_err.h

CODE= $(SRCS) $(MKCMDSFILES)

MKCMDSOBJS=	mk_cmds.o utils.o options.o ct.tab.o cmd_tbl.lex.o

MKCMDSFILES=	mk_cmds.c utils.c options.c ct.y cmd_tbl.lex.l

MKCMDSCSRCS=	mk_cmds.c utils.c options.c ct.tab.c cmd_tbl.lex.c


HFILES=	ss.h mit-sipb-copyright.h
BUILT_HFILES = ss_err.h

# for 'tags' and dependencies

CFILES=	$(SRCS) $(MKCMDSCSRCS) test_ss.c

# for building archives

FILES=	$(SRCS) $(MKCMDSFILES) $(HFILES) \
	ss_err.et std_rqs.ct Makefile \
	test_ss.c ss mit-sipb-copyright.h copyright.h

#
# stuff to build
#

all-unix::	mk_cmds ct_c.awk ct_c.sed includes # libss_p.a lint
all-unix:: all-liblinks
all-mac::
all-windows::  all-unix

dist:	archives

install::

includes:: mk_cmds ct_c.sed ct_c.awk ss_err.h

HDRDIR=$(BUILDTOP)/include/ss
HDRS =	$(HDRDIR)/ss.h \
	$(HDRDIR)/mit-sipb-copyright.h \
	$(HDRDIR)/ss_err.h

BUILD_HDRS = ss_err.h
SRC_HDRS = ss.h 
SRC_HDRS_DEP = $(srcdir)/ss.h 

includes:: $(SRC_HDRS_DEP) $(BUILD_HDRS)
	if [ -d $(HDRDIR) ] ; then :; else mkdir -p $(HDRDIR); fi
	for i in $(SRC_HDRS) ; do \
		if cmp $(srcdir)/$$i $(HDRDIR)/$$i >/dev/null 2>&1; then :; \
		else \
			(set -x; $(RM) $(HDRDIR)/$$i; \
			 $(CP) $(srcdir)/$$i $(HDRDIR)/$$i) ; \
		fi ; \
	done
	for i in $(BUILD_HDRS) ; do \
		if cmp $$i $(HDRDIR)/$$i >/dev/null 2>&1; then :; \
		else \
			(set -x; $(RM) $(HDRDIR)/$$i; \
			 $(CP) $$i $(HDRDIR)/$$i) ; \
		fi ; \
	done

$(HDRS): includes

clean-unix::
	$(RM) $(HDRS)

std_rqs.c: std_rqs.ct mk_cmds ct_c.sed ct_c.awk

ss_err.h: ss_err.et

ss_err.c: ss_err.et

clean::
	$(RM) ss_err.o ss_err.c ss_err.h std_rqs.c

depend:: ss_err.h

ct.tab.c ct.tab.h: ct.y
	$(RM) ct.tab.* y.*
	$(YACC) -d $(srcdir)/ct.y
	$(MV) y.tab.c ct.tab.c
	$(MV) y.tab.h ct.tab.h

# install_library_target(ss,$(OBJS),$(SRCS),)

#mk_cmds: $(MKCMDSOBJS)
#	$(CC) $(ALL_CFLAGS) -o $@ $(MKCMDSOBJS) $(LEXLIB) $(BSDLIB)
#
#mk_cmds.o:	ss_err.h
#
#install::
#	$(INSTALLPROG) mk_cmds ${DESTDIR}$(PROGDIR)/mk_cmds

mk_cmds: $(srcdir)/mk_cmds.sh $(srcdir)/config_script 
	$(SHELL) $(srcdir)/config_script $(srcdir)/mk_cmds.sh . $(AWK) $(SED) > mk_cmds
	chmod 755 mk_cmds	

ct_c.awk: $(srcdir)/ct_c_awk.in
	$(RM) $@
	$(CP) $(srcdir)/ct_c_awk.in $@

ct_c.sed: $(srcdir)/ct_c_sed.in
	$(SED) -e '/^#/d' $(srcdir)/ct_c_sed.in > ct_c.sed

clean::
	$(RM) mk_cmds ct_c.awk ct_c.sed $(MKCMDSOBJS)

# 

clean::
	rm -f *.o *~ \#* *.bak core \
		ss_err.h ct.tab.c ct.tab.h cmd_tbl.lex.c \
		lex.yy.c y.tab.c \
		libss.a libss_p.a llib-lss.ln mk_cmds \
		ss.ar ss.tar \
		TAGS test_ss


# @lib_frag@
# @libobj_frag@

# +++ Dependency line eater +++
# 
# Makefile dependencies follow.  This must be the last section in
# the Makefile.in file
#
invocation.so invocation.po $(OUTPRE)invocation.$(OBJEXT): invocation.c ss_internal.h \
  ss.h $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) \
  copyright.h
help.so help.po $(OUTPRE)help.$(OBJEXT): help.c ss_internal.h ss.h \
  $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) copyright.h
execute_cmd.so execute_cmd.po $(OUTPRE)execute_cmd.$(OBJEXT): execute_cmd.c ss_internal.h \
  ss.h $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) \
  copyright.h
listen.so listen.po $(OUTPRE)listen.$(OBJEXT): listen.c copyright.h ss_internal.h \
  ss.h $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS)
parse.so parse.po $(OUTPRE)parse.$(OBJEXT): parse.c ss_internal.h ss.h \
  $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) copyright.h
error.so error.po $(OUTPRE)error.$(OBJEXT): error.c copyright.h $(COM_ERR_DEPS) \
  ss_internal.h ss.h $(BUILDTOP)/include/ss/ss_err.h
prompt.so prompt.po $(OUTPRE)prompt.$(OBJEXT): prompt.c copyright.h ss_internal.h \
  ss.h $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS)
request_tbl.so request_tbl.po $(OUTPRE)request_tbl.$(OBJEXT): request_tbl.c copyright.h \
  ss_internal.h ss.h $(BUILDTOP)/include/ss/ss_err.h \
  $(COM_ERR_DEPS)
list_rqs.so list_rqs.po $(OUTPRE)list_rqs.$(OBJEXT): list_rqs.c copyright.h \
  ss_internal.h ss.h $(BUILDTOP)/include/ss/ss_err.h \
  $(COM_ERR_DEPS)
pager.so pager.po $(OUTPRE)pager.$(OBJEXT): pager.c ss_internal.h ss.h \
  $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) copyright.h
requests.so requests.po $(OUTPRE)requests.$(OBJEXT): requests.c ss_internal.h \
  ss.h $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS)
data.so data.po $(OUTPRE)data.$(OBJEXT): data.c ss_internal.h ss.h \
  $(BUILDTOP)/include/ss/ss_err.h $(COM_ERR_DEPS) copyright.h

