blob: b59c2a9ef778ed946bb218687dfd48d68f1ef510 [file] [log] [blame]
Matthew Wilcox1366c372016-03-17 14:21:45 -07001
Matthew Wilcox829f83d2017-01-28 10:03:48 -05002CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE -fsanitize=address
Matthew Wilcox1366c372016-03-17 14:21:45 -07003LDFLAGS += -lpthread -lurcu
Matthew Wilcox8ac04862016-12-18 22:56:05 -05004TARGETS = main idr-test multiorder
5CORE_OFILES := radix-tree.o idr.o linux.o test.o find_bit.o
6OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
7 tag_check.o multiorder.o idr-test.o iteration_check.o benchmark.o
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -08008
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -05009ifndef SHIFT
10 SHIFT=3
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -080011endif
Matthew Wilcox1366c372016-03-17 14:21:45 -070012
Rehas Sachdevac4634b02017-02-27 08:49:00 -050013ifeq ($(BUILD), 32)
14 CFLAGS += -m32
15endif
16
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050017targets: mapshift $(TARGETS)
Matthew Wilcox1366c372016-03-17 14:21:45 -070018
19main: $(OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050020 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o main
21
22idr-test: idr-test.o $(CORE_OFILES)
23 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o idr-test
24
25multiorder: multiorder.o $(CORE_OFILES)
26 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o multiorder
Matthew Wilcox1366c372016-03-17 14:21:45 -070027
28clean:
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050029 $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070030
Matthew Wilcox991af732016-12-28 22:53:46 -050031vpath %.c ../../lib
Matthew Wilcox06295732016-12-14 15:08:29 -080032
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050033$(OFILES): *.h */*.h generated/map-shift.h \
Matthew Wilcox06295732016-12-14 15:08:29 -080034 ../../include/linux/*.h \
Matthew Wilcox43a30c22016-12-19 11:09:34 -050035 ../../include/asm/*.h \
Matthew Wilcox0a835c42016-12-20 10:27:56 -050036 ../../../include/linux/radix-tree.h \
37 ../../../include/linux/idr.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070038
39radix-tree.c: ../../../lib/radix-tree.c
40 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Matthew Wilcox0a835c42016-12-20 10:27:56 -050041
42idr.c: ../../../lib/idr.c
43 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050044
45.PHONY: mapshift
46
47mapshift:
48 @if ! grep -qw $(SHIFT) generated/map-shift.h; then \
49 echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \
50 generated/map-shift.h; \
51 fi