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