# Generated automatically from Makefile.in by configure.

# This is a Makefile for the snmp directory of scotty. If it has the
# name "Makefile.in" then it is a template for a Makefile; to generate
# the actual Makefile, run "./configure", which is a configuration
# script generated by the "autoconf" program (constructs like "@foo@"
# will get replaced in the actual Makefile.

#----------------------------------------------------------------
# Things you can change to personalize the Makefile for your own
# site (you can make these changes in either Makefile.in or
# Makefile, but changes to Makefile will get lost if you re-run
# the configuration script).
#----------------------------------------------------------------

# Default top-level directories in which to install architecture-
# specific files (exec_prefix) and machine-independent files such
# as scripts (prefix).  The values specified here may be overridden
# at configure-time with the --exec-prefix and --prefix options
# to the "configure" script.

prefix =	/usr/local
exec_prefix =	${prefix}

# Directory in which to install the program straps:
BIN_DIR =	$(exec_prefix)/bin

# Directory containing library files:
LIB_DIR =       $(exec_prefix)/lib

# Directory in which to install the scotty startup files.
SCOTTY_DIR =    $(LIB_DIR)/scotty

# To change the compiler switches, for example to change from -O
# to -g, change the following line:
CFLAGS = -O

# A "-I" switch that can be used when compiling to make all of the
# X11 include files accessible (the configure script will try to
# set this value, and will cause it to be an empty string if the
# include files are accessible via /usr/include).
X11_INCLUDES =	 -I/usr/X11R6/include

# A "-I" switch that can be used when compiling to make all the
# Tcl include files accessible (the configure script will try to
# set this value).
TCL_INCLUDES =	-I/usr/include/tcl

# A "-I" switch that can be used when compiling to make all the
# Tk include files accessible (the configure script will try to
# set this value).
TK_INCLUDES =	-I/usr/include/tcl

# Libraries to use when linking:  must include at least Tcl and the
# math library (in that order).  The first part will be replaced 
# with relevant libraries as determined by the configure script.
LIBS =  -lieee # -lresolv

# To disable ANSI-C procedure prototypes reverse the comment 
# characters on the following lines:
PROTO_FLAGS =
#PROTO_FLAGS = -DNO_PROTOTYPE

# Some versions of make, like SGI's, use the following variable to
# determine which shell to use for executing commands:
SHELL =		/bin/sh

#----------------------------------------------------------------
# The symbols below provide support for dynamic loading and shared
# libraries.  The values of the symbols are normally set by the
# configure script.  You shouldn't normally need to modify any of
# these definitions by hand.  However, you can reverse the comments
# on the pairs of lines to force "no dynamic loading or shared
# libraries".
#----------------------------------------------------------------

# Flags to pass to cc when compiling the components of a shared
# library:
SHLIB_CFLAGS = 
#SHLIB_CFLAGS =

# Base command to use for combining object files into a shared
# library:
SHLIB_LD = 

# Suffix to use for the name of the shared library.  An empty string
# means we don't know how to use shared libraries on this platform.
SHLIB_SUFFIX = 
#SHLIB_SUFFIX = .a

# Library file(s) to include in tclsh and other base applications
# in order to provide facilities needed by DLOBJ above.
DL_LIBS = 
#DL_LIBS =

# Flags to pass to the compiler when linking object files into
# an executable wish or tktest binary.
LD_FLAGS = 
#LD_FLAGS =

#----------------------------------------------------------------
# The information below is modified by the configure script when
# Makefile is generated from Makefile.in.  You shouldn't normally
# modify any of this stuff by hand.
#----------------------------------------------------------------

INSTALL =		/usr/bin/install -c
INSTALL_PROGRAM =	${INSTALL}
INSTALL_DATA =		${INSTALL} -m 644
RANLIB =		ranlib
SRC_DIR =		.

#----------------------------------------------------------------
# The information below should be usable as is.  The configure
# script won't modify it and you shouldn't need to modify it
# either.
#----------------------------------------------------------------

CC =		cc
CC_SWITCHES =	${CFLAGS} -I${SRC_DIR} -I.. -I${SRC_DIR}/.. $(TCL_INCLUDES) $(TK_INCLUDES) $(X11_INCLUDES) ${PROTO_FLAGS}

SRCS =	asn1.c snmpMD5.c snmpNet.c snmpUtil.c snmpInst.c \
	snmpRequest.c snmpResponse.c snmpAgent.c snmpTcl.c \
	mibQuery.c mibParser.c mibTree.c mibFrozen.c mibTcl.c

OBJS =	asn1.o snmpMD5.o snmpNet.o snmpUtil.o snmpInst.o \
	snmpRequest.o snmpResponse.o snmpAgent.o snmpTcl.o \
	mibQuery.o mibParser.o mibTree.o mibFrozen.o mibTcl.o

SOBJS = asn1.so snmpMD5.so snmpNet.so snmpUtil.so snmpInst.so \
	snmpRequest.so 	snmpResponse.so snmpAgent.so snmpTcl.so \
	mibQuery.so mibParser.so mibTree.so mibFrozen.so mibTcl.so

.SUFFIXES: .so

.c.o:
	$(CC) -c $(CC_SWITCHES) $<

.c.so:
	$(CC) -o $*-so.o -c $(CC_SWITCHES) $(SHLIB_CFLAGS) $<
	mv $*-so.o $*.so

all: straps ../libscotty.a

../libscotty.a: $(OBJS)
	ar cru ../libscotty.a $(OBJS)
	$(RANLIB) ../libscotty.a

dynamic: straps $(SOBJS)

straps:	straps.o
	$(CC) -o straps straps.o $(LIBS)

snmpNet.o: snmpNet.c
	$(CC) -c $(CC_SWITCHES) -DSTRAPS=\"$(BIN_DIR)/straps\" $(SRC_DIR)/snmpNet.c

snmpNet.so: snmpNet.c
	$(CC) -o $*-so.o -c $(CC_SWITCHES) $(SHLIB_CFLAGS) -DSTRAPS=\"$(BIN_DIR)/straps\" $(SRC_DIR)/snmpNet.c
	mv $*-so.o $*.so

install:
	( cd mibs; $(MAKE) install )
	@echo
	@echo "--> You must be root to install straps. Please get root"
	@echo "--> permissions and then type >make sinstall<"
	@echo

sinstall: straps
	-if [ ! -d $(BIN_DIR) ] ; then \
		mkdir -p $(BIN_DIR); \
	else true; \
	fi
	rm -f $(BIN_DIR)/straps || true
	cp straps $(BIN_DIR)
	-chown root $(BIN_DIR)/straps || /etc/chown root $(BIN_DIR)/straps
	-chmod u+s $(BIN_DIR)/straps
	-chmod a-w $(BIN_DIR)/straps

depend: 
	cp Makefile Makefile.bak
	sed -e '/^# DO NOT DELETE THIS LINE/,$$d' < Makefile.bak > Makefile
	echo '# DO NOT DELETE THIS LINE' >> Makefile
	echo ' ' >> Makefile
	$(CC) -MM $(CC_SWITCHES) $(SRCS) >> Makefile

clean:
	@rm -f straps core *.o *.so *~
	@( echo "making clean in snmp/mibs"; cd mibs; $(MAKE) clean )

distclean:
	@rm -f straps core *.o *~ Makefile TAGS *.bak lmake.???
	@( echo "making distclean in snmp/mibs"; cd mibs; $(MAKE) distclean )

# DO NOT DELETE THIS LINE
