Makefile 1.5 KB

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