Commit | Line | Data |
---|---|---|
bcf80111 SM |
1 | |
2 | #CFLAGS=-m64 -Wall -O2 -g -I. | |
3 | CFLAGS=-m64 -O2 -g -I. | |
4 | LDFLAGS=-lpthread | |
5 | ||
60fe0c90 MD |
6 | HOSTTYPE=$(shell uname -m) |
7 | ||
8 | ifeq ("${HOSTTYPE}","x86_64") | |
9 | ARCHTYPE=x86 | |
10 | endif | |
60fe0c90 MD |
11 | ifeq ("${HOSTTYPE}","powerpc") |
12 | ARCHTYPE=ppc | |
13 | endif | |
14 | ||
bcf80111 | 15 | #debug |
b82229e4 | 16 | #CFLAGS=-m64 -Wall -g |
bcf80111 SM |
17 | #CFLAGS+=-DDEBUG_FULL_MB |
18 | ||
19 | #Changing the signal number used by the library. SIGUSR1 by default. | |
20 | #CFLAGS+=-DSIGURCU=SIGUSR2 | |
21 | ||
b82229e4 | 22 | SRC_DEP=`echo $^ | sed 's/[^ ]*\.h//g'` |
bcf80111 | 23 | |
60fe0c90 | 24 | all: checkarch test_urcu test_urcu_dynamic_link test_urcu_timing \ |
b82229e4 MD |
25 | test_rwlock_timing test_rwlock test_perthreadlock_timing \ |
26 | test_perthreadlock test_urcu_yield test_urcu_mb \ | |
27 | urcu-asm.S test_qsbr_timing test_qsbr urcu-asm.o urcutorture \ | |
51299083 | 28 | urcutorture-yield liburcu.so test_mutex |
bcf80111 | 29 | |
60fe0c90 MD |
30 | checkarch: |
31 | ifeq (${ARCHTYPE},) | |
32 | @echo "Architecture ${HOSTTYPE} is currently unsupported by liburcu" | |
33 | @exit 1 | |
34 | endif | |
35 | ||
36 | arch.h: arch_${ARCHTYPE}.h | |
37 | cp -f arch_${ARCHTYPE}.h arch.h | |
38 | ||
39 | api.h: api_${ARCHTYPE}.h | |
40 | cp -f api_${ARCHTYPE}.h api.h | |
bcf80111 | 41 | |
60fe0c90 MD |
42 | arch_atomic.h: arch_atomic_${ARCHTYPE}.h |
43 | cp -f arch_atomic_${ARCHTYPE}.h arch_atomic.h | |
bcf80111 | 44 | |
60fe0c90 MD |
45 | urcu.h: arch.h api.h arch_atomic.h |
46 | ||
47 | urcu-qsbr.h: arch.h api.h arch_atomic.h | |
bcf80111 SM |
48 | |
49 | test_urcu: urcu.o test_urcu.c urcu.h | |
50 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
51 | ||
b82229e4 MD |
52 | test_urcu_mb: urcu-mb.o test_urcu.c urcu.h |
53 | $(CC) -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
54 | ||
55 | test_qsbr: urcu-qsbr.o test_qsbr.c urcu-qsbr.h | |
56 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
57 | ||
58 | test_rwlock: urcu.o test_rwlock.c urcu.h | |
59 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
60 | ||
61 | test_perthreadlock: urcu.o test_perthreadlock.c urcu.h | |
62 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
63 | ||
51299083 MD |
64 | test_mutex: urcu.o test_mutex.c urcu.h |
65 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
66 | ||
bcf80111 SM |
67 | test_urcu_dynamic_link: urcu.o test_urcu.c urcu.h |
68 | $(CC) ${CFLAGS} -DDYNAMIC_LINK_TEST $(LDFLAGS) -o $@ $(SRC_DEP) | |
69 | ||
70 | test_urcu_yield: urcu-yield.o test_urcu.c urcu.h | |
71 | $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
72 | ||
73 | test_urcu_timing: urcu.o test_urcu_timing.c urcu.h | |
74 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
75 | ||
b82229e4 MD |
76 | test_qsbr_timing: urcu-qsbr.o test_qsbr_timing.c urcu-qsbr.h |
77 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
78 | ||
bcf80111 SM |
79 | test_rwlock_timing: urcu.o test_rwlock_timing.c urcu.h |
80 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
81 | ||
b82229e4 MD |
82 | test_perthreadlock_timing: urcu.o test_perthreadlock_timing.c urcu.h |
83 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
84 | ||
bcf80111 SM |
85 | urcu.o: urcu.c urcu.h |
86 | $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) | |
87 | ||
b82229e4 MD |
88 | urcu-mb.o: urcu.c urcu.h |
89 | $(CC) -fPIC -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) | |
90 | ||
91 | urcu-qsbr.o: urcu-qsbr.c urcu-qsbr.h | |
92 | $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) | |
93 | ||
bcf80111 SM |
94 | liburcu.so: urcu.o |
95 | $(CC) -m64 -fPIC -shared -o $@ $< | |
96 | ||
97 | urcu-yield.o: urcu.c urcu.h | |
98 | $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) | |
99 | ||
100 | urcu-asm.S: urcu-asm.c urcu.h | |
101 | $(CC) ${CFLAGS} -S -o $@ $(SRC_DEP) | |
102 | ||
103 | urcu-asm.o: urcu-asm.c urcu.h | |
104 | $(CC) ${CFLAGS} -c -o $@ $(SRC_DEP) | |
105 | ||
106 | urcutorture: urcutorture.c urcu.o urcu.h rcutorture.h | |
107 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
108 | ||
109 | urcutorture-yield: urcutorture.c urcu-yield.o urcu.h rcutorture.h | |
110 | $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
111 | ||
60fe0c90 | 112 | .PHONY: clean install checkarch |
bcf80111 SM |
113 | |
114 | install: liburcu.so | |
b82229e4 | 115 | cp -f liburcu.so /usr/lib/ |
bcf80111 SM |
116 | cp -f arch.h arch_atomic.h compiler.h urcu.h urcu-static.h /usr/include/ |
117 | ||
118 | clean: | |
b82229e4 MD |
119 | rm -f *.o test_urcu test_urcu_dynamic_link test_urcu_timing \ |
120 | test_rwlock_timing test_rwlock test_perthreadlock_timing \ | |
121 | test_perthreadlock test_urcu_yield test_urcu_mb \ | |
122 | urcu-asm.S test_qsbr_timing test_qsbr urcutorture \ | |
51299083 MD |
123 | urcutorture-yield liburcu.so api.h arch.h arch_atomic.h \ |
124 | test_mutex | |
b82229e4 | 125 |