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



#------------------------------------------------------ 
# lap.mak.include
#------------------------------------------------------ 
# included general file into makefiles for different 
# protocols
#------------------------------------------------------ 

.KEEP_STATE:

# Programming model used.
MODEL = parmacs

# gcc 

# Target name
TARGET = lap
TARGETDIR = .

# Invariants, you shouldn't (typically) override these.
INC = -I$(WWT_ROOT)/Include/$(PROTOCOL) -I$(WWT_ROOT)/Include \
	-I/usr/include

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

# You should not change these.
CFLAGS = $(STD_CFLAGS) $(OTHER_CFLAGS)
LDFLAGS = $(STD_LDFLAGS) $(OTHER_LDFLAGS)

WWTLIBDIR = $(WWT_ROOT)/Lib
#LIBDIRS = -L$(WWTLIBDIR) -L$(WWTLIBDIR)/$(PROTOCOL)
#LIBS =  -l$(MODEL) -lm -lc
# gcc
LIBDIRS = -L$(WWTLIBDIR) -L$(WWTLIBDIR)/$(PROTOCOL) \
         -L/p/cm5/gcc/lib/gcc-lib/sparc-sun-sunos4.1.3/2.5.8
LIBS =  -l$(MODEL) -lm -lgcc -lc

# /lib/crt0.o provides a pointer to the environment needed by some 
# lib objects
OBJS = lap.o geometry.o /lib/crt0.o

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

.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 $(OTHER_VTFLAGS) $(TARGET).no-vt
#       wwt_strip $(TARGET)
#	compress $(TARGET)

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

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

# file dependencies.
lap.o: lap.c geometry.h my.h
geometry.o: geometry.c geometry.h my.h

# "clean" rule.
clean:
	/bin/rm -f $(TARGET) $(TARGET).Z $(TARGET).no-vt *.[coh]
