##############################################################
# Name: /home/users/otso/official/otso/appli/simpleFileTransfer/SCCS/s.Makefile
# Vers: 1.1    Time: 92/09/14, 09:12:25
#
# Copyright (c) 1992      Technical Research Centre of Finland (VTT)
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that this notice and the reference to this notice appearing in each software
# module be retained unaltered, and that the name of any contributors shall not
# be used in advertising or publicity pertaining to distribution of the software
# without specific written prior permission.  No contributor makes any
# representations about the suitability of this software for any purpose.
# It is provided "as is" without any express or limited warranty.
#
#			NO WARRANTY
#
# ALL CONTRIBUTORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS.  IN NO
# EVENT SHALL ANY CONTRIBUTOR BE LIABLE FOR ANY SPECIAL, PUNITIVE, INDIRECT OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
# DATA, OR PROFITS, WHETHER IN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH, THE USE OR PERFORMANCE
# OF THIS SOFTWARE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THIS
# SOFTWARE IS WITH YOU.  SHOULD THIS SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE
# COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
#
# As used above, "contributor" includes, but is not limited to :
#        The Technical Research Centre of Finland
#############################################################################

EXES	=	sftp 

HXXFILES =	sftp.hxx
CFILES	=	sftp.cx
OFILES	=	sftp.o sftp_main.o

# OTSO OSI PROTOCOL LIBRARIES USED
# vcons.a - virtual Connection Oriented Network Layer for now
# tran_all.a - common transport layer definitions (PDUs, service prims)
PROTOLIBS =	$(LIBDIR)consall.a \
		$(LIBDIR)tran_all.a $(LIBDIR)libtran0.a \
		$(LIBDIR)tran_all.a $(LIBDIR)libtran0.a 

LIBES	=	$(OTSO_LIBES) \
		$(LIBDIR)libisoaddrs.a \
		$(PROTOLIBS)

# Preprocessor Generated stuff
PREPRO_GEND =	sftp sftp_main

all:		$(EXES)

inst-all:	$(LIBDIR)libsftp.a

$(LIBDIR)libsftp.a:	libsftp.a
		-rm -f $@
		@# update .hxx interfaces
		for i in $(HXXFILES); \
		  do (echo $$i; \
		    rm -rf $(PINCDIR)$$i; \
		    cp $$i $(PINCDIR)$$i); \
		  done
		mv libsftp.a $@
		ln -s $@ libsftp.a
		-rm $(TOPDIR)libsftp.a
		@$(UTILDIR)make-lib.sh $(SYSTEM) $@ -ranlib
		-@ls -gls $@
		-@echo ""

libsftp.a:	sftpvrsn.o
		-rm -f $@
		@$(UTILDIR)make-lib.sh $(SYSTEM) $(ARFLAGS) \
			$@ $(OFILES) sftpvrsn.o
		-@rm -f $(TOPDIR)libsftp.a 
		-@$(LN) libsftp.a $(TOPDIR)libsftp.a
		-@ls -l $@
		-@echo "libsftp built normally"

sftp:	$(OFILES) $(LIBES) 
		-@echo "compiling sftp: "
		CC -o sftp $(OFILES) $(LIBES) $(SYSTEM_LIBES)

sftp_main.o:	sftp_main.cx

sftpvrsn.c:	$(OFILES)
		@$(UTILDIR)version.sh cftp > $@

################################################################
# clean
################################################################
clean:;		-rm -f $(CLEANSTRINGS) *.[chi]xx cftpdemo

# remove executables so we don't have huge tar files
tar-clean:	clean
		-rm -f $(EXES)

