blob: aa6abfe0749c1a8fcf81a62d53ae59df8b2a865b [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 Wilcoxd1c0d5e2018-05-19 16:30:54 -04003CFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \
4 -fsanitize=undefined
5LDFLAGS += -fsanitize=address -fsanitize=undefined
Michael Ellerman284d96a2017-03-02 04:29:00 -05006LDLIBS+= -lpthread -lurcu
Matthew Wilcoxad3d6c72017-11-07 14:57:46 -05007TARGETS = main idr-test multiorder xarray
Matthew Wilcox58d6ea32017-11-10 15:15:08 -05008CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o
Matthew Wilcox8ac04862016-12-18 22:56:05 -05009OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
Matthew Wilcox (Oracle)7e934cf2020-03-12 17:29:11 -040010 regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \
11 iteration_check_2.o benchmark.o
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -080012
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050013ifndef SHIFT
14 SHIFT=3
Konstantin Khlebnikovcfa40bc2016-12-14 15:08:14 -080015endif
Matthew Wilcox1366c372016-03-17 14:21:45 -070016
Rehas Sachdevac4634b02017-02-27 08:49:00 -050017ifeq ($(BUILD), 32)
18 CFLAGS += -m32
Matthew Wilcoxf0f3f2d2017-03-03 12:28:37 -050019 LDFLAGS += -m32
Rehas Sachdevac4634b02017-02-27 08:49:00 -050020endif
21
Ross Zwisler8d9fa882018-05-18 16:08:51 -070022targets: generated/map-shift.h $(TARGETS)
Matthew Wilcox1366c372016-03-17 14:21:45 -070023
24main: $(OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050025
Matthew Wilcox8ab8ba32018-06-18 16:59:29 -040026idr-test.o: ../../../lib/test_ida.c
Matthew Wilcox8ac04862016-12-18 22:56:05 -050027idr-test: idr-test.o $(CORE_OFILES)
Matthew Wilcox8ac04862016-12-18 22:56:05 -050028
Matthew Wilcoxad3d6c72017-11-07 14:57:46 -050029xarray: $(CORE_OFILES)
30
Matthew Wilcox8ac04862016-12-18 22:56:05 -050031multiorder: multiorder.o $(CORE_OFILES)
Matthew Wilcox1366c372016-03-17 14:21:45 -070032
33clean:
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050034 $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070035
Matthew Wilcox991af732016-12-28 22:53:46 -050036vpath %.c ../../lib
Matthew Wilcox06295732016-12-14 15:08:29 -080037
Matthew Wilcox3f1b6f92017-03-02 12:24:28 -050038$(OFILES): Makefile *.h */*.h generated/map-shift.h \
Matthew Wilcox06295732016-12-14 15:08:29 -080039 ../../include/linux/*.h \
Matthew Wilcox43a30c22016-12-19 11:09:34 -050040 ../../include/asm/*.h \
Matthew Wilcoxf8d5d0c2017-11-07 16:30:10 -050041 ../../../include/linux/xarray.h \
Matthew Wilcox0a835c42016-12-20 10:27:56 -050042 ../../../include/linux/radix-tree.h \
43 ../../../include/linux/idr.h
Matthew Wilcox1366c372016-03-17 14:21:45 -070044
45radix-tree.c: ../../../lib/radix-tree.c
46 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Matthew Wilcox0a835c42016-12-20 10:27:56 -050047
48idr.c: ../../../lib/idr.c
49 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050050
Matthew Wilcoxad3d6c72017-11-07 14:57:46 -050051xarray.o: ../../../lib/xarray.c ../../../lib/test_xarray.c
Matthew Wilcoxf8d5d0c2017-11-07 16:30:10 -050052
Ross Zwisler8d9fa882018-05-18 16:08:51 -070053generated/map-shift.h:
Matthew Wilcox3f1b6f92017-03-02 12:24:28 -050054 @if ! grep -qws $(SHIFT) generated/map-shift.h; then \
Matthew Wilcox02c02bf2017-11-03 23:09:45 -040055 echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \
Rehas Sachdevac6ce3e2f2017-02-13 16:16:03 -050056 generated/map-shift.h; \
57 fi