162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ciall: test mod 362306a36Sopenharmony_citest: virtio_test vringh_test 462306a36Sopenharmony_civirtio_test: virtio_ring.o virtio_test.o 562306a36Sopenharmony_civringh_test: vringh_test.o vringh.o virtio_ring.o 662306a36Sopenharmony_ci 762306a36Sopenharmony_citry-run = $(shell set -e; \ 862306a36Sopenharmony_ci if ($(1)) >/dev/null 2>&1; \ 962306a36Sopenharmony_ci then echo "$(2)"; \ 1062306a36Sopenharmony_ci else echo "$(3)"; \ 1162306a36Sopenharmony_ci fi) 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci__cc-option = $(call try-run,\ 1462306a36Sopenharmony_ci $(1) -Werror $(2) -c -x c /dev/null -o /dev/null,$(2),) 1562306a36Sopenharmony_cicc-option = $(call __cc-option, $(CC),$(1)) 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciCFLAGS += -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h $(call cc-option,-mfunction-return=thunk) $(call cc-option,-fcf-protection=none) $(call cc-option,-mindirect-branch-register) 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciCFLAGS += -pthread 2062306a36Sopenharmony_ciLDFLAGS += -pthread 2162306a36Sopenharmony_civpath %.c ../../drivers/virtio ../../drivers/vhost 2262306a36Sopenharmony_cimod: 2362306a36Sopenharmony_ci ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test V=${V} 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#oot: build vhost as an out of tree module for a distro kernel 2662306a36Sopenharmony_ci#no effort is taken to make it actually build or work, but tends to mostly work 2762306a36Sopenharmony_ci#if the distro kernel is very close to upstream 2862306a36Sopenharmony_ci#unsupported! this is a development tool only, don't use the 2962306a36Sopenharmony_ci#resulting modules in production! 3062306a36Sopenharmony_ciOOT_KSRC=/lib/modules/$$(uname -r)/build 3162306a36Sopenharmony_ciOOT_VHOST=`pwd`/../../drivers/vhost 3262306a36Sopenharmony_ci#Everyone depends on vhost 3362306a36Sopenharmony_ci#Tweak the below to enable more modules 3462306a36Sopenharmony_ciOOT_CONFIGS=\ 3562306a36Sopenharmony_ci CONFIG_VHOST=m \ 3662306a36Sopenharmony_ci CONFIG_VHOST_NET=n \ 3762306a36Sopenharmony_ci CONFIG_VHOST_SCSI=n \ 3862306a36Sopenharmony_ci CONFIG_VHOST_VSOCK=n \ 3962306a36Sopenharmony_ci CONFIG_VHOST_RING=n 4062306a36Sopenharmony_ciOOT_BUILD=KCFLAGS="-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=${V} 4162306a36Sopenharmony_cioot-build: 4262306a36Sopenharmony_ci echo "UNSUPPORTED! Don't use the resulting modules in production!" 4362306a36Sopenharmony_ci ${OOT_BUILD} M=`pwd`/vhost_test 4462306a36Sopenharmony_ci ${OOT_BUILD} M=${OOT_VHOST} ${OOT_CONFIGS} 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_cioot-clean: oot-build 4762306a36Sopenharmony_cioot: oot-build 4862306a36Sopenharmony_cioot-clean: OOT_BUILD+=clean 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci.PHONY: all test mod clean vhost oot oot-clean oot-build 5162306a36Sopenharmony_ciclean: 5262306a36Sopenharmony_ci ${RM} *.o vringh_test virtio_test vhost_test/*.o vhost_test/.*.cmd \ 5362306a36Sopenharmony_ci vhost_test/Module.symvers vhost_test/modules.order *.d 5462306a36Sopenharmony_ci-include *.d 55