1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
2c9636244STvrtko UrsulinCFLAGS += -I. -I../../include -g -O2 -Wall -fsanitize=address
3c9636244STvrtko UrsulinLDFLAGS += -fsanitize=address -fsanitize=undefined
4c9636244STvrtko UrsulinTARGETS = main
5c9636244STvrtko UrsulinOFILES = main.o scatterlist.o
6c9636244STvrtko Ursulin
7c9636244STvrtko Ursulinifeq ($(BUILD), 32)
8c9636244STvrtko Ursulin        CFLAGS += -m32
9c9636244STvrtko Ursulin        LDFLAGS += -m32
10c9636244STvrtko Ursulinendif
11c9636244STvrtko Ursulin
12c9636244STvrtko Ursulintargets: include $(TARGETS)
13c9636244STvrtko Ursulin
14c9636244STvrtko Ursulinmain: $(OFILES)
15c9636244STvrtko Ursulin
16c9636244STvrtko Ursulinclean:
17c9636244STvrtko Ursulin	$(RM) $(TARGETS) $(OFILES) scatterlist.c linux/scatterlist.h linux/highmem.h linux/kmemleak.h asm/io.h
18c9636244STvrtko Ursulin	@rmdir asm
19c9636244STvrtko Ursulin
20c9636244STvrtko Ursulinscatterlist.c: ../../../lib/scatterlist.c
21c9636244STvrtko Ursulin	@sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
22c9636244STvrtko Ursulin
23c9636244STvrtko Ursulin.PHONY: include
24c9636244STvrtko Ursulin
25c9636244STvrtko Ursulininclude: ../../../include/linux/scatterlist.h
26c9636244STvrtko Ursulin	@mkdir -p linux
27c9636244STvrtko Ursulin	@mkdir -p asm
28c9636244STvrtko Ursulin	@touch asm/io.h
29c9636244STvrtko Ursulin	@touch linux/highmem.h
30c9636244STvrtko Ursulin	@touch linux/kmemleak.h
31c9636244STvrtko Ursulin	@cp $< linux/scatterlist.h
32