CC = gcc
###############################################################################################
# Use the following symbols for normal operation
LDFLAGS = -lpthread -lm
CFLAGS = -O3 -Wall -Wextra

# Use the following when debugging to compile in backtrace capabilities
#LDFLAGS = -lpthread -rdynamic
#CFLAGS = -Og -g -Wall -Wextra -funwind-tables -DDEBUG
###############################################################################################
all: test_pthread test_pthread2 test_pthread3
###############################################################################################
test_pthread.o : test_pthread.c
	-$(CC) -c test_pthread.c -o $@ $(CFLAGS)

test_pthread : test_pthread.o
	-$(CC) test_pthread.o -o $@ $(LDFLAGS)
	-chmod 755 test_pthread
###############################################################################################
test_pthread2.o : test_pthread2.c
	-$(CC) -c test_pthread2.c -o $@ $(CFLAGS)

test_pthread2 : test_pthread2.o
	-$(CC) test_pthread2.o -o $@ $(LDFLAGS)
	-chmod 755 test_pthread2
###############################################################################################
test_pthread3.o : test_pthread3.c
	-$(CC) -c test_pthread3.c -o $@ $(CFLAGS)

test_pthread3 : test_pthread3.o
	-$(CC) test_pthread3.o -o $@ $(LDFLAGS)
	-chmod 755 test_pthread3
###############################################################################################
clean:
	-rm -f *.o *~ test_pthread test_pthread2 test_pthread3
