0001
0002
0003 CFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \
0004 -fsanitize=undefined
0005 LDFLAGS += -fsanitize=address -fsanitize=undefined
0006 LDLIBS+= -lpthread -lurcu
0007 TARGETS = main idr-test multiorder xarray
0008 CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o \
0009 slab.o
0010 OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
0011 regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \
0012 iteration_check_2.o benchmark.o
0013
0014 ifndef SHIFT
0015 SHIFT=3
0016 endif
0017
0018 ifeq ($(BUILD), 32)
0019 CFLAGS += -m32
0020 LDFLAGS += -m32
0021 endif
0022
0023 targets: generated/map-shift.h $(TARGETS)
0024
0025 main: $(OFILES)
0026
0027 idr-test.o: ../../../lib/test_ida.c
0028 idr-test: idr-test.o $(CORE_OFILES)
0029
0030 xarray: $(CORE_OFILES)
0031
0032 multiorder: multiorder.o $(CORE_OFILES)
0033
0034 clean:
0035 $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h
0036
0037 vpath %.c ../../lib
0038
0039 $(OFILES): Makefile *.h */*.h generated/map-shift.h \
0040 ../../include/linux/*.h \
0041 ../../include/asm/*.h \
0042 ../../../include/linux/xarray.h \
0043 ../../../include/linux/radix-tree.h \
0044 ../../../include/linux/idr.h
0045
0046 radix-tree.c: ../../../lib/radix-tree.c
0047 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
0048
0049 idr.c: ../../../lib/idr.c
0050 sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
0051
0052 xarray.o: ../../../lib/xarray.c ../../../lib/test_xarray.c
0053
0054 generated/map-shift.h:
0055 @if ! grep -qws $(SHIFT) generated/map-shift.h; then \
0056 echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \
0057 generated/map-shift.h; \
0058 fi