1# SPDX-License-Identifier: GPL-2.0 2 3CFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \ 4 -fsanitize=undefined 5LDFLAGS += -fsanitize=address -fsanitize=undefined 6LDLIBS+= -lpthread -lurcu 7TARGETS = main idr-test multiorder xarray maple 8CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o \ 9 slab.o maple.o 10OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \ 11 regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \ 12 iteration_check_2.o benchmark.o 13 14ifndef SHIFT 15 SHIFT=3 16endif 17 18ifeq ($(BUILD), 32) 19 CFLAGS += -m32 20 LDFLAGS += -m32 21endif 22 23targets: generated/map-shift.h $(TARGETS) 24 25main: $(OFILES) 26 27idr-test.o: ../../../lib/test_ida.c 28idr-test: idr-test.o $(CORE_OFILES) 29 30xarray: $(CORE_OFILES) 31 32maple: $(CORE_OFILES) 33 34multiorder: multiorder.o $(CORE_OFILES) 35 36clean: 37 $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h 38 39vpath %.c ../../lib 40 41$(OFILES): Makefile *.h */*.h generated/map-shift.h \ 42 ../../include/linux/*.h \ 43 ../../include/asm/*.h \ 44 ../../../include/linux/xarray.h \ 45 ../../../include/linux/maple_tree.h \ 46 ../../../include/linux/radix-tree.h \ 47 ../../../include/linux/idr.h 48 49radix-tree.c: ../../../lib/radix-tree.c 50 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ 51 52idr.c: ../../../lib/idr.c 53 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ 54 55xarray.o: ../../../lib/xarray.c ../../../lib/test_xarray.c 56 57maple.o: ../../../lib/maple_tree.c ../../../lib/test_maple_tree.c 58 59generated/map-shift.h: 60 @if ! grep -qws $(SHIFT) generated/map-shift.h; then \ 61 echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \ 62 generated/map-shift.h; \ 63 fi 64