## -*- ksh -*-
##
## SMakefile for cisco-load
##
## $Id: SMakefile,v 1.1.1.1 1998/03/08 01:36:51 ryan Exp $
##
###########################################################################

## Aggressive optimizations
##
MFARGS=""
CC=cc
case `uname` in
  Linux) CFLAGS="-O3"
#	 LDFLAGS
	 SHFLAG="-fPIC"
	 SHEXT=".so"
	 ;;
  IRIX) CFLAGS="-O2"
	LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib"
	SHFLAG="-shared -rdata_shared -KPIC" # ???
	SHEXT=".so"
	MFARGS="--with-mips-abi=${ABI}"
	;;
  HP-UX) CFLAGS="-Ae +O3 +Oaggressive" 
	 LDFLAGS="-L/usr/local/lib -Wl,+b,/usr/local/lib"
	 SHFLAG="+z"
	 SHEXT=".sl"
	 ;;
  SunOS)   
	 if test "`uname -r`" = "4.1.3_U1"; then 
	   CC=gcc
	   CFLAGS=-O3
	   LDFLAGS=""
	   SHFLAG="-fPIC"
	   SHEXT=".so"
	 else
	   CFLAGS="-xO4 -xdepend"
	   LDFLAGS="-L/usr/local/lib -R/usr/local/lib"
	   SHFLAG="-shared"
	   SHEXT=".so"
	 fi
	 ;;
  ULTRIX)  CFLAGS="-O"
	   LDFLAGS=""
	   SHFLAG=""
	   ;;
  *)       CFLAGS=-g
	   LDFLAGS=""
	   SHFLAG=""
	   ;;
esac

## Debugging on my workstation, but nowhere else. :)
if test "`hostname`" = "lister.net.cmu.edu"; then
  CC=gcc
  CFLAGS="-g -Wall -pedantic";
  PWD=`pwd`
  FOO=`echo $PWD | sed -e 's/\/[0-9]*$//'`
  DESTDIR=/usr/tmp/ryan/depot/`basename $FOO`
fi

## For C++
CXXFLAGS=${CFLAGS}

export CC CXX
export CFLAGS CXXFLAGS
export LDFLAGS

##
## This causes configure to be run as the 'makefile' command.
##
MFCOMMAND="./configure $MFARGS --with-conf=/afs/andrew.cmu.edu/data/db/net/utils/routers.txt"

##
## This will allow you to execute 'smake install', and won't set
## the prefix in GNU makefiles to the AFS destdir.  When the 'all' target
## is made, the prefix will be '/usr/local'.  However, when install is
## executed, the prefix will be set to '$(DESTDIR)'.
##
INSTCOMMAND="${MAKE} prefix=${DESTDIR} exec_prefix=${DESTDIR} install"
