xref: /linux/tools/testing/memblock/Makefile (revision 16802e55dea9534c18a30bd8eeefea8a06337916)
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
9OFILES = main.o memblock.o lib/slab.o mmzone.o slab.o
10EXTR_SRC = ../../../mm/memblock.c
11
12ifeq ($(BUILD), 32)
13	CFLAGS += -m32
14	LDFLAGS += -m32
15endif
16
17# Process user parameters
18include scripts/Makefile.include
19
20main: $(OFILES)
21
22$(OFILES): include
23
24include: ../../../include/linux/memblock.h ../../include/linux/*.h \
25	../../include/asm/*.h
26
27	@mkdir -p linux
28	test -L linux/memblock.h || ln -s ../../../../include/linux/memblock.h linux/memblock.h
29	test -L asm/cmpxchg.h || ln -s ../../../arch/x86/include/asm/cmpxchg.h asm/cmpxchg.h
30
31memblock.c: $(EXTR_SRC)
32	test -L memblock.c || ln -s $(EXTR_SRC) memblock.c
33
34clean:
35	$(RM) $(TARGETS) $(OFILES) linux/memblock.h memblock.c asm/cmpxchg.h
36
37help:
38	@echo  'Memblock simulator'
39	@echo  ''
40	@echo  'Available targets:'
41	@echo  '  main		  - Build the memblock simulator'
42	@echo  '  clean		  - Remove generated files and symlinks in the directory'
43	@echo  ''
44	@echo  'Configuration:'
45	@echo  '  make NUMA=1               - simulate enabled NUMA'
46	@echo  '  make MOVABLE_NODE=1       - override `movable_node_is_enabled`'
47	@echo  '                              definition to simulate movable NUMA nodes'
48	@echo  '  make 32BIT_PHYS_ADDR_T=1  - Use 32 bit physical addresses'
49
50vpath %.c ../../lib
51
52.PHONY: clean include help
53