blob: 4c6289c5d415983afd7b38af51f832b40cdd1e11 [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 Sachdevac6ce3e2f2017-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
16endif
17
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050018targets: mapshift $(TARGETS)
Matthew Wilcox1366c372016-03-17 14:21:45 -070019
20main: $(OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050021
22idr-test: idr-test.o $(CORE_OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050023
24multiorder: multiorder.o $(CORE_OFILES)
Matthew Wilcox1366c372016-03-17 14:21:45 -070025
26clean:
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050027 $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070028
Matthew Wilcox991af732016-12-28 22:53:46 -050029vpath %.c ../../lib
Matthew Wilcox06295732016-12-14 15:08:29 -080030
Matthew Wilcox3f1b6f92017-03-02 12:24:28 -050031$(OFILES): Makefile *.h */*.h generated/map-shift.h \
Matthew Wilcox06295732016-12-14 15:08:29 -080032 ../../include/linux/*.h \
Matthew Wilcox43a30c22016-12-19 11:09:34 -050033 ../../include/asm/*.h \
Matthew Wilcox0a835c42016-12-20 10:27:56 -050034 ../../../include/linux/radix-tree.h \
35 ../../../include/linux/idr.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070036
37radix-tree.c: ../../../lib/radix-tree.c
38 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Matthew Wilcox0a835c42016-12-20 10:27:56 -050039
40idr.c: ../../../lib/idr.c
41 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050042
43.PHONY: mapshift
44
45mapshift:
Matthew Wilcox3f1b6f92017-03-02 12:24:28 -050046 @if ! grep -qws $(SHIFT) generated/map-shift.h; then \
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050047 echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \
48 generated/map-shift.h; \
49 fi