Commit | Line | Data |
---|---|---|
bcf80111 SM |
1 | |
2 | #CFLAGS=-m64 -Wall -O2 -g -I. | |
3 | CFLAGS=-m64 -O2 -g -I. | |
4 | LDFLAGS=-lpthread | |
5 | ||
6 | #debug | |
b82229e4 | 7 | #CFLAGS=-m64 -Wall -g |
bcf80111 SM |
8 | #CFLAGS+=-DDEBUG_FULL_MB |
9 | ||
10 | #Changing the signal number used by the library. SIGUSR1 by default. | |
11 | #CFLAGS+=-DSIGURCU=SIGUSR2 | |
12 | ||
b82229e4 | 13 | SRC_DEP=`echo $^ | sed 's/[^ ]*\.h//g'` |
bcf80111 SM |
14 | |
15 | all: arch-api test_urcu test_urcu_dynamic_link test_urcu_timing \ | |
b82229e4 MD |
16 | test_rwlock_timing test_rwlock test_perthreadlock_timing \ |
17 | test_perthreadlock test_urcu_yield test_urcu_mb \ | |
18 | urcu-asm.S test_qsbr_timing test_qsbr urcu-asm.o urcutorture \ | |
19 | urcutorture-yield liburcu.so | |
bcf80111 SM |
20 | |
21 | arch-api: api.h arch.h | |
22 | # Run either make pthreads-x86 or make pthreads-ppc prior to build | |
23 | # the RCU library. Architecture auto-detectection not implemented | |
24 | # in the build system yet. | |
25 | ||
26 | pthreads-x86: clean | |
27 | cp api_x86.h api.h | |
28 | cp arch_x86.h arch.h | |
29 | cp arch_atomic_x86.h arch_atomic.h | |
30 | ||
31 | pthreads-ppc: clean | |
32 | cp api_ppc.h api.h | |
33 | cp arch_ppc.h arch.h | |
34 | cp arch_atomic_ppc.h arch_atomic.h | |
35 | ||
36 | test_urcu: urcu.o test_urcu.c urcu.h | |
37 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
38 | ||
b82229e4 MD |
39 | test_urcu_mb: urcu-mb.o test_urcu.c urcu.h |
40 | $(CC) -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
41 | ||
42 | test_qsbr: urcu-qsbr.o test_qsbr.c urcu-qsbr.h | |
43 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
44 | ||
45 | test_rwlock: urcu.o test_rwlock.c urcu.h | |
46 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
47 | ||
48 | test_perthreadlock: urcu.o test_perthreadlock.c urcu.h | |
49 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
50 | ||
bcf80111 SM |
51 | test_urcu_dynamic_link: urcu.o test_urcu.c urcu.h |
52 | $(CC) ${CFLAGS} -DDYNAMIC_LINK_TEST $(LDFLAGS) -o $@ $(SRC_DEP) | |
53 | ||
54 | test_urcu_yield: urcu-yield.o test_urcu.c urcu.h | |
55 | $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
56 | ||
57 | test_urcu_timing: urcu.o test_urcu_timing.c urcu.h | |
58 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
59 | ||
b82229e4 MD |
60 | test_qsbr_timing: urcu-qsbr.o test_qsbr_timing.c urcu-qsbr.h |
61 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
62 | ||
bcf80111 SM |
63 | test_rwlock_timing: urcu.o test_rwlock_timing.c urcu.h |
64 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
65 | ||
b82229e4 MD |
66 | test_perthreadlock_timing: urcu.o test_perthreadlock_timing.c urcu.h |
67 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
68 | ||
bcf80111 SM |
69 | urcu.o: urcu.c urcu.h |
70 | $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) | |
71 | ||
b82229e4 MD |
72 | urcu-mb.o: urcu.c urcu.h |
73 | $(CC) -fPIC -DDEBUG_FULL_MB ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) | |
74 | ||
75 | urcu-qsbr.o: urcu-qsbr.c urcu-qsbr.h | |
76 | $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) | |
77 | ||
bcf80111 SM |
78 | liburcu.so: urcu.o |
79 | $(CC) -m64 -fPIC -shared -o $@ $< | |
80 | ||
81 | urcu-yield.o: urcu.c urcu.h | |
82 | $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP) | |
83 | ||
84 | urcu-asm.S: urcu-asm.c urcu.h | |
85 | $(CC) ${CFLAGS} -S -o $@ $(SRC_DEP) | |
86 | ||
87 | urcu-asm.o: urcu-asm.c urcu.h | |
88 | $(CC) ${CFLAGS} -c -o $@ $(SRC_DEP) | |
89 | ||
90 | urcutorture: urcutorture.c urcu.o urcu.h rcutorture.h | |
91 | $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
92 | ||
93 | urcutorture-yield: urcutorture.c urcu-yield.o urcu.h rcutorture.h | |
94 | $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP) | |
95 | ||
96 | .PHONY: clean install arch-api | |
97 | ||
98 | install: liburcu.so | |
b82229e4 | 99 | cp -f liburcu.so /usr/lib/ |
bcf80111 SM |
100 | cp -f arch.h arch_atomic.h compiler.h urcu.h urcu-static.h /usr/include/ |
101 | ||
102 | clean: | |
b82229e4 MD |
103 | rm -f *.o test_urcu test_urcu_dynamic_link test_urcu_timing \ |
104 | test_rwlock_timing test_rwlock test_perthreadlock_timing \ | |
105 | test_perthreadlock test_urcu_yield test_urcu_mb \ | |
106 | urcu-asm.S test_qsbr_timing test_qsbr urcutorture \ | |
107 | urcutorture-yield liburcu.so | |
108 |