Makefile 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # SPDX-License-Identifier: GPL-2.0
  2. # Memblock simulator requires AddressSanitizer (libasan) and liburcu development
  3. # packages installed
  4. CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
  5. -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT
  6. LDFLAGS += -fsanitize=address -fsanitize=undefined
  7. TARGETS = main
  8. TEST_OFILES = tests/alloc_nid_api.o tests/alloc_helpers_api.o tests/alloc_api.o \
  9. tests/basic_api.o tests/common.o
  10. DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o
  11. OFILES = main.o $(DEP_OFILES) $(TEST_OFILES)
  12. EXTR_SRC = ../../../mm/memblock.c
  13. ifeq ($(BUILD), 32)
  14. CFLAGS += -m32
  15. LDFLAGS += -m32
  16. endif
  17. # Process user parameters
  18. include scripts/Makefile.include
  19. main: $(OFILES)
  20. $(OFILES): include
  21. include: ../../../include/linux/memblock.h ../../include/linux/*.h \
  22. ../../include/asm/*.h
  23. @mkdir -p linux
  24. test -L linux/memblock.h || ln -s ../../../../include/linux/memblock.h linux/memblock.h
  25. test -L asm/asm.h || ln -s ../../../arch/x86/include/asm/asm.h asm/asm.h
  26. test -L asm/cmpxchg.h || ln -s ../../../arch/x86/include/asm/cmpxchg.h asm/cmpxchg.h
  27. memblock.c: $(EXTR_SRC)
  28. test -L memblock.c || ln -s $(EXTR_SRC) memblock.c
  29. clean:
  30. $(RM) $(TARGETS) $(OFILES) linux/memblock.h memblock.c asm/asm.h asm/cmpxchg.h
  31. help:
  32. @echo 'Memblock simulator'
  33. @echo ''
  34. @echo 'Available targets:'
  35. @echo ' main - Build the memblock simulator'
  36. @echo ' clean - Remove generated files and symlinks in the directory'
  37. @echo ''
  38. @echo 'Configuration:'
  39. @echo ' make MEMBLOCK_DEBUG=1 - enable memblock_dbg() messages'
  40. @echo ' make NUMA=1 - simulate enabled NUMA'
  41. @echo ' make 32BIT_PHYS_ADDR_T=1 - Use 32 bit physical addresses'
  42. vpath %.c ../../lib
  43. .PHONY: clean include help