###############################################################################
#   Instructions to Make, for compilation of ISODE TSAP processes
###############################################################################

###############################################################################
#
# $Header: /xtel/isode/isode/tsap/RCS/Makefile,v 9.0 1992/06/16 12:40:39 isode Rel $
#
#
# $Log: Makefile,v $
# Revision 9.0  1992/06/16  12:40:39  isode
# Release 8.0
#
# 
###############################################################################

###############################################################################
#
#				 NOTICE
#
#    Acquisition, use, and distribution of this module and related
#    materials are subject to the restrictions of a license agreement.
#    Consult the Preface in the User's Manual for the full terms of
#    this agreement.
#
###############################################################################


#HDIR    =       ../../include/isode/
#OPTIONS =       -I. -I../../include

LIBES	=	libtsap.a $(TOPDIR)libcompat.a
LLIBS	=	$(TOPDIR)llib-lcompat


##################################################################
# Here it is...
##################################################################

all:		mgmthooks
inst-all:	# inst-libtsap manuals
install:	inst-all clean
lint:		l-libtsap

mgmthooks:	tp0ts.o ts2bsd.o ts2sunlink.o ts2tli.o ts2xti.o \
		tsapinitiate.o tsaplisten.o tsaplose.o \
		tsapmgmt.o tsapmisc.o tsaprovider.o

################################################################
# libtsap
################################################################

CFILES	=	tsaprovider.c tsaperror.c tsapstate.c \
		fd2tpkt.c str2tpkt.c text2tpkt.c \
		tsaprespond.c tsapinitiate.c tsaplose.c \
		tsaplisten.c tsapmgmt.c tsapmisc.c \
		tp0ts.c ts2tcp.c ts2x25.c \
		ts2bsd.c ts2sunlink.c ts2tli.c ts2xti.c $(CTSAP)
OFILES	=	tsaprovider.o tsaperror.o tsapstate.o \
		fd2tpkt.o str2tpkt.o text2tpkt.o \
		tsaprespond.o tsapinitiate.o tsaplose.o \
		tsaplisten.o tsapmgmt.o tsapmisc.o \
		tp0ts.o ts2tcp.o ts2x25.o \
		ts2bsd.o ts2sunlink.o ts2tli.o ts2xti.o $(OTSAP) \
		$(OSTRINGS)


inst-libtsap:	$(LIBDIR)libtsap.a $(LINTDIR)llib-ltsap

$(LIBDIR)libtsap.a:	libtsap.a
		-rm -f $@
		cp libtsap.a $@
		@$(UTILDIR)make-lib.sh $(SYSTEM) $@ -ranlib
		-@ls -gls $@
		-@echo ""

$(LINTDIR)llib-ltsap:	llib-ltsap
		-cp $@ zllib-ltsap
		-rm -f $@
		sed -e 's%#include "\(.*\)"%#include "$(INCDIR)\1"%' \
			< llib-ltsap | \
			sed -e 's%#include "/usr/include/\(.*\)"%#include <\1>%' > $@
		@$(UTILDIR)inst-lint.sh $(SYSTEM) $(OPTIONS) $@
		-@ls -gls $@ $@.ln
		-@echo ""

libtsap:	libtsap.a

libtsap.a:	tsapvrsn.o
		-rm -f $@
		@$(UTILDIR)make-lib.sh $(SYSTEM) $(ARFLAGS) $@ $(OFILES) \
			tsapvrsn.o
		-@rm -f $(TOPDIR)libtsap.a $(TOPDIR)llib-ltsap
		-@$(LN) libtsap.a $(TOPDIR)libtsap.a
		-@$(LN) llib-ltsap $(TOPDIR)llib-ltsap
		-@ls -l $@
		-@echo "TSAP library built normally"

tsapvrsn.c:	$(OFILES)
		@$(UTILDIR)version.sh tsap > $@

l-libtsap:;	$(LINT) $(LFLAGS) $(CFILES) tsapvrsn.c $(LLIBS) \
			| grep -v "warning: possible pointer alignment problem"


################################################################
# manual pages
################################################################

MANUALS	=	libtsap.3n

manuals:;	@$(UTILDIR)inst-man.sh $(MANOPTS) $(MANUALS)
		-@echo ""


################################################################
# clean
################################################################

clean:;		rm -f *.o *.a z* _* core tsapvrsn.c

grind:;		iprint Makefile
		tgrind -lc $(CFILES) tsapvrsn.c llib-ltsap
		@echo $(MANUALS) | \
			tr " " "\012" | \
			sed -e "s%.*%itroff -man &%" | \
			sh -ve
