Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 maple
  7. CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o \
  8. slab.o maple.o
  9. OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
  10. regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \
  11. iteration_check_2.o benchmark.o
  12. ifndef SHIFT
  13. SHIFT=3
  14. endif
  15. ifeq ($(BUILD), 32)
  16. CFLAGS += -m32
  17. LDFLAGS += -m32
  18. LONG_BIT := 32
  19. endif
  20. ifndef LONG_BIT
  21. LONG_BIT := $(shell getconf LONG_BIT)
  22. endif
  23. targets: generated/map-shift.h generated/bit-length.h $(TARGETS)
  24. main: $(OFILES)
  25. idr-test.o: ../../../lib/test_ida.c
  26. idr-test: idr-test.o $(CORE_OFILES)
  27. xarray: $(CORE_OFILES)
  28. maple: $(CORE_OFILES)
  29. multiorder: multiorder.o $(CORE_OFILES)
  30. clean:
  31. $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h generated/bit-length.h
  32. vpath %.c ../../lib
  33. $(OFILES): Makefile *.h */*.h generated/map-shift.h generated/bit-length.h \
  34. ../../include/linux/*.h \
  35. ../../include/asm/*.h \
  36. ../../../include/linux/xarray.h \
  37. ../../../include/linux/maple_tree.h \
  38. ../../../include/linux/radix-tree.h \
  39. ../../../include/linux/idr.h
  40. radix-tree.c: ../../../lib/radix-tree.c
  41. sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
  42. idr.c: ../../../lib/idr.c
  43. sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
  44. xarray.o: ../../../lib/xarray.c ../../../lib/test_xarray.c
  45. maple.o: ../../../lib/maple_tree.c ../../../lib/test_maple_tree.c
  46. generated/map-shift.h:
  47. @if ! grep -qws $(SHIFT) generated/map-shift.h; then \
  48. echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \
  49. generated/map-shift.h; \
  50. fi
  51. generated/bit-length.h: FORCE
  52. @if ! grep -qws CONFIG_$(LONG_BIT)BIT generated/bit-length.h; then \
  53. echo "Generating $@"; \
  54. echo "#define CONFIG_$(LONG_BIT)BIT 1" > $@; \
  55. fi
  56. FORCE: ;