CC = gcc
CFLAGS = -Wall -g 
LDFLAGS = -pthread

PROGRAMS = cond_signal cond_signal_n cond_broadcast deadlock teste_rlock \
       spin spin-futex mutex1 \
       mutex_recursive

all: $(PROGRAMS)

lr.o: lr.h lr.c
	$(CC) $(CFLAGS) -c lr.c

teste_rlock: lr.o teste_rlock.c
	$(CC) $(CFLAGS) $(LDFLAGS) lr.o teste_rlock.c -o teste_rlock

spin-futex: spin-futex.o myfutex.o

mutex1: mutex1.o myfutex.o

mutex_recursive:  mutex_recursive.o myfutex.o

mutex_adaptive:  mutex_adaptive.o myfutex.o

mutex_prio:  mutex_prio.o myfutex.o

mutex_errorcheck:  mutex_errorcheck.o myfutex.o

clean:
	rm -f *.o *~ $(PROGRAMS)