1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0 21366c37eSMatthew Wilcox 3d1c0d5e3SMatthew WilcoxCFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \ 4d1c0d5e3SMatthew Wilcox -fsanitize=undefined 5d1c0d5e3SMatthew WilcoxLDFLAGS += -fsanitize=address -fsanitize=undefined 6284d96a4SMichael EllermanLDLIBS+= -lpthread -lurcu 7*ad3d6c72SMatthew WilcoxTARGETS = main idr-test multiorder xarray 8f8d5d0ccSMatthew WilcoxCORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o 98ac04868SMatthew WilcoxOFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \ 108ac04868SMatthew Wilcox tag_check.o multiorder.o idr-test.o iteration_check.o benchmark.o 11cfa40bcfSKonstantin Khlebnikov 12c6ce3e2fSRehas Sachdevaifndef SHIFT 13c6ce3e2fSRehas Sachdeva SHIFT=3 14cfa40bcfSKonstantin Khlebnikovendif 151366c37eSMatthew Wilcox 16c4634b08SRehas Sachdevaifeq ($(BUILD), 32) 17c4634b08SRehas Sachdeva CFLAGS += -m32 18f0f3f2d0SMatthew Wilcox LDFLAGS += -m32 19c4634b08SRehas Sachdevaendif 20c4634b08SRehas Sachdeva 218d9fa88eSRoss Zwislertargets: generated/map-shift.h $(TARGETS) 221366c37eSMatthew Wilcox 231366c37eSMatthew Wilcoxmain: $(OFILES) 248ac04868SMatthew Wilcox 258ab8ba38SMatthew Wilcoxidr-test.o: ../../../lib/test_ida.c 268ac04868SMatthew Wilcoxidr-test: idr-test.o $(CORE_OFILES) 278ac04868SMatthew Wilcox 28*ad3d6c72SMatthew Wilcoxxarray: $(CORE_OFILES) 29*ad3d6c72SMatthew Wilcox 308ac04868SMatthew Wilcoxmultiorder: multiorder.o $(CORE_OFILES) 311366c37eSMatthew Wilcox 321366c37eSMatthew Wilcoxclean: 33c6ce3e2fSRehas Sachdeva $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h 341366c37eSMatthew Wilcox 35991af734SMatthew Wilcoxvpath %.c ../../lib 360629573eSMatthew Wilcox 373f1b6f9dSMatthew Wilcox$(OFILES): Makefile *.h */*.h generated/map-shift.h \ 380629573eSMatthew Wilcox ../../include/linux/*.h \ 3943a30c2aSMatthew Wilcox ../../include/asm/*.h \ 40f8d5d0ccSMatthew Wilcox ../../../include/linux/xarray.h \ 410a835c4fSMatthew Wilcox ../../../include/linux/radix-tree.h \ 420a835c4fSMatthew Wilcox ../../../include/linux/idr.h 431366c37eSMatthew Wilcox 441366c37eSMatthew Wilcoxradix-tree.c: ../../../lib/radix-tree.c 451366c37eSMatthew Wilcox sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ 460a835c4fSMatthew Wilcox 470a835c4fSMatthew Wilcoxidr.c: ../../../lib/idr.c 480a835c4fSMatthew Wilcox sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ 49c6ce3e2fSRehas Sachdeva 50*ad3d6c72SMatthew Wilcoxxarray.o: ../../../lib/xarray.c ../../../lib/test_xarray.c 51f8d5d0ccSMatthew Wilcox 528d9fa88eSRoss Zwislergenerated/map-shift.h: 533f1b6f9dSMatthew Wilcox @if ! grep -qws $(SHIFT) generated/map-shift.h; then \ 5402c02bf1SMatthew Wilcox echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \ 55c6ce3e2fSRehas Sachdeva generated/map-shift.h; \ 56c6ce3e2fSRehas Sachdeva fi 57