CC = gcc
CFLAGS = -O
DEFINES =
FILES = csr.c csr.h ftime.c ftime.h ptest.c mdata.c loop.c Makefile

test: ptest
	./ptest
ltest: loop
	./loop

ptest: ptest.o csr.o mdata.o ftime.o
	$(CC) $(CFLAGS) $(DEFINES)  -o ptest ptest.o csr.o mdata.o ftime.o
gentest: gentest.o csr.o mdata.o
	$(CC) $(CFLAGS) $(DEFINES) -o gentest gentest.o csr.o mdata.o
loop: loop.o ftime.o
	$(CC) $(CFLAGS) $(DEFINES) -o loop loop.o ftime.o

csr.o:	csr.c csr.h
	$(CC) $(CFLAGS) $(DEFINES) -c csr.c
mdata.o: mdata.c csr.h
	$(CC) $(CFLAGS) $(DEFINES) -c mdata.c
ptest.o: ptest.c csr.h ftime.h
	$(CC) $(CFLAGS) $(DEFINES) -c ptest.c
ftime.o: ftime.c ftime.h
	$(CC) $(CFLAGS) $(DEFINES) -c ftime.c
csr.s: 	csr.c csr.h
	$(CC) $(CFLAGS) $(DEFINES) -S csr.c -o csr.s
loop.o: ftime.h loop.c
	$(CC) $(CFLAGS) $(DEFINES) -c loop.c

benchmark.tar:  $(FILES)
	tar cvf benchmark.tar $(FILES)

clean:
	rm -f *.o ptest gentest loop
