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