#
#	Makefile for ss library
#
# Copyright 1987, 1988 by the MIT Student Information Processing Board
# For copyright info, see copyright.h.
#
#	$Header: /local/cvsfiles/kerberos/src/util/ss/Imakefile,v 1.4 1992/08/07 09:02:32 eichin Exp $
#	$Locker:  $


# flags

# .. is so that ss/ss.h works
# ../et is so com_err.h works
# CFLAGS= -I${INCDIR} -I. -I.. -I../et -g
INCLUDE=-I$(BUILDTOP)/include -I. -I.. -I../et

#LINTFLAGS= -uhv -I.. -I../et

# for the library

LIB=	libss.a

# with ss_err.o first, ss_err.h should get rebuilt first too.  shouldn't
# be relying on this, though.
OBJS=	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=	invocation.c help.c \
	execute_cmd.c listen.c parse.c error.c prompt.c \
	request_tbl.c list_rqs.c pager.c requests.c \
	data.c

SRCDIR=$(SRCTOP)/util/ss
CODE=	$(SRCS) $(MKCMDSFILES) $(HFILES) \
	ss_err.et std_rqs.ct test_ss.c mit-sipb-copyright.h 


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 ss_internal.h copyright.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::	libss.a mk_cmds # libss_p.a lint

dist:	archives

depend:: ${CODE}

install:: all
	@rm -rf ${DESTDIR}$(INCLDIR)/ss
	@mkdir ${DESTDIR}$(INCLDIR)/ss
	cp ss.h ss_err.h ss_internal.h copyright.h ${DESTDIR}$(INCLDIR)/ss
	cp copyright.h ${DESTDIR}$(INCLDIR)/ss/mit-sipb-copyright.h

.SUFFIXES:	.ct

std_rqs.c: mk_cmds std_rqs.ct
	./mk_cmds std_rqs.ct

comp_et_prof(ss_err)

depend:: ss_err.h

ct.tab.c ct.tab.h: ct.y
	rm -f ct.tab.* y.*
	yacc -d ct.y
	mv -f y.tab.c ct.tab.c
	mv -f y.tab.h ct.tab.h

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

libss.o:	$(OBJS)
	ld -r -s -o $@ $(OBJS)
	chmod -x $@

program(mk_cmds,$(MKCMDSOBJS), , -ll,$(PROGDIR)) 

archives: ss.ar ss.tar

ss.ar:	$(FILES)
	ar cru $@ $(FILES)

ss.tar:	$(FILES)
	rm -f $@
	tar crf $@ $(FILES)

/* The test harness assumes you've got a command set to drive it. */
/* test(test_ss, commands.o $(LIB), $(COM_ERR)) */
/* make_cmds(commands) */

saber:	${SRCS} ss_err.o std_rqs.o
	saber ${SABEROPTS} ${SRCS} -I../et -G ss_err.o std_rqs.o -lcom_err

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

