# Copyright (c) 1994-95 by Mark Hill, James Larus, and David Wood for
# the Wisconsin Wind Tunnel Project.
#
# ALL RIGHTS RESERVED.
#
# This software is furnished under a license and may be used and
# copied only in accordance with the terms of such license and the
# inclusion of the above copyright notice.  This software or any other
# copies thereof or any derivative works may not be provided or
# otherwise made available to any other persons.  Title to and ownership
# of the software is retained by Mark Hill, James Larus, and David Wood.
# Any use of this software must include the above copyright notice.
#
# THIS SOFTWARE IS PROVIDED "AS IS".  THE LICENSOR MAKES NO
# WARRANTIES ABOUT ITS CORRECTNESS OR PERFORMANCE.

.KEEP_STATE:

TARGET = gauss 
TARGETDIR = .

WWTLIBDIR = $(WWT_ROOT)/Lib

MODEL = parmacs


INC = -I$(WWT_ROOT)/Include/$(PROTOCOL) -I$(WWT_ROOT)/Include

STD_CFLAGS =  $(INC)
STD_LDFLAGS = -n -dc -dp -e __wwt_startup_ -X

CFLAGS = $(STD_CFLAGS) $(OTHER_CFLAGS)
LDFLAGS = $(STD_LDFLAGS) $(OTHER_LDFLAGS)

LIBDIRS = -L$(WWT_ROOT)/Lib -L$(WWT_ROOT)/Lib/$(PROTOCOL) -L/p/cm5/gcc/lib/gcc-lib/sparc-sun-sunos4.1.3/2.5.8

LIBS = -l$(MODEL) -lgcc -lm -lc 


#==============
# PARMACS stuff
#==============
MACDIR = $(WWT_ROOT)/Lib
MACROS = $(MACDIR)/c.m4.monmacs $(MACDIR)/c.m4.smacs $(MACDIR)/c.m4.local

OBJS =  gauss_row_block.o utils.o tree.o /lib/crt0.o

# U->c->o and H->h conversions
.SUFFIXES:
.SUFFIXES: .o .c .U .h .H
.c.o: ; $(CC) -c $(CFLAGS) $*.c 
.U.c: ; m4 $(MACROS) $*.U >$*.c
.H.h: ; m4 $(MACROS) $*.H >$*.h

$(TARGET): $(OBJS)
	ld $(LDFLAGS) $(OBJS) -o $(TARGET).no-vt $(LIBDIRS) $(LIBS)
	/p/wwt/bin/vt -a $(TARGET) -d -w $(TARGET).no-vt
#	/p/WWT/Bin/wwt_strip $(TARGET)
#	compress $(TARGET)

install: rmtarget $(TARGET)
	cp $(TARGET).Z $(TARGETDIR)

rmtarget:
	rm -f $(TARGETDIR)/$(TARGET) $(TARGETDIR)/$(TARGET).Z

# your application specific dependences

gauss_row_block.c: gauss_row_block.U tree.h f2c.h
utils.c: utils.U f2c.h 
tree.c: tree.U tree.h

clean:
	rm -f *.[coh] $(TARGET) $(TARGET).no-vt $(TARGET).Z
