# /****************************************************************
# Copyright (C) 1997-1998, 2001 Lucent Technologies
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that the copyright notice and this
# permission notice and warranty disclaimer appear in supporting
# documentation, and that the name of Lucent or any of its entities
# not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
#
# LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
# IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
# THIS SOFTWARE.
# ****************************************************************/

.SUFFIXES: .c .o
CC = cc
F77 = f77
CFLAGS = -O -I$S

## On HP systems, add -ldld to the end of the L = line below.
## On linux and Solaris systems, add -ldl to the end of the L = line below.
L =

S = ..
# "S = .." assumes this directory is solvers/snopt .

# See $S/makefile for comments about CFLAGS.

M = src
# Adjust "M = src" appropriately if you put the SNOPT
# source directory elsewhere.
# $M should be the directory containing libsnopt.a

.c.o:
	$(CC) -c $(CFLAGS) $*.c

# If your Fortran compiler does not append underscores to external names,
# change snopt.o to snopt_.o below.

# On some systems, you can omit $M/libblas.a and add -lblas to the "L ="
# assignment above.

snopt = snopt.o $M/libsnopt.a $M/libsnprint.a $M/libblas.a $S/amplsolver.a
snopt: $(snopt)
	$(F77) -o snopt $(snopt) $L
	strip snopt

# Student version

ssnopt = snopt.o $S/sjac0dim.o $M/libsnopt.a $M/libsnprint.a $M/libblas.a $S/amplsolver.a
ssnopt: $(ssnopt)
	$(F77) -o ssnopt $(ssnopt) $L
	strip ssnopt

$S/sjac0dim.o: $S/sjac0dim.c $S/jac0dim.c $S/asl.h
	cd $S; make sjac0dim.o

# "make xsum.out" to check for transmission errors.
# This assumes you have the xsum program, whose source is
# /netlib/f2c/src/xsum.c, e.g.,
#	http://www.netlib.org/f2c/src/xsum.c
# or
#	http://netlib.sandia.gov/f2c/src/xsum.c.gz

xs0 = README configure configurehere makefile.u makefile.vc snopt.c snopt_.c \
	src/makefile.fu src/makefile.u src/makefile.vc src/snopt.lbc

xsum.out: $(xs0)
	xsum $(xs0) >xsum1.out
	cmp xsum0.out xsum1.out && mv xsum1.out xsum.out || diff xsum[01].out
