2 #CFLAGS=-m64 -Wall -O2 -g -I.
6 HOSTTYPE=$(shell uname -m)
8 ifeq ("${HOSTTYPE}","x86_64")
11 ifeq ("${HOSTTYPE}","powerpc")
14 ifeq ("${HOSTTYPE}","ppc64")
21 #Build the library without using signals. Slower read-side.
22 #CFLAGS+=-DCONFIG_URCU_AVOID_SIGNALS
24 #Changing the signal number used by the library. SIGUSR1 by default.
25 #CFLAGS+=-DSIGURCU=SIGUSR2
27 SRC_DEP=`echo $^ | sed 's/[^ ]*\.h//g'`
29 all: checkarch test_urcu test_urcu_dynamic_link test_urcu_timing \
30 test_rwlock_timing test_rwlock test_perthreadlock_timing \
31 test_perthreadlock test_urcu_yield test_urcu_mb \
32 urcu-asm.S test_qsbr_timing test_qsbr urcu-asm.o urcutorture \
33 urcutorture-yield liburcu.so test_mutex test_looplen test_urcu_gc \
34 test_urcu_gc_mb test_qsbr_gc test_qsbr_lgc test_urcu_lgc \
39 @echo "Architecture ${HOSTTYPE} is currently unsupported by liburcu"
43 arch.h: arch_${ARCHTYPE}.h
44 cp -f arch_${ARCHTYPE}.h arch.h
46 api.h: api_${ARCHTYPE}.h
47 cp -f api_${ARCHTYPE}.h api.h
49 arch_atomic.h: arch_atomic_${ARCHTYPE}.h
50 cp -f arch_atomic_${ARCHTYPE}.h arch_atomic.h
52 urcu.h: arch.h api.h arch_atomic.h
54 urcu-qsbr.h: arch.h api.h arch_atomic.h
56 test_urcu: urcu.o test_urcu.c urcu.h
57 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
59 test_looplen: test_looplen.c urcu.h
60 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
62 test_urcu_mb: urcu-mb.o test_urcu.c urcu.h
63 $(CC) -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
65 test_urcu_gc: urcu.o test_urcu_gc.c urcu.h
66 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
68 test_urcu_gc_mb: urcu-mb.o test_urcu_gc.c urcu.h
69 $(CC) -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
71 test_urcu_lgc: urcu.o test_urcu_gc.c urcu.h
72 $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
74 test_urcu_lgc_mb: urcu-mb.o test_urcu_gc.c urcu.h
75 $(CC) -DTEST_LOCAL_GC -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
77 test_qsbr: urcu-qsbr.o test_qsbr.c urcu-qsbr.h
78 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
80 test_qsbr_gc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h
81 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
83 test_qsbr_lgc: urcu-qsbr.o test_qsbr_gc.c urcu-qsbr.h
84 $(CC) -DTEST_LOCAL_GC ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
86 test_rwlock: urcu.o test_rwlock.c urcu.h
87 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
89 test_perthreadlock: urcu.o test_perthreadlock.c urcu.h
90 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
92 test_mutex: urcu.o test_mutex.c urcu.h
93 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
95 test_urcu_dynamic_link: urcu.o test_urcu.c urcu.h
96 $(CC) ${CFLAGS} -DDYNAMIC_LINK_TEST $(LDFLAGS) -o $@ $(SRC_DEP)
98 test_urcu_yield: urcu-yield.o test_urcu.c urcu.h
99 $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
101 test_urcu_timing: urcu.o test_urcu_timing.c urcu.h
102 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
104 test_qsbr_timing: urcu-qsbr.o test_qsbr_timing.c urcu-qsbr.h
105 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
107 test_rwlock_timing: urcu.o test_rwlock_timing.c urcu.h
108 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
110 test_perthreadlock_timing: urcu.o test_perthreadlock_timing.c urcu.h
111 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
113 urcu.o: urcu.c urcu.h
114 $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP)
116 urcu-mb.o: urcu.c urcu.h
117 $(CC) -fPIC -DCONFIG_URCU_AVOID_SIGNALS ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP)
119 urcu-qsbr.o: urcu-qsbr.c urcu-qsbr.h
120 $(CC) -fPIC ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP)
123 $(CC) -m64 -fPIC -shared -o $@ $<
125 urcu-yield.o: urcu.c urcu.h
126 $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -c -o $@ $(SRC_DEP)
128 urcu-asm.S: urcu-asm.c urcu.h
129 $(CC) ${CFLAGS} -S -o $@ $(SRC_DEP)
131 urcu-asm.o: urcu-asm.c urcu.h
132 $(CC) ${CFLAGS} -c -o $@ $(SRC_DEP)
134 urcutorture: urcutorture.c urcu.o urcu.h rcutorture.h
135 $(CC) ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
137 urcutorture-yield: urcutorture.c urcu-yield.o urcu.h rcutorture.h
138 $(CC) -DDEBUG_YIELD ${CFLAGS} $(LDFLAGS) -o $@ $(SRC_DEP)
140 .PHONY: clean install checkarch
143 cp -f liburcu.so /usr/lib/
144 cp -f arch.h arch_atomic.h compiler.h urcu.h urcu-static.h /usr/include/
147 rm -f *.o test_urcu test_urcu_dynamic_link test_urcu_timing \
148 test_rwlock_timing test_rwlock test_perthreadlock_timing \
149 test_perthreadlock test_urcu_yield test_urcu_mb \
150 urcu-asm.S test_qsbr_timing test_qsbr urcutorture \
151 urcutorture-yield liburcu.so api.h arch.h arch_atomic.h \
152 test_mutex test_urcu_gc test_urcu_gc_mb