blob: 6a9480c03cbdfce0ae5e29e32f2cedcc342d66e1 [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
Michael Ellerman284d96a2017-03-02 04:29:00 -05003LDFLAGS += -fsanitize=address
4LDLIBS+= -lpthread -lurcu
Matthew Wilcox8ac04862016-12-18 22:56:05 -05005TARGETS = main idr-test multiorder
6CORE_OFILES := radix-tree.o idr.o linux.o test.o find_bit.o
7OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
8 tag_check.o multiorder.o idr-test.o iteration_check.o benchmark.o
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -08009
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050010ifndef SHIFT
11 SHIFT=3
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -080012endif
Matthew Wilcox1366c372016-03-17 14:21:45 -070013
Rehas Sachdevac4634b02017-02-27 08:49:00 -050014ifeq ($(BUILD), 32)
15 CFLAGS += -m32
Matthew Wilcoxf0f3f2d2017-03-03 12:28:37 -050016 LDFLAGS += -m32
Rehas Sachdevac4634b02017-02-27 08:49:00 -050017endif
18
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050019targets: mapshift $(TARGETS)
Matthew Wilcox1366c372016-03-17 14:21:45 -070020
21main: $(OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050022
23idr-test: idr-test.o $(CORE_OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050024
25multiorder: multiorder.o $(CORE_OFILES)
Matthew Wilcox1366c372016-03-17 14:21:45 -070026
27clean:
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050028 $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070029
Matthew Wilcox991af732016-12-28 22:53:46 -050030vpath %.c ../../lib
Matthew Wilcox06295732016-12-14 15:08:29 -080031
Matthew Wilcox3f1b6f92017-03-02 12:24:28 -050032$(OFILES): Makefile *.h */*.h generated/map-shift.h \
Matthew Wilcox06295732016-12-14 15:08:29 -080033 ../../include/linux/*.h \
Matthew Wilcox43a30c22016-12-19 11:09:34 -050034 ../../include/asm/*.h \
Matthew Wilcox0a835c42016-12-20 10:27:56 -050035 ../../../include/linux/radix-tree.h \
36 ../../../include/linux/idr.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070037
38radix-tree.c: ../../../lib/radix-tree.c
39 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Matthew Wilcox0a835c42016-12-20 10:27:56 -050040
41idr.c: ../../../lib/idr.c
42 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050043
44.PHONY: mapshift
45
46mapshift:
Matthew Wilcox3f1b6f92017-03-02 12:24:28 -050047 @if ! grep -qws $(SHIFT) generated/map-shift.h; then \
Rehas Sachdevac6ce3e22017-02-13 16:16:03 -050048 echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \
49 generated/map-shift.h; \
50 fi