blob: fa7ee369b3c919c534e610a621c1bdd54bf1e986 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Matthew Wilcox1366c372016-03-17 14:21:45 -07002
Matthew Wilcox829f83d2017-01-28 10:03:48 -05003CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE -fsanitize=address
Michael Ellerman284d96a2017-03-02 04:29:00 -05004LDFLAGS += -fsanitize=address
5LDLIBS+= -lpthread -lurcu
Matthew Wilcox8ac04862016-12-18 22:56:05 -05006TARGETS = main idr-test multiorder
7CORE_OFILES := radix-tree.o idr.o linux.o test.o find_bit.o
8OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
9 tag_check.o multiorder.o idr-test.o iteration_check.o benchmark.o
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -080010
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050011ifndef SHIFT
12 SHIFT=3
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -080013endif
Matthew Wilcox1366c372016-03-17 14:21:45 -070014
Rehas Sachdevac4634b02017-02-27 08:49:00 -050015ifeq ($(BUILD), 32)
16 CFLAGS += -m32
Matthew Wilcoxf0f3f2d2017-03-03 12:28:37 -050017 LDFLAGS += -m32
Rehas Sachdevac4634b02017-02-27 08:49:00 -050018endif
19
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050020targets: mapshift $(TARGETS)
Matthew Wilcox1366c372016-03-17 14:21:45 -070021
22main: $(OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050023
24idr-test: idr-test.o $(CORE_OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050025
26multiorder: multiorder.o $(CORE_OFILES)
Matthew Wilcox1366c372016-03-17 14:21:45 -070027
28clean:
Rehas Sachdevac6ce3e2f2017-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
Matthew Wilcox3f1b6f92017-03-02 12:24:28 -050033$(OFILES): Makefile *.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 Sachdevac6ce3e2f2017-02-13 16:16:03 -050044
45.PHONY: mapshift
46
47mapshift:
Matthew Wilcox3f1b6f92017-03-02 12:24:28 -050048 @if ! grep -qws $(SHIFT) generated/map-shift.h; then \
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050049 echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \
50 generated/map-shift.h; \
51 fi