xref: /linux/tools/testing/memblock/Makefile (revision aa486552a110fd6e625bb66b7edf0e0df7389a1a)
116802e55SKarolina Drobnik# SPDX-License-Identifier: GPL-2.0
216802e55SKarolina Drobnik
316802e55SKarolina Drobnik# Memblock simulator requires AddressSanitizer (libasan) and liburcu development
416802e55SKarolina Drobnik# packages installed
516802e55SKarolina DrobnikCFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
616802e55SKarolina Drobnik	  -fsanitize=undefined -D CONFIG_PHYS_ADDR_T_64BIT
716802e55SKarolina DrobnikLDFLAGS += -fsanitize=address -fsanitize=undefined
816802e55SKarolina DrobnikTARGETS = main
98f98435dSKarolina DrobnikTEST_OFILES = tests/alloc_nid_api.o tests/alloc_helpers_api.o tests/alloc_api.o \
1061da0332SRebecca Mckeever		  tests/basic_api.o tests/common.o tests/alloc_exact_nid_api.o
11*a88cde57SWei YangDEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o cmdline.o
12f3252a22SKarolina DrobnikOFILES = main.o $(DEP_OFILES) $(TEST_OFILES)
1316802e55SKarolina DrobnikEXTR_SRC = ../../../mm/memblock.c
1416802e55SKarolina Drobnik
1516802e55SKarolina Drobnikifeq ($(BUILD), 32)
1616802e55SKarolina Drobnik	CFLAGS += -m32
1716802e55SKarolina Drobnik	LDFLAGS += -m32
1816802e55SKarolina Drobnikendif
1916802e55SKarolina Drobnik
2016802e55SKarolina Drobnik# Process user parameters
2116802e55SKarolina Drobnikinclude scripts/Makefile.include
2216802e55SKarolina Drobnik
2316802e55SKarolina Drobnikmain: $(OFILES)
2416802e55SKarolina Drobnik
2516802e55SKarolina Drobnik$(OFILES): include
2616802e55SKarolina Drobnik
2716802e55SKarolina Drobnikinclude: ../../../include/linux/memblock.h ../../include/linux/*.h \
2816802e55SKarolina Drobnik	../../include/asm/*.h
2916802e55SKarolina Drobnik
3016802e55SKarolina Drobnik	@mkdir -p linux
3116802e55SKarolina Drobnik	test -L linux/memblock.h || ln -s ../../../../include/linux/memblock.h linux/memblock.h
3234072674SAaron Thompson	test -L asm/asm.h || ln -s ../../../arch/x86/include/asm/asm.h asm/asm.h
3316802e55SKarolina Drobnik	test -L asm/cmpxchg.h || ln -s ../../../arch/x86/include/asm/cmpxchg.h asm/cmpxchg.h
3416802e55SKarolina Drobnik
3516802e55SKarolina Drobnikmemblock.c: $(EXTR_SRC)
3616802e55SKarolina Drobnik	test -L memblock.c || ln -s $(EXTR_SRC) memblock.c
3716802e55SKarolina Drobnik
3816802e55SKarolina Drobnikclean:
3934072674SAaron Thompson	$(RM) $(TARGETS) $(OFILES) linux/memblock.h memblock.c asm/asm.h asm/cmpxchg.h
4016802e55SKarolina Drobnik
4116802e55SKarolina Drobnikhelp:
4216802e55SKarolina Drobnik	@echo  'Memblock simulator'
4316802e55SKarolina Drobnik	@echo  ''
4416802e55SKarolina Drobnik	@echo  'Available targets:'
4516802e55SKarolina Drobnik	@echo  '  main		  - Build the memblock simulator'
4616802e55SKarolina Drobnik	@echo  '  clean		  - Remove generated files and symlinks in the directory'
4716802e55SKarolina Drobnik	@echo  ''
4816802e55SKarolina Drobnik	@echo  'Configuration:'
49946dccb3SRebecca Mckeever	@echo  '  make MEMBLOCK_DEBUG=1     - enable memblock_dbg() messages'
5016802e55SKarolina Drobnik	@echo  '  make NUMA=1               - simulate enabled NUMA'
5116802e55SKarolina Drobnik	@echo  '  make 32BIT_PHYS_ADDR_T=1  - Use 32 bit physical addresses'
5216802e55SKarolina Drobnik
5316802e55SKarolina Drobnikvpath %.c ../../lib
5416802e55SKarolina Drobnik
5516802e55SKarolina Drobnik.PHONY: clean include help
56