CFLAGS	=	-O0 -g -Wall \
		-I. \
		-D_GNU_SOURCE \
		-D _BITS_PTHREADTYPES_H -D _PTHREAD_H -D _BITS_SIGTHREAD_H \
		-D _PTHREADS_COMPATABLE #\
		#-pedantic -D__STRICT_ANSI__
CC	=	gcc
OBJS	=	machine.o context.o spinlock.o \
		wait.o \
		mutex.o condvar.o rwlock.o semaphore2.o \
		create.o exit.o attr.o cancel.o once.o \
		sigthread.o \
		manager.o \
		io.o net.o \
		ZilvioTHREADS.o

LDFLAGS	=	-shared -g -ldl

all: ZilvioTHREADS example1 example2 example3 example4

ZilvioTHREADS: $(OBJS)
	$(LD) $(LDFLAGS) $(OBJS) -o libZilvioTHREADS.so

example1: libZilvioTHREADS.so testsuite/example1.c
	$(CC) $(CFLAGS) testsuite/example1.c -L. -lZilvioTHREADS -o example1

example2: libZilvioTHREADS.so testsuite/example2.c
	$(CC) $(CFLAGS) testsuite/example2.c -L. -lZilvioTHREADS -o example2 -lm

example3: libZilvioTHREADS.so testsuite/example3.c
	$(CC) $(CFLAGS) testsuite/example3.c -L. -lZilvioTHREADS -o example3

example4: libZilvioTHREADS.so testsuite/example4.c
	$(CC) $(CFLAGS) testsuite/example4.c -L. -lZilvioTHREADS -o example4

clean:
	rm -f example[1234]
	rm -f *.o *.so
