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 | 829f83d | 2017-01-28 10:03:48 -0500 | [diff] [blame] | 3 | CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE -fsanitize=address |
Michael Ellerman | 284d96a | 2017-03-02 04:29:00 -0500 | [diff] [blame] | 4 | LDFLAGS += -fsanitize=address |
| 5 | LDLIBS+= -lpthread -lurcu |
Matthew Wilcox | 8ac0486 | 2016-12-18 22:56:05 -0500 | [diff] [blame] | 6 | TARGETS = main idr-test multiorder |
| 7 | CORE_OFILES := radix-tree.o idr.o linux.o test.o find_bit.o |
| 8 | OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \ |
| 9 | tag_check.o multiorder.o idr-test.o iteration_check.o benchmark.o |
Konstantin Khlebnikov | cfa40bc | 2016-12-14 15:08:14 -0800 | [diff] [blame] | 10 | |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 11 | ifndef SHIFT |
| 12 | SHIFT=3 |
Konstantin Khlebnikov | cfa40bc | 2016-12-14 15:08:14 -0800 | [diff] [blame] | 13 | endif |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 14 | |
Rehas Sachdeva | c4634b0 | 2017-02-27 08:49:00 -0500 | [diff] [blame] | 15 | ifeq ($(BUILD), 32) |
| 16 | CFLAGS += -m32 |
Matthew Wilcox | f0f3f2d | 2017-03-03 12:28:37 -0500 | [diff] [blame] | 17 | LDFLAGS += -m32 |
Rehas Sachdeva | c4634b0 | 2017-02-27 08:49:00 -0500 | [diff] [blame] | 18 | endif |
| 19 | |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 20 | targets: mapshift $(TARGETS) |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 21 | |
| 22 | main: $(OFILES) |
Matthew Wilcox | 8ac0486 | 2016-12-18 22:56:05 -0500 | [diff] [blame] | 23 | |
| 24 | idr-test: idr-test.o $(CORE_OFILES) |
Matthew Wilcox | 8ac0486 | 2016-12-18 22:56:05 -0500 | [diff] [blame] | 25 | |
| 26 | multiorder: multiorder.o $(CORE_OFILES) |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 27 | |
| 28 | clean: |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 29 | $(RM) $(TARGETS) *.o radix-tree.c idr.c generated/map-shift.h |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 30 | |
Matthew Wilcox | 991af73 | 2016-12-28 22:53:46 -0500 | [diff] [blame] | 31 | vpath %.c ../../lib |
Matthew Wilcox | 0629573 | 2016-12-14 15:08:29 -0800 | [diff] [blame] | 32 | |
Matthew Wilcox | 3f1b6f9 | 2017-03-02 12:24:28 -0500 | [diff] [blame] | 33 | $(OFILES): Makefile *.h */*.h generated/map-shift.h \ |
Matthew Wilcox | 0629573 | 2016-12-14 15:08:29 -0800 | [diff] [blame] | 34 | ../../include/linux/*.h \ |
Matthew Wilcox | 43a30c2 | 2016-12-19 11:09:34 -0500 | [diff] [blame] | 35 | ../../include/asm/*.h \ |
Matthew Wilcox | 0a835c4 | 2016-12-20 10:27:56 -0500 | [diff] [blame] | 36 | ../../../include/linux/radix-tree.h \ |
| 37 | ../../../include/linux/idr.h |
Matthew Wilcox | 1366c37 | 2016-03-17 14:21:45 -0700 | [diff] [blame] | 38 | |
| 39 | radix-tree.c: ../../../lib/radix-tree.c |
| 40 | sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ |
Matthew Wilcox | 0a835c4 | 2016-12-20 10:27:56 -0500 | [diff] [blame] | 41 | |
| 42 | idr.c: ../../../lib/idr.c |
| 43 | sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@ |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 44 | |
| 45 | .PHONY: mapshift |
| 46 | |
| 47 | mapshift: |
Matthew Wilcox | 3f1b6f9 | 2017-03-02 12:24:28 -0500 | [diff] [blame] | 48 | @if ! grep -qws $(SHIFT) generated/map-shift.h; then \ |
Rehas Sachdeva | c6ce3e2f | 2017-02-13 16:16:03 -0500 | [diff] [blame] | 49 | echo "#define RADIX_TREE_MAP_SHIFT $(SHIFT)" > \ |
| 50 | generated/map-shift.h; \ |
| 51 | fi |