# 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:

WWT_ROOT = /p/wwt/users/chandra/cvsX
WWTLIBDIR = $(WWT_ROOT)/Lib

PROTOCOL = diriX
MODEL = parmacs


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

#===========
# C compiler stuff
#===========

CC = /p/cm5/gcc/bin/gcc
LIBDIRS = -L/p/cm5/gcc/lib/gcc-lib/sparc-sun-sunos4.1.3/2.5.8
LIBS = -lgcc

DCFLAGS =  -DWWT -DDIRIX -DPADDING $(INC)
AS = /usr/bin/as
ASFLAGS = -P $(INC) -DLOCORE

LDFLAGS = -n -dc -dp -e __wwt_startup_ -X
LIBDIRS += -L$(WWT_ROOT)/Lib -L$(WWT_ROOT)/Lib/$(PROTOCOL)

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


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

OOBJS = autogen.o generate.o tree.o /lib/crt0.o

# Name of your application
TARGET = autogen

# The application specific cc flags
CCFLAGS = -O2

# combined cc flags
CFLAGS = $(CCFLAGS) $(DCFLAGS)

# 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): $(OOBJS)
	ld $(LDFLAGS) $(OOBJS) -o $(TARGET).no-vt $(LIBDIRS) $(LIBS)
	/p/wwt/bin/vt -a $(TARGET) -d -w $(TARGET).no-vt
	/bin/rm $(TARGET).no-vt

# your application specific dependences

autogen.c: autogen.U autogen.h tree.h
generate.c: generate.U autogen.h
tree.c: tree.U tree.h

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


