# Class 24: a race on threads you start, a mutex, and a deadlock.
#   make count, make deadlock: make's own rule builds prog from prog.c with
#   CFLAGS; -pthread is what pthread_create and pthread_mutex_lock need.
# Two builds. make count checks: -fsanitize=thread reports a data race, a lock
# destroyed while held, two locks taken in two orders. make -B count MEASURE=1
# measures: no sanitizer, which would be part of every time you take. -B
# rebuilds whether or not the file changed, which a change of flags needs.
# -O2 is left out of both here, because the sum is all the work and -O2 would
# rewrite the loop into one multiplication; a program with real work keeps it.

CFLAGS = -Wall -g -pthread -fsanitize=thread
ifdef MEASURE
CFLAGS = -Wall -g -pthread
endif

clean:
	rm -f count deadlock
