-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (44 loc) · 1.47 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
override CFLAGS := -Wall -Werror -std=gnu99 -O0 -g $(CFLAGS) -I.
# you can uncomment following to add sanitizer for development; note make sure to not have this for submissions
#override CFLAGS := -fsanitize=undefined $(CFLAGS)
#override LDFLAGS := -fsanitize=undefined -fsanitize=leak $(LDLAGS)
TESTDIR=tests
# Add any additional tests here
test_files=test_busy_threads test_many_threads \
test_random_threads test_new_threads \
test_zombie_threads test_wait_thread \
test_sync test_mutex test_mutex_2 \
test_barrier test_barrier_2
custom_tests= test_one_thread test_custom_schedule \
test_early_exit test_mutex test_barrier
PREEMPT=1
ifeq ($(PREEMPT),0)
override CFLAGS += -DPREEMPT=0
test_files=$(custom_tests)
endif
# Build the threads.o file
threads.o: threads.c ec440threads.h
all: check
# You might find it useful to write test programs and get them working against the installed pthreads
# to do so, set TSTMYPTHREADS to a value other than 1
TSTMYPTHREADS=1
ifeq ($(TSTMYPTHREADS),1)
mythread=threads.o
else
mythread=
override LDFLAGS += -pthread
endif
CC = gcc
# rules to build each of the tests
test_files := $(addprefix $(TESTDIR)/,$(test_files))
objects := $(addsuffix .o,$(test_files))
$(objects): %.o: %.c
$(test_files): %: %.o $(mythread)
.PHONY: clean check checkprogs
# Build all of the test programs
checkprogs: $(test_files)
# Run the test programs
check: checkprogs
/bin/bash run_tests.sh $(test_files)
clean:
rm -f *.o *~ $(TESTDIR)/*.o $(test_files)