blob: f11315bedefc3d68152bef22da0f8ab60f8c5be6 [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 Sachdevac6ce3e2f2017-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 Sachdevac6ce3e2f2017-02-13 16:16:03 -050013targets: mapshift $(TARGETS)
Matthew Wilcox1366c372016-03-17 14:21:45 -070014
15main: $(OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050016 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o main
17
18idr-test: idr-test.o $(CORE_OFILES)
19 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o idr-test
20
21multiorder: multiorder.o $(CORE_OFILES)
22 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o multiorder
Matthew Wilcox1366c372016-03-17 14:21:45 -070023
24clean:
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050025 $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070026
Matthew Wilcox991af732016-12-28 22:53:46 -050027vpath %.c ../../lib
Matthew Wilcox06295732016-12-14 15:08:29 -080028
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050029$(OFILES): *.h */*.h generated/map-shift.h \
Matthew Wilcox06295732016-12-14 15:08:29 -080030 ../../include/linux/*.h \
Matthew Wilcox43a30c22016-12-19 11:09:34 -050031 ../../include/asm/*.h \
Matthew Wilcox0a835c42016-12-20 10:27:56 -050032 ../../../include/linux/radix-tree.h \
33 ../../../include/linux/idr.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070034
35radix-tree.c: ../../../lib/radix-tree.c
36 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Matthew Wilcox0a835c42016-12-20 10:27:56 -050037
38idr.c: ../../../lib/idr.c
39 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050040
41.PHONY: mapshift
42
43mapshift:
44 @if ! grep -qw $(SHIFT) generated/map-shift.h; then \
45 echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \
46 generated/map-shift.h; \
47 fi