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

###############################################################################
#
# $Header: /f/osi/support/RCS/Makefile,v 7.10 91/02/22 09:46:19 mrose Interim $
#
#
# $Log:	Makefile,v $
# Revision 7.10  91/02/22  09:46:19  mrose
# Interim 6.8
# 
# Revision 7.9  91/01/24  14:50:37  mrose
# update
# 
# Revision 7.8  90/12/23  18:43:17  mrose
# update
# 
# Revision 7.7  90/11/20  15:33:04  mrose
# update
# 
# Revision 7.6  90/11/04  19:16:46  mrose
# update
# 
# Revision 7.5  90/10/15  18:19:03  mrose
# iaed
# zap-AET
# 
# Revision 7.4  90/08/14  14:30:30  mrose
# oops
# 
# Revision 7.3  90/07/27  08:48:06  mrose
# update
# 
# Revision 7.2  90/07/09  14:50:34  mrose
# sync
# 
# Revision 7.1  90/07/01  21:07:47  mrose
# pepsy
# 
# Revision 7.0  89/11/23  22:27:04  mrose
# Release 6.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.
#
###############################################################################


LIBES   =       $(TOPDIR)libpepsy.a $(TOPDIR)libpsap.a $(TOPDIR)libcompat.a


LLIBS   =       $(TOPDIR)llib-lpsap $(TOPDIR)llib-lcompat


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

all:		libisode
inst-all:	inst-libisode
install:	inst-all clean

inst-:;
man-:;
l-:;


################################################################
# libisode
################################################################

inst-libisode:	$(LIBDIR)libisode.a $(LINTDIR)llib-lisode

$(LIBDIR)libisode.a:	libisode.a
		@for i in libisode.* ;\
		do \
			rm -f $(LIBDIR)$$i; \
			echo cp $$i $(LIBDIR)$$i; \
			cp $$i $(LIBDIR)$$i; \
			case "$$i" in *.a) \
			$(UTILDIR)make-lib.sh $(SYSTEM) $@ -ranlib ;;\
			esac; \
			ls -gls $(LIBDIR)$$i ; \
		done
		-@echo ""

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

libisode:	libisode.a libisode-$(SHAREDLIB) llib-lisode

libisode.a:	isodevrsn.o
		-rm -f $@ $(TOPDIR)libisode.a
		-rm -rf tmp
		-mkdir tmp
		ln isodevrsn.o tmp
		for i in $(LIBES); do (cd tmp; ar x ../$$i; \
		    ../$(UTILDIR)make-lib.sh -quick $(SYSTEM) $(ARFLAGS) ../$@ *.o; \
		    rm -f *); done
		$(UTILDIR)make-lib.sh $(SYSTEM) $@ -ranlib
		-rm -rf tmp
		-@rm -f $(TOPDIR)libisode.a
		-@$(LN) $@ $(TOPDIR)libisode.a
		-@ls -l $@
		-@echo "ISODE library built normally"

libisode-:;

libisode-shared: isodevrsn.o
		@rm -f libisode.so.* $(TOPDIR)libisode.so.*
		@$(UTILDIR)make-lib.sh $(SYSTEM) -shared \
			-major `cat version.major``cat version.minor` \
			-minor `cat version.local` \
			libisode.a 
		@for i in libisode.s[ao].* ;\
		do \
			rm -f $(TOPDIR)$$i; \
			$(LN) $$i $(TOPDIR)$$i; \
			ls -l $$i; \
		done
		@echo "shared ISODE library built normally"
		@touch $@
		

llib-lisode:	$(LLIBS)
		-@echo '/* llib-lisode - lint library for -lisode */' > $@
		-@echo '' >> $@
		cat $(LLIBS) >> $@
		-@rm -f $(TOPDIR)llib-lisode
		-@$(LN) llib-lisode $(TOPDIR)llib-lisode

isodevrsn.c:	$(LIBES)
		@$(UTILDIR)version.sh isode > $@


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

clean:;		rm -f *.o *.a *.so.* x* z* _* core isodevrsn.c llib-lisode \
		    libisode-shared

true:;

