18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ciCFLAGS += -I. -I../../include -g -O2 -Wall -fsanitize=address
38c2ecf20Sopenharmony_ciLDFLAGS += -fsanitize=address -fsanitize=undefined
48c2ecf20Sopenharmony_ciTARGETS = main
58c2ecf20Sopenharmony_ciOFILES = main.o scatterlist.o
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciifeq ($(BUILD), 32)
88c2ecf20Sopenharmony_ci        CFLAGS += -m32
98c2ecf20Sopenharmony_ci        LDFLAGS += -m32
108c2ecf20Sopenharmony_ciendif
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_citargets: include $(TARGETS)
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cimain: $(OFILES)
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciclean:
178c2ecf20Sopenharmony_ci	$(RM) $(TARGETS) $(OFILES) scatterlist.c linux/scatterlist.h linux/highmem.h linux/kmemleak.h linux/slab.h asm/io.h
188c2ecf20Sopenharmony_ci	@rmdir asm
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciscatterlist.c: ../../../lib/scatterlist.c
218c2ecf20Sopenharmony_ci	@sed -e 's/^static //' -e 's/__always_inline //' -e 's/inline //' < $< > $@
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci.PHONY: include
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciinclude: ../../../include/linux/scatterlist.h
268c2ecf20Sopenharmony_ci	@mkdir -p linux
278c2ecf20Sopenharmony_ci	@mkdir -p asm
288c2ecf20Sopenharmony_ci	@touch asm/io.h
298c2ecf20Sopenharmony_ci	@touch linux/highmem.h
308c2ecf20Sopenharmony_ci	@touch linux/kmemleak.h
318c2ecf20Sopenharmony_ci	@touch linux/slab.h
328c2ecf20Sopenharmony_ci	@cp $< linux/scatterlist.h
33