Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 2 | |
Matthew Wilcox | d1c0d5e | 2018-05-19 16:30:54 -0400 | [diff] [blame] | 3 | CFLAGS += -I. -I../../include -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address \ |
| 4 | -fsanitize=undefined |
| 5 | LDFLAGS += -fsanitize=address -fsanitize=undefined |
Michael Ellerman | 284d96a | 2017-03-02 04:29:00 -0500 | [diff] [blame] | 6 | LDLIBS+= -lpthread -lurcu |
Matthew Wilcox | ad3d6c7 | 2017-11-07 14:57:46 -0500 | [diff] [blame] | 7 | TARGETS = main idr-test multiorder xarray |
Matthew Wilcox | 58d6ea3 | 2017-11-10 15:15:08 -0500 | [diff] [blame] | 8 | CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o |
Matthew Wilcox | 8ac0486 | 2016-12-18 22:56:05 -0500 | [diff] [blame] | 9 | OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \ |
Matthew Wilcox (Oracle) | 7e934cf | 2020-03-12 17:29:11 -0400 | [diff] [blame] | 10 | regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \ |
| 11 | iteration_check_2.o benchmark.o |
Konstantin Khlebnikov | cfa40bc | 2016-12-14 15:08:14 -0800 | [diff] [blame] | 12 | |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 13 | ifndef SHIFT |
| 14 | SHIFT=3 |
Konstantin Khlebnikov | cfa40bc | 2016-12-14 15:08:14 -0800 | [diff] [blame] | 15 | endif |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 16 | |
Rehas Sachdeva | c4634b0 | 2017-02-27 08:49:00 -0500 | [diff] [blame] | 17 | ifeq ($(BUILD), 32) |
| 18 | CFLAGS += -m32 |
Matthew Wilcox | f0f3f2d | 2017-03-03 12:28:37 -0500 | [diff] [blame] | 19 | LDFLAGS += -m32 |
Rehas Sachdeva | c4634b0 | 2017-02-27 08:49:00 -0500 | [diff] [blame] | 20 | endif |
| 21 | |
Ross Zwisler | 8d9fa88 | 2018-05-18 16:08:51 -0700 | [diff] [blame] | 22 | targets: generated/map-shift.h $(TARGETS) |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 23 | |
| 24 | main: $(OFILES) |
Matthew Wilcox | 8ac0486 | 2016-12-18 22:56:05 -0500 | [diff] [blame] | 25 | |
Matthew Wilcox | 8ab8ba3 | 2018-06-18 16:59:29 -0400 | [diff] [blame] | 26 | idr-test.o: ../../../lib/test_ida.c |
Matthew Wilcox | 8ac0486 | 2016-12-18 22:56:05 -0500 | [diff] [blame] | 27 | idr-test: idr-test.o $(CORE_OFILES) |
Matthew Wilcox | 8ac0486 | 2016-12-18 22:56:05 -0500 | [diff] [blame] | 28 | |
Matthew Wilcox | ad3d6c7 | 2017-11-07 14:57:46 -0500 | [diff] [blame] | 29 | xarray: $(CORE_OFILES) |
| 30 | |
Matthew Wilcox | 8ac0486 | 2016-12-18 22:56:05 -0500 | [diff] [blame] | 31 | multiorder: multiorder.o $(CORE_OFILES) |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 32 | |
| 33 | clean: |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 34 | $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 35 | |
Matthew Wilcox | 991af73 | 2016-12-28 22:53:46 -0500 | [diff] [blame] | 36 | vpath %.c ../../lib |
Matthew Wilcox | 0629573 | 2016-12-14 15:08:29 -0800 | [diff] [blame] | 37 | |
Matthew Wilcox | 3f1b6f9 | 2017-03-02 12:24:28 -0500 | [diff] [blame] | 38 | $(OFILES): Makefile *.h */*.h generated/map-shift.h \ |
Matthew Wilcox | 0629573 | 2016-12-14 15:08:29 -0800 | [diff] [blame] | 39 | ../../include/linux/*.h \ |
Matthew Wilcox | 43a30c2 | 2016-12-19 11:09:34 -0500 | [diff] [blame] | 40 | ../../include/asm/*.h \ |
Matthew Wilcox | f8d5d0c | 2017-11-07 16:30:10 -0500 | [diff] [blame] | 41 | ../../../include/linux/xarray.h \ |
Matthew Wilcox | 0a835c4 | 2016-12-20 10:27:56 -0500 | [diff] [blame] | 42 | ../../../include/linux/radix-tree.h \ |
| 43 | ../../../include/linux/idr.h |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 44 | |
| 45 | radix-tree.c: ../../../lib/radix-tree.c |
| 46 | sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ |
Matthew Wilcox | 0a835c4 | 2016-12-20 10:27:56 -0500 | [diff] [blame] | 47 | |
| 48 | idr.c: ../../../lib/idr.c |
| 49 | sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 50 | |
Matthew Wilcox | ad3d6c7 | 2017-11-07 14:57:46 -0500 | [diff] [blame] | 51 | xarray.o: ../../../lib/xarray.c ../../../lib/test_xarray.c |
Matthew Wilcox | f8d5d0c | 2017-11-07 16:30:10 -0500 | [diff] [blame] | 52 | |
Ross Zwisler | 8d9fa88 | 2018-05-18 16:08:51 -0700 | [diff] [blame] | 53 | generated/map-shift.h: |
Matthew Wilcox | 3f1b6f9 | 2017-03-02 12:24:28 -0500 | [diff] [blame] | 54 | @if ! grep -qws $(SHIFT) generated/map-shift.h; then \ |
Matthew Wilcox | 02c02bf | 2017-11-03 23:09:45 -0400 | [diff] [blame] | 55 | echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \ |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 56 | generated/map-shift.h; \ |
| 57 | fi |