-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathMakefile
79 lines (63 loc) · 1.66 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Configurable options
# MODE = release | debug (default: release)
# Management PC specific settings
OS_NAME := $(shell uname -s)
ifeq ($(OS_NAME),Darwin) # for OS X, use build in tools
CORE_NUM := $(shell sysctl -n hw.ncpu)
else # Linux and other
CORE_NUM := $(shell nproc)
endif
ifneq ($(CORE_SPEED_KHz), )
CFLAGS += -DCORE_NUM=${CORE_NUM}
else
CFLAGS += -DCORE_NUM=4
endif
$(info *** Using as a default number of cores: $(CORE_NUM) on 1 socket)
$(info ***)
# Generic configurations
CFLAGS += --std=gnu99 -pedantic -Wall
CFLAGS += -fno-strict-aliasing
CFLAGS += -D_GNU_SOURCE
CFLAGS += -D_REENTRANT
CFLAGS += -I include
LDFLAGS += -lpthread
ifneq ($(MODE),debug)
CFLAGS += -O3 -DNDEBUG
else
CFLAGS += -g
endif
OUT = out
EXEC = $(OUT)/test-lock $(OUT)/test-lockfree
all: $(EXEC)
deps =
LOCK_OBJS =
LOCK_OBJS += src/lock/list.o
LOCK_OBJS += src/main.o
deps += $(LOCK_OBJS:%.o=%.o.d)
$(OUT)/test-lock: $(LOCK_OBJS)
@mkdir -p $(OUT)
$(CC) -o $@ $^ $(LDFLAGS)
src/lock/%.o: src/lock/%.c
$(CC) $(CFLAGS) -DLOCK_BASED -o $@ -MMD -MF [email protected] -c $<
LOCKFREE_OBJS =
LOCKFREE_OBJS += src/lockfree/list.o
LOCKFREE_OBJS += src/main.o
deps += $(LOCKFREE_OBJS:%.o=%.o.d)
$(OUT)/test-lockfree: $(LOCKFREE_OBJS)
@mkdir -p $(OUT)
$(CC) -o $@ $^ $(LDFLAGS)
src/lockfree/%.o: src/lockfree/%.c
$(CC) $(CFLAGS) -DLOCKFREE -o $@ -MMD -MF [email protected] -c $<
check: $(EXEC)
bash scripts/test_correctness.sh
bench: $(EXEC)
bash scripts/run_ll.sh
bash scripts/create_plots_ll.sh >/dev/null
@echo Check the plots generated in directory 'out/plots'.
clean:
$(RM) -f $(EXEC)
$(RM) -f $(LOCK_OBJS) $(LOCKFREE_OBJS) $(deps)
distclean: clean
$(RM) -rf out
.PHONY: all check clean distclean
-include $(deps)