# Copyright (c) Michael L. Scott, 2001, 2002

.SUFFICES: .o .c

CC = gcc
CFLAGS = -msupersparc -Wa,-xarch=v8plus -O3

CFILES = atomic_ops.c \
	clh_plain.c     clh_plain_numa.c \
	clh_try.c		clh2_try.c		\
	clh_try_swap.c \
	mcs_plain.c \
	mcs_try.c		mcs2_try.c \
	tas.c time_test.c thread_data.c local_qnodes.c

OFILES = atomic_ops.o \
	clh_plain.o     clh_plain_numa.o \
	clh_try.o		clh2_try.o \
	clh_try_swap.o  \
	mcs_plain.o \
	mcs_try.o		mcs2_try.o \
	tas.o time_test.o thread_data.o local_qnodes.o

HFILES = atomic_ops.h atomic_op_bodies.h \
	main.h \
	tas.h mcs.h clh.h \
	inline.h \
	thread_data.h local_qnodes.h

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

time_test: $(OFILES) atomic_ops.o
	$(CC) -o time_test $(CFLAGS) \
		$(OFILES) -lpthread

time_test.s: time_test.c
	$(CC) -S -fverbose-asm $(CFLAGS) time_test.c

atomic_ops.o: atomic_ops.c
	gcc -c -g -msupersparc -Wa,-xarch=v8plus atomic_ops.c

test: test.c atomic_ops.o
	gcc -o test -g -msupersparc -Wa,-xarch=v8plus test.c atomic_ops.o

sources:
	@echo $(CFILES) $(HFILES)

clean:
	rm *.o time_test

tags:
	etags $(CFILES) $(HFILES) > TAGS

depend:
	echo '# DO NOT EDIT THIS FILE -- it is automatically generated' \
		> makefile.dep
	echo '' >> makefile.dep
	gcc -M $(CFILES) >> makefile.dep

include makefile.dep
