###############################################################################
#   Instructions to Make, for compilation of SNMP-capable gawk processes
###############################################################################

###############################################################################
#
# $Header: /a/vulcan/xtel/isode/isode-master/snmp/gawk-2.11/s-gawk/RCS/Makefile,v 8.0 91/07/17 13:03:04 isode Rel $
#
# Contributed by NYSERNet Inc.  This work was partially supported by the
# U.S. Defense Advanced Research Projects Agency and the Rome Air Development
# Center of the U.S. Air Force Systems Command under contract number
# F30602-88-C-0016.
#
#
# $Log:	Makefile,v $
# Revision 8.0  91/07/17  13:03:04  isode
# Release 7.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.
#
###############################################################################

AWKDIR	=	/usr/local/lib/awk/

SHELLS	=	s-netstat s-traceroute
AWKS	=	mib.*
DEFS	=	protocols unix


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

all:		definitions
inst-all:	inst-scripts inst-definitions manuals
install:	inst-all clean
lint:;


##################################################################
# scripts
##################################################################

inst-scripts:;	-mkdir /usr/local/lib/awk
		@for h in $(SHELLS); \
			do $(MAKE)                  TARGET=$$h inst-script;done
		@for h in $(AWKS); \
			do $(MAKE) BINDIR=$(AWKDIR) TARGET=$$h inst-script;done

inst-script:	$(BINDIR)$(TARGET)

$(BINDIR)$(TARGET):	$(TARGET)
		-cp $@ z$(TARGET)
		cp $(TARGET) $@
		-@ls -gls $@
		-@echo ""


################################################################
# definitions
################################################################

inst-definitions:;	@for d in $(DEFS); \
				do $(MAKE) TARGET=$$d inst-definition; done

inst-definition:	$(AWKDIR)defs.$(TARGET)

$(AWKDIR)defs.$(TARGET):	defs.$(TARGET)
		-cp $@ zdefs.$(TARGET)
		-rm -f $@
		cp defs.$(TARGET) $@
		snmpi -f $@ compile $@
		-@ls -gls $@
		-@echo ""

definitions:;	@for d in $(DEFS); do $(MAKE) defs.$$d; done

DEFSPROTO=	$(INCDIR)snmp/smi.defs \
		$(INCDIR)snmp/mib.defs \
		$(INCDIR)snmp/clns.defs \
		$(INCDIR)snmp/smux.defs

defs.protocols:	$(DEFSPROTO)
		cat $(DEFSPROTO) > $@


DEFSUNIX=	$(INCDIR)snmp/smi.defs \
		$(INCDIR)snmp/unix.defs

defs.unix:	$(DEFSUNIX)
		cat $(DEFSUNIX) > $@


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

MANUALS	=	s-netstat.1c s-traceroute.1c

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


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

clean:;		rm -f z* _* defs.*

grind:;		iprint Makefile
		tgrind -lsh s-*.sh
		iprint mib.*
		@echo $(MANUALS) | \
			tr " " "\012" | \
			sed -e "s%.*%itroff -man &%" | \
			sh -ve

true:;
