PRESTO  = ../..
LIBPRESTO = $(PRESTO)/libpresto.a
LIBS	= $(LIBPRESTO) -lpps
CC	= CC
IDIR	= $(PRESTO)
LDFLAGS = -Y -Z200000
CFLAGS  = +h$(IDIR)/asmdefs.h -g -I$(IDIR) $(LDFLAGS)
SRC 	=	../../../test/exer
PROGS	=	atomtest cvar locktest montest pingpong spintest

all:		atomtest cvar locktest montest pingpong spintest

atomtest:	atomtest.o $(LIBPRESTO)
		$(CC) $(CFLAGS) atomtest.o $(LIBS) -o atomtest

cvar:		cvar.o $(LIBPRESTO)
		$(CC) $(CFLAGS) cvar.o  $(LIBS) -o cvar

locktest:	locktest.o $(LIBPRESTO)
		$(CC) $(CFLAGS) locktest.o $(LIBS) -o locktest

montest:	montest.o $(LIBPRESTO)
		$(CC) $(CFLAGS) $(LDFLAGS) montest.o $(LIBS) -o montest

pingpong:	pingpong.o $(LIBPRESTO)
		$(CC) $(CFLAGS) $(LDFLAGS) pingpong.o $(LIBS) -o pingpong

spintest:	spintest.o
		$(CC) $(CFLAGS) spintest.o $(LIBS) -o spintest

clean:
		rm -f *.o *..c __ctdt.c core

cleanlinks:	clean
		rm -f *.h *.c README runtests $(PROGS)

links:
		-ln -s $(SRC)/atomtest.c atomtest.c 
		-ln -s $(SRC)/cvar.c cvar.c
		-ln -s $(SRC)/locktest.c locktest.c
		-ln -s $(SRC)/montest.c montest.c
		-ln -s $(SRC)/pingpong.c pingpong.c
		-ln -s $(SRC)/spintest.c spintest.c
		-ln -s $(SRC)/README README
		-ln -s $(SRC)/runtests runtests
