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