Makefile 1.3 KB

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